/* ============================================================
   HEADER APASCAR — Diseño Moderno & Responsivo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables ──────────────────────────────────────────── */
:root {
  --header-bg-start:  #0369a1;   /* azul profundo */
  --header-bg-end:    #0ea5e9;   /* azul cielo     */
  --header-height:    68px;
  --nav-font:         'Inter', Verdana, sans-serif;
  --text-light:       #ffffff;
  --accent:           #38bdf8;
  --shadow:           0 4px 24px rgba(3, 105, 161, 0.35);
  --radius-sm:        6px;
  --transition:       0.25s ease;
}

/* ── Reset parcial del header ───────────────────────────── */
header, header nav, header ul, header li, header span,
header input, header label {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--nav-font);
  border: none;
  outline: none;
}

/* ── Header principal ───────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1.5rem;
  background: linear-gradient(135deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
  box-shadow: var(--shadow);
  gap: 1rem;
}

/* ── Logo ───────────────────────────────────────────────── */
.logo-container {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.6rem;
}

.logo {
  height: 46px;
  width: auto;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  object-fit: cover;
  transition: transform var(--transition), box-shadow var(--transition);
}

.logo:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.25);
}

/* Nombre de la organización junto al logo (opcional) */
.logo-container .brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ── Checkbox oculto (toggle) ───────────────────────────── */
.menu-toggle {
  display: none;
}

/* ── Botón hamburguesa (móvil) ──────────────────────────── */
.menu-label {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.menu-label:hover {
  background: rgba(255,255,255,0.30);
}

/* Las tres líneas del hamburger */
.menu-label::before,
.menu-label::after {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-light);
  border-radius: 2px;
  transition: transform 0.35s ease, opacity 0.25s ease;
}

.menu-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-light);
  border-radius: 2px;
  transition: transform 0.35s ease, opacity 0.25s ease;
}

/* ── Navbar contenedor ──────────────────────────────────── */
.navbar {
  flex-grow: 1;
  display: flex;
  justify-content: flex-end;
}

.navbar-container {
  list-style: none;
  display: flex;
  align-items: stretch;
  gap: 0.1rem;
}

/* ── Item de navegación ─────────────────────────────────── */
.navbar-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: var(--header-height);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: background var(--transition);
  user-select: none;
  text-transform: uppercase;
}

/* Indicador inferior al hover */
.navbar-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  transition: transform 0.3s ease;
}

.navbar-item:hover::after,
.navbar-item:focus-within::after {
  transform: translateX(-50%) scaleX(1);
}

.navbar-item:hover,
.navbar-item:focus-within {
  background: rgba(255,255,255,0.12);
}

/* Ocultar el span .navbar-item_label que ya no necesitamos */
.navbar-item_label {
  display: none;
}

/* ── Submenú desplegable ────────────────────────────────── */
.navbar-container_sub {
  list-style: none;
  position: absolute;
  top: calc(var(--header-height) - 4px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 8px 32px rgba(3,105,161,0.18);
  padding: 0.4rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 10000;
}

.navbar-item:hover > .navbar-container_sub,
.navbar-item:focus-within > .navbar-container_sub {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ── Item del submenú ───────────────────────────────────── */
.navbar-item_sub {
  padding: 0.65rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #0369a1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), padding-left 0.2s ease;
  white-space: nowrap;
}

.navbar-item_sub:hover {
  background: #e0f2fe;
  color: #0284c7;
  padding-left: 1.5rem;
}

/* ============================================================
   RESPONSIVE — MÓVIL (≤ 768 px)
   ============================================================ */
@media (max-width: 768px) {

  header {
    flex-wrap: wrap;
    height: auto;
    padding: 0.6rem 1rem;
    position: sticky;
    top: 0;
  }

  /* Mostrar botón hamburguesa */
  .menu-label {
    display: flex;
  }

  /* Logo ocupa el espacio restante a la izquierda */
  .logo-container {
    flex: 1;
  }

  .logo {
    height: 40px;
  }

  /* Nav se despliega en ancho completo debajo del logo/hamburguesa */
  .navbar {
    width: 100%;
    order: 3;              /* aparece debajo */
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease;
  }

  /* Cuando el checkbox está marcado, desplegamos el menú */
  .menu-toggle:checked ~ .navbar {
    max-height: 800px;    /* suficiente para todos los items */
  }

  /* Animación de las líneas hamburguesa → X cuando está abierto */
  .menu-toggle:checked ~ .menu-label {
    background: rgba(255,255,255,0.28);
  }

  .navbar-container {
    flex-direction: column;
    gap: 0;
    background: rgba(2, 60, 100, 0.97);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 0.4rem 0;
    width: 100%;
  }

  .navbar-item {
    height: auto;
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    justify-content: space-between;
    text-transform: uppercase;
  }

  /* Quitar indicador inferior en móvil */
  .navbar-item::after {
    display: none;
  }

  /* Submenú en móvil: flujo normal (no absolute) */
  .navbar-container_sub {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(255,255,255,0.07);
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    display: block;
    transition: max-height 0.3s ease;
  }

  /* Mostrar submenú al hacer hover/focus en móvil */
  .navbar-item:hover > .navbar-container_sub,
  .navbar-item:focus-within > .navbar-container_sub {
    max-height: 300px;
    padding: 0.3rem 0;
  }

  .navbar-item_sub {
    color: #bae6fd;
    padding: 0.6rem 2rem;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: normal;
  }

  .navbar-item_sub:hover {
    background: rgba(255,255,255,0.10);
    color: #fff;
    padding-left: 2.4rem;
  }
}

/* ── Extra pequeño (≤ 480 px) ───────────────────────────── */
@media (max-width: 480px) {
  header {
    padding: 0.5rem 0.75rem;
  }

  .logo {
    height: 36px;
  }

  .navbar-item {
    font-size: 0.82rem;
    padding: 0.75rem 1rem;
  }
}
