/* ===== HEADER COMPARTIDO ===== */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 24px; background: #f0f0f0; border-bottom: 1px solid #ddd;
  position: sticky; top: 0; z-index: 200; box-shadow: 0 8px 18px rgba(0,0,0,.09);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: #f0f0f0; border: 2px solid #b0b0b0;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logo-circle img { width: 100%; height: 100%; object-fit: cover; }
.brand-text {
  font-family: 'Montserrat', sans-serif; font-size: 11px;
  font-weight: 800; color: #111; text-transform: uppercase; line-height: 1.5;
}

/* NAV */
nav { display: flex; align-items: center; gap: 6px; }
nav a {
  font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-decoration: none; padding: 7px 16px;
  border-radius: 5px; border: 1.5px solid #555; color: #333; transition: background .15s, color .15s;
}
nav a:hover { background: #333; color: #fff; }
nav a.nav-rojo { background: #c0392b; color: #fff; border-color: #c0392b; }
nav a.nav-rojo:hover { background: #a93226; }
nav a.activo { background: #333; color: #fff; }

/* DROPDOWN */
.nav-dropdown { position: relative; }
.nav-dropdown > a { display: flex; align-items: center; gap: 5px; }
.nav-dropdown > a::after { content: '▾'; font-size: 10px; }

.dropdown-menu {
  display: none; position: absolute; top: calc(80% + 7px); left: 0;
  background: #fff; border: 1px solid #ddd; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.13); min-width: 220px; z-index: 300;
  overflow: visible; animation: fadeDown .18s ease;
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nav-dropdown:hover .dropdown-menu { display: block; }

.dropdown-menu a {
  display: block; padding: 10px 18px;
  font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600;
  color: #222; text-decoration: none; border: none; border-radius: 0;
  border-bottom: 1px solid #f0f0f0; letter-spacing: .3px;
  transition: background .15s, color .15s;
}
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: #1a3a5c; color: #fff; }
.dropdown-menu a.externo:hover { background: #c0392b; color: #fff; }

/* SUBMENÚ */
.dropdown-submenu { position: relative; }
.dropdown-submenu > a { display: flex; align-items: center; justify-content: space-between; }
.dropdown-submenu > a::after { content: '›'; font-size: 16px; font-weight: 700; margin-left: 15px; }

.submenu-menu {
  display: none; position: absolute; top: 0; left: 100%; min-width: 230px;
  background: #fff; border: 1px solid #ddd; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.13); overflow: hidden; z-index: 400;
  animation: fadeRight .18s ease;
}
@keyframes fadeRight {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.dropdown-submenu:hover .submenu-menu { display: block; }

.submenu-menu a {
  display: block; padding: 10px 18px;
  font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600;
  color: #222; text-decoration: none; border: none;
  border-bottom: 1px solid #f0f0f0; border-radius: 0; letter-spacing: .3px;
  transition: background .15s, color .15s;
}
.submenu-menu a:last-child { border-bottom: none; }
.submenu-menu a:hover { background: #1a3a5c; color: #fff; }

/* Pantallas pequeñas: el menú baja debajo del logo en vez de desbordar la página */
@media (max-width: 900px) {
  header { flex-wrap: wrap; gap: 10px; padding: 8px 14px; }
  .brand-text { font-size: 12px !important; }
  nav { flex-wrap: wrap; width: 100%; gap: 6px; }
  nav a { padding: 7px 12px; }
  .dropdown-menu { min-width: 200px; }
  .submenu-menu { left: 0; top: 100%; }
}
