/* 🎓 Header institucional con franja roja superior */
.franja-azul {
  background: linear-gradient(90deg, #001f54, #003f88);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  font-family: 'Inter', sans-serif;
  position: sticky;          /* clave: que se comporte como topbar */
  top: 0;
  z-index: 1000;
  padding-bottom: 0;         /* evita “caja” extra que se ve cortada */
}

/* 🔴 Franja roja superior */
.franja-azul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: #e63946;
}

/* 🔹 Topbar (tipo Panel) */
.topbar {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between; /* antes center: esto era parte del problema */
  gap: 12px;
  padding: 14px 16px;
  position: relative;
}

/* 🛡️ Logo */
.logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(255,255,255,0.10);
  padding: 5px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.logo:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(255,255,255,0.4);
}

/* 🏫 Nombre de la escuela (una línea, sin cortar feo) */
.topbar h1 {
  margin: 0;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  line-height: 1.15;

  min-width: 0;               /* CLAVE para ellipsis dentro de flex */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  text-align: left;           /* ya no centrado */
  text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}

/* ☰ Botón del menú */
.menu-toggle {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: inline-flex;       /* siempre visible en móvil, oculto en desktop por media query */
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: transform 0.3s ease, background .2s ease;
}
.menu-toggle:hover {
  transform: scale(1.06);
  background: rgba(255,255,255,.16);
}

/* 🔗 Menú principal (desktop) */
nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 12px;
  text-align: center;
  position: relative;
  z-index: 1500;
}

.nav-list {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0;
  margin: 0;
}

.nav-list li a {
  display: inline-block;
  background: #2e66b6;
  color: #fff;
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: background 0.3s, transform 0.2s;
}
.nav-list li a:hover {
  background: #5584d6;
  transform: translateY(-2px);
}
.nav-list a.active {
  background: #e63946;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

/* ✅ Desktop: oculta botón hamburguesa y deja menú horizontal */
@media (min-width: 861px) {
  .menu-toggle { display: none; }
}

/* 📱 MÓVIL: menú flotante tipo Panel Alumno */
@media (max-width: 860px) {

  /* Ajustes finos para que no “corte” */
  .topbar {
    padding: 12px 14px;
  }
  .logo {
    width: 40px;
    height: 40px;
  }
  .topbar h1 {
    font-size: 18px;
  }

  /* En móvil, NO mostramos el nav horizontal abajo */
  nav {
    padding: 0;              /* evita espacio extra debajo del header */
  }

  /* Menú como tarjeta flotante a la derecha */
  .nav-list {
    position: fixed;
    top: 70px;               /* cae debajo del topbar */
    right: 14px;
    width: min(360px, 92vw);
    background: rgba(0, 43, 122, 0.97);
    border-radius: 16px;
    padding: 10px;
    margin: 0;

    display: none;           /* cerrado */
    flex-direction: column;
    align-items: stretch;
    gap: 8px;

    box-shadow: 0 18px 45px rgba(0,0,0,.35);
    z-index: 1100;
  }

  .nav-list.open {
    display: flex;           /* abierto */
    animation: slideDown 0.18s ease-out forwards;
  }

  .nav-list li { width: 100%; }

  .nav-list li a {
    display: block;
    width: 100%;
    text-align: left;        /* como panel alumno */
    border-radius: 12px;
    padding: 14px 14px;
    font-size: 18px;
    background: rgba(255,255,255,.10);
    box-shadow: none;        /* limpio en móvil */
  }

  .nav-list li a:hover {
    background: rgba(255,255,255,.16);
    transform: none;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* Backdrop (si lo agregaste en HTML) */
.menu-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 1050;
}
.menu-backdrop.open{
  opacity: 1;
  pointer-events: auto;
}
/* ===== Desktop: título perfectamente centrado ===== */
@media (min-width: 861px) {

  .topbar{
    display: grid;
    grid-template-columns: 64px 1fr 64px; /* izq (logo) | centro (titulo) | der (espacio espejo) */
    align-items: center;
    justify-items: center;
  }

  .topbar .logo{
    justify-self: start;
  }

  .topbar h1{
    justify-self: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 900px; /* evita que se “coma” el layout si es muy largo */
  }

  /* Como en desktop ocultas el botón, dejamos un “fantasma” para balancear el centro */
  .topbar::after{
    content: "";
    width: 44px;
    height: 44px;
    justify-self: end;
  }
}
@media (min-width: 861px){
  .topbar .logo{ width: 52px; height: 52px; }
  .topbar::after{ width: 52px; height: 52px; } /* iguala el espejo */
}
