/* ===== styles/header.css ===== */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  background: transparent;
  transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.3s ease;
  z-index: 1000;
  box-shadow: none;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Quando ainda transparente (sobre o hero) */
.header.header-transparent {
  background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
}

.header.header-transparent .nav-list > li > a {
  color: rgba(255,255,255,0.9) !important;
}

.header.header-transparent .nav-indicator {
  background: rgba(255,255,255,0.15) !important;
}

/* Quando scrollado */
.header.scrolled {
  background: var(--cor-secundaria);
  box-shadow: 0 4px 24px rgba(77,47,38,0.2);
  padding-top: 0;
  padding-bottom: 0;
}

/* Só os links do primeiro nível ficam brancos — antes o seletor ".nav-list a"
   também pegava os links do dropdown (fundo branco), deixando-os invisíveis */
.header.scrolled .nav-list > li > a {
  color: rgba(255,255,255,0.92) !important;
}

.header.scrolled .nav-indicator {
  background: rgba(221,101,52,0.25) !important;
}

.header.scrolled .nav-list > li.hovered > a {
  color: #ffffff !important;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.logo img {
  height: 64px;
  width: auto;
  transition: height 0.3s;
}

.header.scrolled .logo img {
  height: 50px;
}

/* Nav */
.nav-list {
  position: relative;
  display: flex;
  gap: 0.15rem;
  list-style: none;
  font-weight: 500;
  align-items: center;
}

.nav-list > li {
  position: relative;
  z-index: 2;
}

.nav-list a {
  font-size: 0.92rem;
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.25s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
  border-radius: 8px;
}

/* Seta do submenu */
.submenu-arrow {
  font-size: 0.62rem;
  opacity: 0.6;
  transition: transform 0.3s ease;
}



/* Indicador pílula */
.nav-indicator {
  position: absolute;
  height: 78%;
  border-radius: 8px;
  z-index: 1;
  top: 11%;
  left: 0;
  width: 0;
  opacity: 0;
  pointer-events: none;
  background: rgba(221,101,52,0.2);
}

/* Submenu dropdown */
.submenu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: #fff;
  min-width: 230px;
  box-shadow: 0 16px 40px rgba(77,47,38,0.18);
  border-radius: 12px;
  list-style: none;
  padding: 0.5rem 0;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100;
  border: 1px solid rgba(221,101,52,0.1);
}

/* "Ponte" invisível cobrindo o espaço entre o link e o dropdown,
   para o menu não fechar ao atravessar esse vão com o mouse */
.submenu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

/* Setinha do dropdown */
.submenu::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid rgba(221,101,52,0.1);
  border-top: 1px solid rgba(221,101,52,0.1);
  transform: rotate(45deg);
}

.has-submenu.open > .submenu {
  pointer-events: auto;
}

.has-submenu.open > a .submenu-arrow {
  transform: rotate(180deg);
}

.submenu li {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Seletor mais específico que os estados do header (transparente/scrolled),
   garantindo texto escuro legível em qualquer situação */
.header .nav-list .submenu a {
  color: var(--cor-texto) !important;
  padding: 0.65rem 1.4rem;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s, padding 0.15s;
}

.header .nav-list .submenu a:hover,
.header .nav-list .submenu a:focus-visible {
  background-color: rgba(221,101,52,0.08);
  color: var(--cor-primaria) !important;
  padding-left: 1.8rem;
  outline: none;
}

/* HR decorativo sob nav */
.hr { display: none; }

/* Botão CTA no header */
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--cor-primaria);
  color: #fff !important;
  padding: 0.6rem 1.4rem;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(221,101,52,0.3);
  margin-left: 0.5rem;
}

.header-cta:hover {
  background: #c5582b;
  transform: translateY(-1px);
}

/* ── Menu mobile ── */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s;
}

.header.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.header.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .header-cta { display: none; }
  .logo img { height: 52px; }

  .header nav {
    display: none;
    width: 100%;
    order: 3;
  }

  .header.menu-open { background: var(--cor-bordo); }
  .header.menu-open nav { display: block; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 1rem;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
  }

  .nav-indicator { display: none; }

  .header .nav-list > li > a {
    color: #fff !important;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    border-radius: 0;
  }

  .header .nav-list .submenu {
    position: static;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto;
    transform: none !important;
    display: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: rgba(0,0,0,0.12);
    min-width: 0;
  }

  .header .nav-list .submenu::after { display: none; }
  .header .nav-list .has-submenu.mobile-open > .submenu { display: block; }
  .header .nav-list .has-submenu.mobile-open > a .submenu-arrow { transform: rotate(180deg); }

  .header .nav-list .submenu a {
    color: rgba(255,255,255,0.85) !important;
    padding-left: 2rem;
  }
}
