/* Header y Navegación */
header {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0.8) 100%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 194, 194, 0.2);
  padding: 0;
  position: fixed;
  top: 15px;
  left: 1.5%;
  right: 1.5%;
  width: 97%;
  z-index: 1000;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  position: relative;
  z-index: 1002;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-container img {
  height: 60px;
  width: auto;
  filter: brightness(1.1);
  transition: transform 0.3s ease;
}
.logo-container img:hover {
  transform: scale(1.05);
}

.logo-text {
  display: flex;
  flex-direction: column;
  color: #000000;
}
.logo-text .main-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 0;
}
.logo-text .subtitle {
  font-size: 0.85rem;
  font-weight: 300;
  color: #414141;
  margin: 0;
}

/* Navegación de Escritorio */
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
nav ul li {
  position: relative;
}
nav ul li a {
  color: #000000;
  text-decoration: none;
  padding: 0.8rem 1.2rem;
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
nav ul li a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #4a9eff, #7cb8ff);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}
nav ul li a:hover::before {
  width: 80%;
}
nav ul li a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}
nav ul li a.active {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

/* Botón de Certificados */
@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
nav ul li a.btn-certificados {
  background: linear-gradient(90deg, #00bcd4, #8bc34a, #00bcd4, #8bc34a);
  background-size: 200% auto;
  animation: gradientFlow 4s ease-in-out infinite;
  padding: 0.8rem 1.5rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(0, 188, 212, 0.4);
  transition: all 0.3s ease;
}
nav ul li a.btn-certificados:hover {
  animation-duration: 2s;
  box-shadow: 0 8px 30px rgba(139, 195, 74, 0.5);
  transform: translateY(-2px);
}

/* Botón de Menú Móvil (Hamburguesa) */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1003;
}
.menu-toggle span {
  width: 28px;
  height: 3px;
  background: #000000;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ========================================================== */
/* --- SECCIÓN RESPONSIVE MEJORADA (LA SOLUCIÓN) --- */
/* ========================================================== */

@media (max-width: 1024px) {
  /* Ajustes para tablets */
  .header-container {
    padding: 1rem;
  }
  nav ul {
    gap: 0.3rem;
  }
  nav ul li a {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  /* --- Muestra el botón de hamburguesa --- */
  .menu-toggle {
    display: flex;
  }

  /* --- Animación "X" para el botón activo --- */
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
  }
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  /* --- El Contenedor <nav> (Pantalla Completa) --- */
  nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    z-index: 1001;

    background: rgba(30, 58, 95, 0.9); /* Fondo oscuro semitransparente */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Oculto por defecto */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
  }

  /* --- Estado Activo (Cuando se hace clic) --- */
  nav.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
  }

  /* --- La lista <ul> (Ahora centrada) --- */
  nav ul {
    background: none;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  nav ul li {
    width: 100%;
    text-align: center;
  }

  /* --- Los enlaces <a> (Ahora visibles) --- */
  nav ul li a {
    padding: 1rem;
    border-radius: 8px;
    color: #ffffff; /* Texto blanco */
    font-size: 1.5rem;
    font-weight: 600;
  }
  nav ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(0);
  }
  nav ul li a::before {
    display: none;
  }
  nav ul li a.active {
    background: rgba(74, 158, 255, 0.3);
    box-shadow: none;
  }

  nav ul li a.btn-certificados {
    font-size: 1.5rem;
    animation: none;
  }
  nav ul li a.btn-certificados:hover {
    transform: translateY(0);
    box-shadow: 0 5px 20px rgba(0, 188, 212, 0.4);
  }

  /* Ajustes del Logo */
  .logo-text .main-title {
    font-size: 1.2rem;
  }
  .logo-text .subtitle {
    font-size: 0.75rem;
  }
  .logo-container img {
    height: 45px;
  }
}

/* Animación de entrada del header */
@keyframes fadeInWithBlur {
  from {
    opacity: 0;
    filter: blur(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}
