/* ===========================
   HEADER BASE (desktop)
   =========================== */

.site-header {
  width: 100%;
  background-color: #fff;
  color: #001f5f;
  font-family: Arial, sans-serif;
}

/* Barra azul superior */
.top-bar {
  background-color: #002060;
  color: #ffffff;
  font-size: 0.9rem;
}

.top-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 12px;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.top-bar-inner i {
  margin-right: 6px;
}

/* Barra blanca de navegación */
.main-nav {
  background-color: #ffffff;
  border-bottom: 4px solid #000000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 15px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  row-gap: 0.5rem;
  flex-wrap: nowrap;
}

/* Logo + nombre */
.nav-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.nav-left .logo img {
  height: 36px;
  display: block;
}

.brand-name {
  color: #001a5e;
  font-weight: bold;
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}

/* Menú principal (desktop) */
.menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 25px;
  margin: 0;
  padding: 0;
}

.menu > li {
  position: relative;
}

.menu > li > a {
  text-decoration: none;
  font-weight: bold;
  color: #002060;
  padding: 10px 8px;
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

/* Submenú desktop */
.has-submenu {
  position: relative;
}

.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;

  background-color: #ffffff;
  min-width: 220px;
  box-shadow: 0 4px 8px rgba(0,0,0,.2);
  border: 1px solid #ccc;
  padding: 0;
  z-index: 999;
}

.submenu li {
  list-style: none;
}

.submenu li a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  color: #002060;
  font-weight: normal;
  font-size: .95rem;
}

.submenu li a:hover {
  background-color: #f0f0f0;
}

/* hover desktop */
.has-submenu:hover > .submenu {
  display: block;
}

/* caret */
.submenu-caret {
  font-size: 0.7em;
  margin-left: 4px;
}

/* Botón hamburguesa (desktop = oculto) */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px 10px;
}

.nav-toggle-bar {
  display: block;
  width: 28px;
  height: 3px;
  background-color: #002060;
  border-radius: 2px;
  margin: 5px 0;
}


/* ===========================
   MOBILE
   =========================== */
@media (max-width: 768px) {

  /* Barra azul superior: apilar info y hacer fuente más pequeña */
  .top-bar-inner {
    flex-direction: column;
    gap: 4px;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  /* navbar layout en columna */
  .nav-container {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  /* bloque logo */
  .nav-left {
    order: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: .5rem;
  }

  /* botón hamburguesa visible en móvil */
  .nav-toggle {
    order: 1;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-left: auto;
    background: transparent;
  }

  /* menú general se convierte en columna y arranca oculto */
  .menu {
    order: 2;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;

    background-color: #ffffff;
    border-top: 1px solid #ccc;

    display: none !important; /* <--- escondido por defecto */
  }

  /* menú abierto: el script .classList.toggle('menu-open') lo activa */
  .menu.menu-open {
    display: flex !important;
  }

  .menu > li {
    width: 100%;
    border-bottom: 1px solid #eee;
  }

  .menu > li > a {
    width: 100%;
    padding: 14px 12px;
    display: block;
    font-size: 1rem;
    color: #002060;
    text-decoration: none;
  }

  /* Submenú en móvil: lo dejamos SIEMPRE visible debajo de "Gestiones"
     (simple, sin hover flotante) */
  .has-submenu {
    position: static;
    width: 100%;
  }

  .has-submenu > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .submenu {
    position: static;
    box-shadow: none;
    border: 0;
    border-top: 1px solid #ddd;
    width: 100%;
    padding: 0;
    display: block;
  }

  .submenu li a {
    padding: 12px 20px;
    font-size: .95rem;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
    color: #002060;
    text-decoration: none;
  }

  .submenu li a:hover {
    background-color: #efefef;
  }
}
