/* ==========================================================================
   ESTILOS BASE: MÓVIL (Por defecto)
   ========================================================================== */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  height: 65px;
  z-index: 999;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  z-index: 1010;
}

.logo span.azul {
  color: var(--brand);
}

.logo-icon,
.logo-dorado {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* PANEL DEL MENÚ DESPLEGABLE (CORTINA MÓVIL) */
.menu {
  position: fixed;
  top: 0;
  right: -100%; /* Escondido a la derecha */
  width: 280px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 60px 24px 24px 24px;
  gap: 12px;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s; /* Delay para la transición del scroll */
  z-index: 1020;
  overflow-y: auto;
}

/* Cuando el menú móvil es el target de la URL, se muestra */
.menu:target {
  right: 0;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Sin delay al abrir */
}

.menu a {
  text-decoration: none;
  color: #334155;
  font-size: 15px;
  font-weight: 500;
  width: 100%;
  padding: 10px 0;
  transition: color 0.2s;
}

.btn-login {
  border: 1px solid var(--brand);
  padding: 10px 16px;
  border-radius: 6px;
  color: var(--brand);
  text-align: center;
  font-weight: 600;
  width: 100%;
  margin-top: 15px;
  display: inline-block;
}

/* BOTONES HAMBURGUESA */
.menu-burger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  z-index: 1030;
}

.menu-burger span {
  width: 25px;
  height: 3px;
  background-color: var(--brand-dark);
  border-radius: 3px;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

/* Control alternado de botones mediante :has() */
.burger-close {
  display: none;
}

.navbar:has(#menu-movil:target) .burger-open {
  display: none;
}

.navbar:has(#menu-movil:target) .burger-close {
  display: flex;
}

/* Transformación de líneas a cruz (X) en el botón de cerrar */
.burger-close span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.burger-close span:nth-child(2) {
  opacity: 0;
}
.burger-close span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   VISTA DE ESCRITORIO: A partir de 768px
   ========================================================================== */

@media (min-width: 768px) {
  .navbar {
    padding: 16px 40px;
    background: rgba(255, 255, 255, 0.95);
    height: auto;
  }

  .logo {
    font-size: 20px;
    gap: 10px;
  }

  /* Ocultamos los botones de hamburguesa por completo */
  .menu-burger {
    display: none !important;
  }

  /* El menú pasa de ser una cortina lateral a una barra horizontal estable */
  .menu {
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    box-shadow: none;
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 0;
    overflow-y: visible;
  }

  .menu a {
    color: var(--text-muted);
    font-size: 14px;
    margin-left: 24px;
    width: auto;
    padding: 0;
  }

  .menu a:hover {
    color: #374559;
  }

  .menu .btn-login {
    border: 1px solid #e2e8f0;
    padding: 6px 20px !important; /* El !important o la especificidad extra le devuelven el aire al botón */
    border-radius: 20px;
    color: var(--text-primary);
    width: auto;
    margin-top: 0;
    display: inline-block;
  }
}
