/**
 * Estilos Mejorados para Navegación con Scrollspy
 * Arquitectura Senior: Estados visuales fluidos y retroalimentación clara
 */

/* ====== HEADER STICKY ====== */
.header-section {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  width: 100%;
  transition: all 0.3s ease;
}

.header-section.scroll-shadow {
  box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.15);
}

/* ====== NAVBAR NAV ITEMS ====== */
.navbar-nav .dropdown {
  position: relative;
  transition: all 0.3s ease;
}

/* ====== BOTONES PÍLDORA CON ESTADO ACTIVO ====== */
.navbar-nav a {
  position: relative;
  padding: 8px 16px;
  border: 1.5px solid transparent;
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  white-space: nowrap;
}

.navbar-nav a:hover {
  border-color: #196aea;
  color: #196aea;
  transform: translateY(-2px);
}

/* Estado activo para scrollspy */
.navbar-nav .dropdown.active-nav > a,
.navbar-nav .dropdown.active-nav > .dropdown-toggle {
  background-color: rgba(25, 106, 234, 0.1);
  border-color: #196aea;
  color: #196aea;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(25, 106, 234, 0.08);
}

/* Efecto de pulso en el estado activo */
.navbar-nav .dropdown.active-nav > a::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background-color: #196aea;
  border-radius: 50%;
  opacity: 1;
  animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
  0%, 100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 0.5;
    transform: translateX(-50%) scale(1.3);
  }
}

/* ====== DROPDOWN MENU ====== */
.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid transparent;
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  position: relative;
}

.dropdown-toggle:hover {
  border-color: #196aea;
  color: #196aea;
  transform: translateY(-2px);
}

.dropdown-toggle i {
  transition: transform 0.3s ease;
  font-size: 12px;
}

/* Rotación del icono cuando está activo */
.dropdown_btn.show .dropdown-toggle i {
  transform: rotate(180deg);
}

/* ====== DROPDOWN MENU CONTAINER (FIX GAP) ====== */
/* Pseudoelemento para llenar el gap entre botón y menú */
.dropdown_btn::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 10px;
  z-index: 999;
  pointer-events: auto;
}

.dropdown_btn .drop_menu::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
  background: transparent;
  z-index: 999;
}

/* ====== DROPDOWN MENU ITEMS ====== */
.drop_menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0px;
  min-width: 200px;
  background-color: rgba(var(--f1), 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(25, 106, 234, 0.2);
  border-radius: 12px;
  padding: 10px;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.drop_menu.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0px);
}

/* Mantener el menú visible mientras el mouse está sobre el botón o el menú */
.dropdown_btn:hover .drop_menu,
.dropdown_btn:has(.drop_menu:hover) .drop_menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dropdown-item {
  display: block;
  padding: 10px 16px;
  margin: 4px 0;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background-color: rgba(25, 106, 234, 0.1);
  padding-left: 20px;
  color: #196aea;
}

.dropdown-item:active {
  background-color: rgba(25, 106, 234, 0.2);
}

/* ====== INDICADOR DE SECCIÓN ACTUAL ====== */
.section-indicator {
  position: fixed;
  left: 0;
  width: 3px;
  background: linear-gradient(to bottom, #196aea, transparent);
  z-index: 998;
  transition: top 0.3s ease;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 991px) {
  .navbar-nav a,
  .dropdown-toggle {
    padding: 10px 14px;
    font-size: 14px;
  }

  .drop_menu {
    position: static;
    transform: none;
    margin-top: 8px;
    margin-left: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    width: 200px;
  }

  .drop_menu.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .navbar-nav .dropdown.active-nav > a::after {
    display: none;
  }
}

@media (max-width: 576px) {
  .navbar-nav a,
  .dropdown-toggle {
    padding: 8px 12px;
    font-size: 13px;
  }

  .drop_menu {
    min-width: 180px;
  }
}

/* ====== MODO OSCURO (si aplica) ====== */
[data-theme="dark"] .drop_menu {
  background-color: rgba(var(--n5), 0.98);
  border-color: rgba(25, 106, 234, 0.15);
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: rgba(25, 106, 234, 0.15);
}

/* ====== TRANSICIONES SUAVES ====== */
html {
  scroll-behavior: smooth;
}

/* Optimización de rendimiento: usar GPU para animaciones */
.navbar-nav .dropdown,
.dropdown-toggle,
.drop_menu {
  will-change: transform, opacity;
}
