/* ========================================
   NAVIGATION BAR
   Menu de navegação horizontal principal
   ======================================== */

.primary-navigation {
  background: transparent; /* Transparente para não duplicar fundo */
  box-shadow: none; /* Sem sombra no container externo */
  position: sticky;
  top: 88px; /* Header (64px) + Faixa azul (24px) */
  z-index: 1001;
  padding: 0 20px;
  margin-top: 0;
  transition: all 0.3s ease;
}

/* Quando a página é scrollada, menu vai para o topo */
.scrolled .primary-navigation {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 0; /* Remove padding lateral */
  background: #050A30; /* Fundo completo */
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  background: #050A30;
  border-radius: 12px; /* Border radius moderado - mais quadrado */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

/* Menu expandido quando scrolled */
.scrolled .nav-container {
  max-width: 100%; /* Largura total */
  border-radius: 0; /* Sem bordas arredondadas */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Sombra mais sutil */
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 32px;
  margin: 0;
  padding: 0;
  align-items: center;
  flex: 1;
  justify-content: center; /* Centraliza os itens do menu */
}

.nav-menu > li {
  position: relative;
}

.nav-menu a {
  color: #ffffff;
  text-decoration: none;
  padding: 16px 0; /* Reduzido para menu mais compacto */
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

/* Efeito de sublinhado no hover */
.nav-menu > li > a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.3s ease;
}

.nav-menu > li > a:hover::after,
.nav-menu > li > a:focus::after {
  width: 100%;
}

.nav-menu a:hover,
.nav-menu a:focus {
  color: #6366f1;
  outline: none;
}

/* Dropdown Arrow */
.dropdown-arrow {
  transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-arrow,
.has-dropdown.focused .dropdown-arrow {
  transform: rotate(180deg);
}

/* ========================================
   DROPDOWN MENU
   ======================================== */

.has-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0s 0.2s, transform 0.2s ease;
  list-style: none;
  padding: 8px 0;
  margin: 0;
  margin-top: 0; /* Sem gap entre item e dropdown */
  padding-top: 16px; /* Área invisível para facilitar hover */
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown.focused .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.2s ease, visibility 0s 0s, transform 0.2s ease;
  transition-delay: 0s; /* Aparece imediatamente */
}

/* Delay ao sair do hover - não some instantaneamente */
.has-dropdown .dropdown-menu {
  transition-delay: 0s, 150ms, 0s; /* Delay de 150ms antes de sumir */
}

.has-dropdown:hover .dropdown-menu {
  transition-delay: 0s, 0s, 0s; /* Remove delay ao entrar */
}

.dropdown-menu li {
  padding: 0;
}

/* Primeiro item não precisa de padding extra */
.dropdown-menu li:first-child a {
  margin-top: -8px; /* Compensa o padding-top invisível */
}

.dropdown-menu a {
  color: #2c3e50;
  padding: 12px 20px;
  display: block;
  font-size: 14px;
  transition: all 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
  background: #f8f9fa;
  color: #6366f1;
  padding-left: 24px;
}

.dropdown-menu a::after {
  display: none;
}

/* ========================================
   SEARCH & ACTIONS
   ======================================== */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-toggle {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-toggle:hover,
.search-toggle:focus {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
  outline: none;
}

/* Search Bar */
.search-bar {
  background: rgba(13, 27, 42, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  max-height: 100px;
  overflow: hidden;
}

.search-bar.hidden {
  max-height: 0;
  padding: 0;
  opacity: 0;
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 14px;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(255, 255, 255, 0.15);
}

.search-submit,
.search-close {
  background: #6366f1;
  border: none;
  color: #ffffff;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-submit:hover,
.search-close:hover {
  background: #8b5cf6;
  transform: scale(1.05);
}

.search-close {
  background: rgba(255, 255, 255, 0.1);
}

.search-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 992px) {
  .nav-menu {
    gap: 24px;
  }

  .nav-menu a {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .primary-navigation {
    position: relative;
  }

  .nav-menu {
    display: none;
  }

  .nav-container {
    justify-content: flex-end;
    padding: 12px 20px;
  }

  /* Mostrar apenas ícone de busca no mobile */
  .nav-actions {
    margin-left: auto;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus visible para navegação por teclado */
.nav-menu a:focus-visible,
.search-toggle:focus-visible,
.search-submit:focus-visible,
.search-close:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Reduzir animações para usuários com preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  .nav-menu a,
  .dropdown-menu,
  .search-bar,
  .dropdown-arrow {
    transition: none;
  }
}
