/* =====================================
   BARRA-DE-BUSQUEDA.CSS - Navbar y sistema de búsqueda con menús anidados
   ===================================== */

/* ============================
   NAVBAR PRINCIPAL
   ============================ */

.navbar-horizontal {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 2rem;
  position: relative;
  padding: 12px 20px;
  gap: 15px;
}

.nav-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

.logo {
  width: 200px;
  height: auto;
  max-height: 70px;
  object-fit: contain;
}

/* ============================
   MENÚ HAMBURGUESA
   ============================ */

.menu-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  transition: transform 0.3s ease;
  border-radius: 4px;
}

.menu-toggle:hover {
  transform: translateY(-50%) scale(1.05);
}

/* Líneas del hamburguesa */
.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: #333;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform-origin: center center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.hamburger-line:nth-child(1) {
  top: 12px;
}

.hamburger-line:nth-child(2) {
  top: 17px;
}

.hamburger-line:nth-child(3) {
  top: 22px;
}

/* Animación a X cuando está activo */
.menu-toggle.active .hamburger-line:nth-child(1) {
  top: 17px;
  transform: translateX(-50%) rotate(45deg);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(-50%) scaleX(0);
}

.menu-toggle.active .hamburger-line:nth-child(3) {
  top: 17px;
  transform: translateX(-50%) rotate(-45deg);
}

/* ============================
   NAVEGACIÓN
   ============================ */

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  transition: all 0.4s ease;
}

.nav-buttons li {
  position: relative;
}

.nav-buttons a,
.nav-buttons button {
  display: inline-block;
  padding: 12px 16px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 14px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-buttons a:hover,
.nav-buttons button:hover {
  background-color: #007bff;
  color: white;
  transform: translateY(-2px);
}

/* ============================
   DROPDOWNS Y MENÚS ANIDADOS - OPTIMIZADO PARA MÓVIL
   ============================ */

/* Dropdown básico */
/* Dropdown básico */
.dropdown {
  position: relative;
}

/* Menú principal (primer nivel) */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 1000;
  min-width: 220px;
  width: max-content;
  /* NUEVO: permite expansión automática */
  max-width: 650px;
  /* NUEVO: límite máximo */
  border-radius: 8px;
  overflow: visible;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: white;
  border: 1px solid #e0e0e0;
}

.dropdown-menu.show {
  display: block;
}

/* Menús anidados (segundo nivel) */
.nested {
  position: relative;
}

.nested>.dropdown-menu {
  position: absolute;
  top: 0;
  left: 100%;
  transform: none;
  margin-left: 5px;
  z-index: 1001;
  width: max-content;
  /* NUEVO */
  max-width: 320px;
  /* NUEVO */
}

/* FUNCIONALIDAD AMPLIADA: Menús con scroll para áreas educativas Y terciario */
.nested>.dropdown-menu#submenu-areas-educativas,
.nested>.dropdown-menu#submenu-terciario {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #007bff #f1f1f1;
}

/* Estilos del scrollbar para webkit (Chrome, Safari, Edge) */
.nested>.dropdown-menu#submenu-areas-educativas::-webkit-scrollbar,
.nested>.dropdown-menu#submenu-terciario::-webkit-scrollbar {
  width: 6px;
}

.nested>.dropdown-menu#submenu-areas-educativas::-webkit-scrollbar-track,
.nested>.dropdown-menu#submenu-terciario::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.nested>.dropdown-menu#submenu-areas-educativas::-webkit-scrollbar-thumb,
.nested>.dropdown-menu#submenu-terciario::-webkit-scrollbar-thumb {
  background: #007bff;
  border-radius: 3px;
  transition: background 0.3s ease;
}

.nested>.dropdown-menu#submenu-areas-educativas::-webkit-scrollbar-thumb:hover,
.nested>.dropdown-menu#submenu-terciario::-webkit-scrollbar-thumb:hover {
  background: #0056b3;
}

/* Menús anidados de tercer nivel */
.nested-level-2 {
  position: relative;
}

.nested-level-2>.dropdown-menu {
  position: absolute;
  top: 0;
  left: 100%;
  transform: none;
  margin-left: 5px;
  z-index: 1002;
  min-width: 200px;
  max-height: 250px;
  overflow-y: auto;
}

/* Estilos específicos para menús anidados */
.nested-menu {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}

.nested-menu-level-2 {
  background: #e9ecef;
  border: 1px solid #ced4da;
}

/* Items de menú */
.dropdown-menu li {
  position: relative;
  flex-shrink: 0;
}

.dropdown-menu li a,
.dropdown-menu li button {
  display: block;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  /* Permitir que el texto se ajuste si es necesario */
  white-space: normal;
  /* CAMBIADO: permite múltiples líneas si es muy largo */
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  /* Agrega guiones si es necesario */
}

/* Estilos específicos para enlaces directos */
.dropdown-menu li a[href^="./area-educativa"],
.dropdown-menu li a[href^="./curso-ctt"] {
  font-weight: 500;
  position: relative;
  padding-left: 20px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.dropdown-menu li a[href^="./area-educativa"]:before,
.dropdown-menu li a[href^="./curso-ctt"]:before {
  content: "→";
  position: absolute;
  left: 8px;
  color: #007bff;
  font-weight: bold;
  transition: transform 0.2s ease;
}

.dropdown-menu li a[href^="./area-educativa"]:hover:before,
.dropdown-menu li a[href^="./curso-ctt"]:hover:before {
  transform: translateX(2px);
}

/* Estilos específicos para el enlace "Todos los cursos" */
.dropdown-menu>li>a[href="./cursos.html"] {
  font-weight: 600;
  color: #007bff;
  border-top: 2px solid #e9ecef;
  margin-top: 5px;
  padding-top: 12px;
  position: relative;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.dropdown-menu>li>a[href="./cursos.html"]:hover {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  transform: translateX(3px);
}

.dropdown-menu>li>a[href="./cursos.html"]:before {
  content: "📚";
  margin-right: 8px;
  font-size: 16px;
}

/* Botones con flechas para indicar submenús */
.dropdown button span[aria-hidden="true"] {
  margin-left: 8px;
  font-size: 10px;
  transition: transform 0.3s ease;
}

.nested button span[aria-hidden="true"],
.nested-level-2 button span[aria-hidden="true"] {
  float: right;
}

/* Hover states - SOLO PARA ESCRITORIO */
@media (min-width: 769px) {

  .dropdown-menu li:hover>a,
  .dropdown-menu li:hover>button {
    background-color: #007bff;
    color: white;
  }

  /* Mostrar submenús al hacer hover en escritorio */
  .nested:hover>.dropdown-menu,
  .nested-level-2:hover>.dropdown-menu {
    display: block;
  }
}

/* ============================
   AJUSTES PARA PANTALLAS MEDIANAS (tablets, laptops pequeños)
   ============================ */

@media (min-width: 769px) and (max-width: 1200px) {

  /* Reducir max-width en pantallas medianas */
  .dropdown-menu {
    max-width: 320px;
  }

  .nested>.dropdown-menu,
  .nested-level-2>.dropdown-menu {
    max-width: 280px;
  }

  /* Permitir saltos de línea en pantallas medianas */
  .dropdown-menu li a,
  .dropdown-menu li button {
    white-space: normal;
    word-wrap: break-word;
  }
}

/* Solo en pantallas grandes usar nowrap */
@media (min-width: 1201px) {

  .dropdown-menu li a,
  .dropdown-menu li button {
    white-space: nowrap;
  }

  .dropdown-menu {
    max-width: 450px;
  }

  .nested>.dropdown-menu,
  .nested-level-2>.dropdown-menu {
    max-width: 450px;
  }
}

/* NUEVOS ESTILOS PARA MÓVIL - MEJORA PRINCIPAL */
@media (max-width: 768px) {

  /* Botones de submenú más grandes y accesibles en móvil */
  .nested>button,
  .nested-level-2>button {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    font-size: 15px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    position: relative;
  }

  /* Icono de flecha más visible en móvil */
  .nested>button span[aria-hidden="true"],
  .nested-level-2>button span[aria-hidden="true"] {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: transform 0.3s ease;
  }

  /* Rotación de flecha cuando está expandido */
  .nested>button[aria-expanded="true"] span[aria-hidden="true"] {
    transform: translateY(-50%) rotate(90deg);
  }

  .nested-level-2>button[aria-expanded="true"] span[aria-hidden="true"] {
    transform: translateY(-50%) rotate(90deg);
  }

  /* Submenús en móvil - stack vertical */
  .nested>.dropdown-menu,
  .nested-level-2>.dropdown-menu {
    position: static;
    transform: none;
    margin: 0;
    box-shadow: inset 3px 0 0 #007bff;
    border-left: none;
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  /* Mostrar submenús cuando están expandidos */
  .nested>.dropdown-menu.show {
    max-height: 400px;
    overflow-y: auto;
  }

  .nested-level-2>.dropdown-menu.show {
    max-height: 300px;
    overflow-y: auto;
  }

  /* Ajustes para áreas educativas y terciario en móvil */
  .nested>.dropdown-menu#submenu-areas-educativas.show,
  .nested>.dropdown-menu#submenu-terciario.show {
    max-height: 250px;
  }

  /* Indentación visual para diferentes niveles */
  .nested-menu {
    background: transparent;
    border: none;
    padding-left: 15px;
  }

  .nested-menu-level-2 {
    background: transparent;
    border: none;
    padding-left: 30px;
  }

  /* Enlaces y botones más grandes para touch */
  .dropdown-menu li a,
  .dropdown-menu li button {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .dropdown-menu li a,
  .dropdown-menu li button {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    white-space: normal;
    /* NUEVO: permite múltiples líneas en móvil */
    word-wrap: break-word;
    /* NUEVO */
  }

  /* Ajustes para enlaces directos en móvil */
  .dropdown-menu li a[href^="./area-educativa"],
  .dropdown-menu li a[href^="./curso-ctt"] {
    padding-left: 20px;
    background: rgba(0, 123, 255, 0.05);
  }

  /* Ocultar iconos de flecha en enlaces directos */
  .dropdown-menu li a[href^="./area-educativa"]:before,
  .dropdown-menu li a[href^="./curso-ctt"]:before {
    display: none;
  }

  /* Estados activos más visibles en móvil */
  .dropdown-menu li a:active,
  .dropdown-menu li button:active {
    background-color: #007bff;
    color: white;
    transform: scale(0.98);
  }
}

/* Indicadores de estado activo */
.dropdown[aria-expanded="true"]>button span[aria-hidden="true"] {
  transform: rotate(180deg);
}

/* Detección inteligente de overflow para menús de tercer nivel */
.nested-level-2.flip-horizontal>.dropdown-menu {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 5px;
}

/* Animaciones suaves para la apertura de menús - SOLO ESCRITORIO */
@media (min-width: 769px) {
  .dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }

  .nested>.dropdown-menu {
    transform: translateX(-10px);
    opacity: 0;
    visibility: hidden;
  }

  .nested:hover>.dropdown-menu,
  .nested>.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }

  .nested-level-2>.dropdown-menu {
    transform: translateX(-10px);
    opacity: 0;
    visibility: hidden;
  }

  .nested-level-2:hover>.dropdown-menu,
  .nested-level-2>.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }

  .nested-level-2.flip-horizontal>.dropdown-menu {
    transform: translateX(10px);
  }

  .nested-level-2.flip-horizontal:hover>.dropdown-menu,
  .nested-level-2.flip-horizontal>.dropdown-menu.show {
    transform: translateX(0);
  }
}

/* ============================
   BUSCADOR
   ============================ */

.search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1;
  max-width: 500px;
  margin: 0 auto;
}

.search-toggle-btn {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #dee2e6;
  font-size: 18px;
  width: 44px;
  height: 44px;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-toggle-btn:hover {
  background: #007bff;
  color: white;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #dee2e6;
  border-left: none;
  border-right: none;
  outline: none;
  font-size: 15px;
}

.search-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.search-submit-btn {
  background: #007bff;
  color: white;
  border: 1px solid #007bff;
  font-size: 16px;
  width: 44px;
  height: 44px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-submit-btn:hover {
  background: #0056b3;
  border-color: #0056b3;
}

/* ============================
   RESULTADOS DEL BUSCADOR
   ============================ */

.search-results-list {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: white;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  z-index: 2000;
  opacity: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-results-list.elemento-visible {
  max-height: 350px;
  opacity: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.elemento-de-busqueda {
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.2s ease;
}

.elemento-de-busqueda:last-child {
  border-bottom: none;
}

.elemento-de-busqueda.activo {
  background-color: #007bff;
}

.elemento-de-busqueda.activo .boton-navegador {
  color: white;
}

.boton-navegador {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  width: 100%;
}

.boton-navegador:hover,
.boton-navegador:focus {
  background-color: #f8f9fa;
  color: #007bff;
  transform: translateX(5px);
}

.filtro {
  display: none;
}

.no-results {
  display: none;
  color: #999;
  padding: 10px;
  text-align: center;
}

.search-loading {
  display: none;
  color: #666;
  font-style: italic;
  padding: 10px 16px;
}

/* ============================
   CORRECCIÓN DE CONTRASTE BARRA DE BÚSQUEDA - MODO OSCURO
   ============================ */

/* SOLUCIÓN PROBLEMA 1: Botones anidados en menú de búsqueda */
[data-bs-theme="oscuro"] .search-results-list {
  background: var(--bg-elev-1);
  border-color: var(--surface-border);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
}

[data-bs-theme="oscuro"] .elemento-de-busqueda {
  border-bottom-color: var(--surface-border);
}

[data-bs-theme="oscuro"] .boton-navegador {
  color: var(--text-primary);
  background: transparent;
  font-weight: 500;
}

[data-bs-theme="oscuro"] .boton-navegador:hover,
[data-bs-theme="oscuro"] .boton-navegador:focus {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  outline: 2px solid var(--focus-outline);
  outline-offset: -2px;
}

[data-bs-theme="oscuro"] .elemento-de-busqueda.activo {
  background-color: var(--hover-bg);
  border-left: 4px solid var(--accent-blue);
}

[data-bs-theme="oscuro"] .elemento-de-busqueda.activo .boton-navegador {
  color: var(--accent-blue);
  font-weight: 600;
}

/* SOLUCIÓN PROBLEMA 2: Contraste general de la barra de búsqueda */
[data-bs-theme="oscuro"] .search-container {
  background: transparent;
}

[data-bs-theme="oscuro"] .search-toggle-btn {
  background: var(--btn-bg);
  color: var(--text-primary);
  border-color: var(--surface-border);
}

[data-bs-theme="oscuro"] .search-toggle-btn:hover,
[data-bs-theme="oscuro"] .search-toggle-btn[aria-expanded="true"] {
  background: var(--accent-blue);
  color: #0F172A;
  border-color: var(--accent-blue);
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

[data-bs-theme="oscuro"] .search-input {
  background: var(--input-bg);
  color: var(--text-primary);
  border-color: var(--surface-border);
  font-weight: 500;
}

[data-bs-theme="oscuro"] .search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

[data-bs-theme="oscuro"] .search-input:focus {
  border-color: var(--accent-blue);
  outline: 3px solid var(--focus-outline);
  outline-offset: -3px;
  background: var(--bg-elev-1);
}

[data-bs-theme="oscuro"] .search-submit-btn {
  background: var(--accent-blue);
  color: #0F172A;
  border-color: var(--accent-blue);
  font-weight: 600;
}

[data-bs-theme="oscuro"] .search-submit-btn:hover {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

/* Mejoraría para el texto "no results" */
[data-bs-theme="oscuro"] .no-results {
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 8px;
  font-weight: 500;
}

/* ============================
   DROPDOWN MENUS - MODO OSCURO
   ============================ */

/* Menús desplegables principales en modo oscuro */
[data-bs-theme="oscuro"] .dropdown-menu {
  background: var(--bg-elev-1);
  border-color: var(--surface-border);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.7);
}

/* Items de menú en modo oscuro */
[data-bs-theme="oscuro"] .dropdown-menu li a,
[data-bs-theme="oscuro"] .dropdown-menu li button {
  color: var(--text-primary);
  font-weight: 500;
}

[data-bs-theme="oscuro"] .dropdown-menu li a:hover,
[data-bs-theme="oscuro"] .dropdown-menu li a:focus,
[data-bs-theme="oscuro"] .dropdown-menu li button:hover,
[data-bs-theme="oscuro"] .dropdown-menu li button:focus {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  outline: 2px solid var(--focus-outline);
  outline-offset: -2px;
}

/* Menús anidados en modo oscuro */
[data-bs-theme="oscuro"] .nested-menu {
  background: var(--bg-secondary);
  border-color: var(--surface-border);
}

[data-bs-theme="oscuro"] .nested-menu-level-2 {
  background: var(--bg-secondary);
  border-color: var(--surface-border);
}

/* Enlaces directos (áreas educativas, CTT) en modo oscuro */
[data-bs-theme="oscuro"] .dropdown-menu li a[href^="./area-educativa"]:before,
[data-bs-theme="oscuro"] .dropdown-menu li a[href^="./curso-ctt"]:before {
  color: var(--accent-blue);
}

/* "Todos los cursos" en dropdown en modo oscuro */
[data-bs-theme="oscuro"] .dropdown-menu>li>a[href="./cursos.html"] {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(147, 197, 253, 0.1));
  color: var(--accent-blue);
  border-top-color: var(--surface-border);
}

[data-bs-theme="oscuro"] .dropdown-menu>li>a[href="./cursos.html"]:hover {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-hover));
  color: #0F172A;
}

/* ============================
   ESTADOS ESPECIALES
   ============================ */

.menu-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.nav-buttons.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================
   ANIMACIONES
   ============================ */

.nav-buttons.show li {
  animation: fadeInUp 0.3s ease forwards;
  opacity: 0;
}

.nav-buttons.show li:nth-child(1) {
  animation-delay: 0.1s;
}

.nav-buttons.show li:nth-child(2) {
  animation-delay: 0.15s;
}

.nav-buttons.show li:nth-child(3) {
  animation-delay: 0.2s;
}

.nav-buttons.show li:nth-child(4) {
  animation-delay: 0.25s;
}

.nav-buttons.show li:nth-child(5) {
  animation-delay: 0.3s;
}

.nav-buttons.show li:nth-child(6) {
  animation-delay: 0.35s;
}

.nav-buttons.show li:nth-child(7) {
  animation-delay: 0.4s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================
   MEJORAS DE ACCESIBILIDAD
   ============================ */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus styles mejorados */
.nav-buttons a:focus,
.nav-buttons button:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.dropdown-menu li:focus-within>a,
.dropdown-menu li:focus-within>button {
  background-color: #007bff;
  color: white;
  outline: 2px solid #0056b3;
  outline-offset: -2px;
}

/* Z-index management para múltiples niveles */
.dropdown-menu {
  z-index: 1000;
}

.nested-menu {
  z-index: 1001;
}

.nested-menu-level-2 {
  z-index: 1002;
}

/* Estilos para el menú hamburguesa en móvil */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .nav-buttons {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 999;
  }

  .nav-buttons.show {
    max-height: 70vh;
    opacity: 1;
    overflow-y: auto;
  }

  .nav-buttons li {
    width: 100%;
    margin: 2px 0;
  }

  .nav-buttons a,
  .nav-buttons button {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
  }

  /* Ajustes para la barra de búsqueda en móvil */
  .search-container {
    margin-top: 15px;
  }
}

/* Mejorar la visibilidad del texto en móvil */
@media (max-width: 480px) {

  .dropdown-menu li a,
  .dropdown-menu li button {
    font-size: 13px;
    padding: 8px 12px;
  }

  .search-input {
    font-size: 14px;
  }

  .logo {
    width: 150px;
    max-height: 60px;
  }

  /* Ajustes específicos para menús de áreas educativas Y terciario en pantallas pequeñas */
  .nested>.dropdown-menu#submenu-areas-educativas.show,
  .nested>.dropdown-menu#submenu-terciario.show {
    max-height: 200px;
  }
}

/* ============================
   ESTILOS ESPECÍFICOS PARA "TODOS LOS CURSOS" - MODO OSCURO
   ============================ */

/* Modo oscuro - "Todos los cursos" */
[data-bs-theme="oscuro"] .nav-buttons li a[href="./cursos.html"] {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-hover)) !important;
  color: #0F172A !important;
  border: 3px solid var(--accent-blue) !important;
  font-weight: 700 !important;
  text-shadow: none !important;
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.5) !important;
  transition: all 0.3s ease !important;
  position: relative !important;
}

[data-bs-theme="oscuro"] .nav-buttons li a[href="./cursos.html"]:hover,
[data-bs-theme="oscuro"] .nav-buttons li a[href="./cursos.html"]:focus {
  background: linear-gradient(135deg, var(--accent-yellow), var(--accent-yellow-hover)) !important;
  color: #0F172A !important;
  border-color: var(--accent-yellow) !important;
  outline: 3px solid var(--focus-outline) !important;
  outline-offset: 2px !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(252, 211, 77, 0.6) !important;
}