/* ─── HEADER ──────────────────────────────────────────────────────────────── */
.site-header {
  background: #0a1723;
  border-top: 4px solid #c5a059;
  border-bottom: 1px solid rgba(197,160,89,0.3);
  box-shadow: 0 10px 30px -5px rgba(0,0,0,0.3), 0 5px 15px -8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  max-width: 100%;
  padding: 12px 30px 12px 30px; /* padding-right asegura que nada se pegue al borde */
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  position: relative;
  z-index: 1001;
}

/* ─── IZQUIERDA ───────────────────────────────────────────────────────────── */
.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0;
}

/* Logo UNAM */
.header-logo-unam img {
  width: 120px;
  height: auto;
  transition: all 0.3s ease;
  filter: brightness(1) drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.header-logo-unam img:hover {
  transform: scale(1.02);
  filter: brightness(1.05) drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

/* Separador entre logos */
.header-logo-separator {
  width: 1px;
  height: 40px;
  background: rgba(197,160,89,0.3);
  margin: 0 14px;
  flex-shrink: 0;
}

/* Logo FCA - CORREGIDO */
.header-logo-fca img {
  width: auto;
  height: 100px; /* Controlamos la altura en lugar del ancho */
  max-width: 100px; /* Límite máximo por si acaso */
  transition: all 0.3s ease;
  filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.header-logo-fca img:hover {
  transform: scale(1.05);
}

/* Título */
.header-title {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 2px solid rgba(197,160,89,0.3);
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}
.header-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 1px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  color: #ecf0f1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title .periodo {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.5px;
  color: #c5a059;
  margin-top: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}
.header-title .periodo i {
  margin-right: 5px;
  font-size: 11px;
}

/* ─── NAV ─────────────────────────────────────────────────────────────────── */
.navbar {
  flex: 1 1 auto;
  min-width: 0;
}

.navbar-nav {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  padding-right: 8px; /* evita que los links se peguen al borde derecho */
  flex-wrap: nowrap;
}

.navbar-nav .nav-link {
  color: #ecf0f1 !important;
  font-weight: 400;
  font-size: 13px;
  padding: 6px 8px !important;
  margin: 0 2px;
  position: relative;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.navbar-nav .nav-link:hover { color: #c5a059 !important; }

/* Subrayado animado */
.navbar-nav .nav-link::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: #c5a059;
  transition: width 0.3s ease;
}
.navbar-nav .nav-link:hover::before,
.navbar-nav .nav-link.active::before { width: 100%; }

/* Flecha dropdown */
.navbar-nav .nav-link.dropdown-toggle::after {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  content: "";
  border-top: 3px solid;
  border-right: 3px solid transparent;
  border-bottom: 0;
  border-left: 3px solid transparent;
  color: #c5a059;
  transition: transform 0.3s ease;
}
.nav-item.dropdown:hover .dropdown-toggle::after { transform: rotate(180deg); }

/* ─── DROPDOWN (desktop hover) ───────────────────────────────────────────── */
.nav-item.dropdown {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: -8px;
}
/* Puente invisible para mantener hover al moverse hacia el menú */
.nav-item.dropdown::after {
  content: '';
  position: absolute;
  bottom: -8px; left: 0;
  width: 100%; height: 8px;
  background: transparent;
}

.nav-item.dropdown .dropdown-menu {
  background: #2c3e50;
  border: 1px solid rgba(197,160,89,0.2);
  border-radius: 4px;
  margin-top: 4px;
  padding: 6px 0;
  display: block;
  visibility: hidden;
  opacity: 0;
  box-shadow: 0 10px 20px -8px rgba(0,0,0,0.3);
  min-width: 180px;
  transition: visibility 0.2s, opacity 0.2s ease;
  pointer-events: none;
  position: absolute;
  top: 100%; left: 0;
  z-index: 1002;
}
.nav-item.dropdown:hover .dropdown-menu,
.nav-item.dropdown .dropdown-menu:hover {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.1s;
}

.nav-item.dropdown .dropdown-item {
  color: #ecf0f1;
  font-weight: 300;
  padding: 6px 15px;
  font-size: 13px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.nav-item.dropdown .dropdown-item i {
  font-size: 12px;
  width: 16px;
  margin-right: 8px;
}
.nav-item.dropdown .dropdown-item:hover {
  background: #34495e;
  color: #c5a059;
  padding-left: 20px;
}

/* ─── BOTÓN HAMBURGUESA ───────────────────────────────────────────────────── */
.navbar-toggler {
  border: 1px solid rgba(197,160,89,0.3);
  padding: 6px 10px;
  border-radius: 4px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-left: auto; /* empuja el botón a la derecha */
}
.navbar-toggler:hover  { border-color: #c5a059; background: rgba(197,160,89,0.1); }
.navbar-toggler:focus  { box-shadow: none; outline: none; border-color: #c5a059; }
.navbar-toggler i { font-size: 18px; color: #ecf0f1; }

/* ─── TABLET (992px–1199px) ──────────────────────────────────────────────── */
@media (min-width: 992px) and (max-width: 1199px) {
  .header-inner { padding: 12px 20px; }
  .header-logo-unam img { width: 100px; }
  .header-logo-fca img  { height: 42px; } /* Ajustado proporcionalmente */
  .header-logo-separator { height: 36px; }
  .header-title { margin-left: 12px; padding-left: 12px; }
  .header-title h1 { font-size: 18px; }
  .header-title .periodo { font-size: 11px; }
  .navbar-nav .nav-link { font-size: 12px; padding: 6px 5px !important; margin: 0 1px; }
}

/* ─── GRANDE (≥1200px) ───────────────────────────────────────────────────── */
@media (min-width: 1200px) {
  .header-inner { padding: 12px 30px; }
  .navbar-nav { gap: 0.25rem; }
}

/* ─── MÓVIL (≤991px) ─────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .header-inner {
    padding: 10px 15px;
    flex-wrap: wrap; /* permite que el collapse baje */
  }

  .header-logo-unam img { width: 90px; }
  .header-logo-fca img  { height: 38px; } /* Ajustado proporcionalmente */
  .header-logo-separator { height: 32px; margin: 0 10px; }
  .header-title { margin-left: 10px; padding-left: 10px; }
  .header-title h1 { font-size: 18px; }
  .header-title .periodo { font-size: 11px; }

  /* Menú desplegable móvil */
  .navbar-collapse {
    width: 100%;
    background: #2c3e50;
    margin-top: 10px;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid rgba(197,160,89,0.2);
    box-shadow: 0 15px 30px -10px rgba(0,0,0,0.3);
  }

  .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    padding-right: 0;
    width: 100%;
  }

  .navbar-nav .nav-link {
    padding: 10px 4px !important;
    font-size: 13px;
    margin: 0;
    width: 100%;
  }

  /* Desactivar hover-dropdown en móvil; Bootstrap maneja el click */
  .nav-item.dropdown::after { display: none; }

  .nav-item.dropdown .dropdown-menu {
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: none;
    background: transparent;
    border: none;
    padding-left: 14px;
    box-shadow: none;
    transition: none;
    pointer-events: auto;
    min-width: 100%;
  }
  .nav-item.dropdown .dropdown-menu.show { display: block; }

  .nav-item.dropdown .dropdown-item {
    padding: 7px 10px;
    font-size: 12px;
    white-space: normal;
  }
  .nav-item.dropdown .dropdown-item i { font-size: 11px; width: 14px; }
}

/* ─── MUY PEQUEÑO (≤480px) ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .header-logo-unam img { width: 65px; }
  .header-logo-fca img  { height: 30px; } /* Ajustado proporcionalmente */
  .header-logo-separator { height: 26px; margin: 0 8px; }
  .header-title { margin-left: 8px; padding-left: 8px; }
  .header-title h1 { font-size: 15px; }
  .header-title .periodo { font-size: 10px; }
}