/* Header y Preheader aislados - Policaribe */
:root {
  --brand-red: #901913;
  --brand-red-dark: #6f120e;
  --brand-blue: #1e3a5f;
  --brand-blue-dark: #152a45;
  --preheader-height: 48px;
  --header-height: 90px;
  /* altura del header ajustada */
}

/* Barra superior (preheader) */
.site-preheader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9500;
  /* por encima del header */
  background: #f5f7fb;
  color: #283457;
  box-shadow: none;
  border: none;
  height: var(--preheader-height);
  display: flex;
  align-items: center;
  overflow: visible;
  /* evitar scroll interno */
}

.site-preheader .container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 3px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: visible;
}

.site-preheader a {
  color: inherit;
  text-decoration: none;
}

.site-preheader a:hover {
  text-decoration: underline;
}

.site-preheader .preheader-left,
.site-preheader .preheader-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-preheader .preheader-phone {
  font-weight: 600;
  background: #2e7d32;
  color: #fff;
  padding: 6px 12px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Header principal */
#sp-header.site-header {
  position: fixed;
  top: var(--preheader-height);
  left: 0;
  right: 0;
  z-index: 6500;
  background: #ffffff;
  border-bottom: none;
  border-top: none;
  margin-top: 0 !important;
  overflow: visible;
  /* evitar scroll interno cuando se abre el dropdown */
  margin-bottom: 0 !important;
  /* evitar banda visible entre header y contenido */
}

/* Ajuste explícito del ID para cubrir reglas menos específicas del tema */
#sp-header {
  height: var(--header-height);
  z-index: 6500 !important;
  background-color: #ffffff !important;
}

#sp-header.site-header .container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: visible;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--header-height);
}

.site-logo img {
  height: 60px;
  display: block;
}

.site-nav {
  flex: 1;
  margin: 0 20px;
  position: relative;
  z-index: 1350;
  overflow: visible;
}

.site-nav .sp-megamenu-parent {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-nav .sp-megamenu-parent>li {
  position: relative;
}

.site-nav .sp-megamenu-parent>li>a {
  color: #1e3a5f;
  text-transform: uppercase;
  font-family: Roboto, Arial, sans-serif;
  font-weight: 600;
  letter-spacing: .3px;
  font-size: 15px;
  padding: 10px 6px;
  display: inline-block;
  white-space: nowrap;
}

.site-nav .sp-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 7000;
  display: none;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin-top: 0;
  /* sin gap para evitar que se pierda el hover */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0);
  transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
}

.site-nav .sp-dropdown-inner {
  padding: 10px 12px;
}

.site-nav .sp-has-child:hover>.sp-dropdown {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(4px);
}

/* Estado abierto forzado por JS para retraso de cierre */
.site-nav .sp-dropdown.open {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(4px);
}

.site-nav .sp-megamenu-parent>li>a:hover,
.site-nav .sp-megamenu-parent>li.active>a,
.site-nav .sp-megamenu-parent>li.current-item>a {
  color: #163050;
}

.site-cta {
  display: flex;
  gap: 10px;
}

.site-cta .btn-cta {
  background: #1e3a5f;
  color: #fff;
  padding: 10px 18px;
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  transition: transform 200ms ease, box-shadow 200ms ease;
  animation: cta-breath 3.5s ease-in-out infinite;
  white-space: nowrap;
}

.site-cta .btn-cta:hover {
  opacity: 1;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.25);
}

@keyframes cta-breath {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  50% {
    transform: scale(1.03);
    box-shadow: 0 8px 22px rgba(144, 25, 19, 0.28);
  }
}

/* Hamburguesa */
#offcanvas-toggler {
  color: var(--brand-red);
  font-size: 22px;
}

#offcanvas-toggler i {
  color: inherit;
}

/* Oculta grilla Helix inferior para evitar duplicados */
#sp-header .row,
#sp-menu,
#sp-logo,
.macro-top-search {
  display: none !important;
}

/* Ocultar bloques heredados que generan un segundo header fuera del aislado */
.sp-megamenu-wrapper {
  display: none !important;
}

.searchwrapper.top-search {
  display: none !important;
}

/* Ocultar iconos de búsqueda flotantes heredados */
.search-icon.icon-search,
#search_close {
  display: none !important;
}

/* Mantener el slider por debajo del header y su dropdown */
.sppb-slider-wrapper,
.n2-section-smartslider {
  position: relative;
  z-index: 100;
}

/* Empujar el contenido hacia abajo por headers fijos */
.body-innerwrapper {
  padding-top: calc(var(--preheader-height) + var(--header-height));
}

/* Forzar fondo blanco cuando Helix aplica estado sticky "menu-fixed" */
#sp-header.menu-fixed {
  background-color: #ffffff !important;
  -webkit-transition: none;
  -o-transition: none;
  transition: none;
}

/* Altura específica para estados con slideshow/sub-image y sticky */
.has-sub-image #sp-header.menu-fixed#sp-header,
.has-sub-image #sp-header.menu-fixed#sp-header .logo,
.has-slideshow #sp-header.menu-fixed#sp-header,
.has-slideshow #sp-header.menu-fixed#sp-header .logo,
#sp-header.menu-fixed#sp-header,
#sp-header.menu-fixed#sp-header .logo {
  height: 90px !important;
}

/* Separadores en preheader */
.site-preheader .preheader-left>*:not(:last-child)::after,
.site-preheader .preheader-right>*:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 14px;
  background: rgba(0, 0, 0, 0.15);
  margin: 0 8px;
  vertical-align: middle;
}

/* Submenu al hover para "Conoce Policaribe" */
.preheader-dropdown {
  position: relative;
}

.preheader-dropdown>a {
  position: relative;
  z-index: 1;
}

.preheader-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 840px;
  max-width: calc(100vw - 40px);
  padding: 14px 16px;
  background: #ffffff;
  color: #283457;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  border-radius: 0;
  /* cuadrado */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
  z-index: 9600;
  /* sobre el preheader y header */
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.preheader-submenu a {
  display: block;
  padding: 6px 8px;
  text-decoration: none;
  color: inherit;
}

.preheader-submenu a:hover {
  background: #f5f7fb;
}

.preheader-dropdown:hover .preheader-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* Estado abierto controlado por JS para retardo de cierre */
.preheader-dropdown.open .preheader-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* Columnas y títulos dentro del submenu */
.preheader-submenu .submenu-col {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding-right: 10px;
}

.preheader-submenu .submenu-col:last-child {
  border-right: none;
}

.preheader-submenu .submenu-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: .4px;
  color: #6b748c;
  margin: 2px 0 8px;
}

.preheader-submenu .contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: inherit;
  text-decoration: none;
}

.preheader-submenu .contact-item:hover {
  background: #f5f7fb;
}

/* Botón Campus en preheader */
.preheader-campus {
  color: #ffffff !important;
  background: #1e3a5f;
  padding: 6px 12px;
  border-radius: 9999px;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: .2px;
}

.preheader-campus:hover {
  background: #163050;
  text-decoration: none;
}

/* Botón Inscripciones en preheader (amarillo, mismo estilo que Campus) */
.preheader-inscripciones {
  color: #1a1a1a !important;
  background: #ecc31f;
  /* amarillo institucional */
  padding: 6px 12px;
  border-radius: 9999px;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: .2px;
}

.preheader-inscripciones:hover {
  background: #d4aa1a;
  text-decoration: none;
}

/* Responsivo */
@media (max-width: 991px) {
  #sp-header.site-header .container {
    flex-wrap: wrap;
    gap: 10px;
  }

  .site-nav {
    width: 100%;
    order: 3;
  }

  .site-cta {
    width: 100%;
    justify-content: center;
    order: 2;
  }

  #offcanvas-toggler {
    order: 1;
  }
}

/* Vista móvil 370px-900px */
@media (max-width: 900px) {

  /* Ajustar alturas del header y preheader */
  :root {
    --preheader-height: 40px;
    --header-height: 65px;
  }

  /* Asegurar que el preheader esté fijo en la parte superior */
  .site-preheader {
    position: fixed;
    top: 0 !important;
    left: 0;
    right: 0;
    z-index: 9500;
    height: var(--preheader-height);
  }

  /* Asegurar que el header esté justo debajo del preheader */
  #sp-header.site-header {
    position: fixed !important;
    top: var(--preheader-height) !important;
    left: 0;
    right: 0;
    z-index: 6500;
    height: var(--header-height);
    margin-top: 0 !important;
  }

  /* Ajustar el padding del body */
  .body-innerwrapper {
    padding-top: calc(var(--preheader-height) + var(--header-height)) !important;
  }

  /* Ajustar el contenedor del header */
  #sp-header.site-header .container {
    padding: 6px 5px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .site-header-inner {
    min-height: auto;
    height: 100%;
    width: 100%;
  }

  /* Ajustar logo */
  .site-logo img {
    height: 38px;
  }

  /* Botón CTA compacto: solo icono + "Beca" */
  .site-cta .btn-cta {
    padding: 7px 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    min-height: 34px;
    white-space: nowrap;
  }

  /* Ocultar el texto completo y mostrar solo "Beca" */
  .site-cta .btn-cta::before {
    content: "\f19c";
    /* icono de graduación de FontAwesome */
    font-family: FontAwesome;
    font-size: 12px;
  }

  .site-cta .btn-cta {
    font-size: 0;
    /* ocultar texto original */
    white-space: nowrap;
  }

  .site-cta .btn-cta::after {
    content: "Beca";
    font-size: 12px;
    font-weight: 600;
  }

  /* Ajustar preheader en móvil */
  .site-preheader .container {
    padding: 6px 15px;
    height: 100%;
  }

  .site-preheader .preheader-left,
  .site-preheader .preheader-right {
    gap: 6px;
  }

  /* Hacer los botones del preheader más pequeños */
  .preheader-campus,
  .preheader-inscripciones {
    padding: 5px 10px;
    font-size: 12px;
  }

  .preheader-dropdown>a {
    font-size: 12px;
  }
}

@media (max-width: 720px) {
  :root {
    --preheader-height: 38px;
    --header-height: 65px;
  }

  .site-preheader .container {
    padding: 4px 12px;
  }

  .site-preheader .preheader-left {
    align-items: center;
    gap: 6px;
  }

  .site-preheader .preheader-right {
    align-items: center;
    gap: 6px;
  }

  .site-preheader .preheader-left>*:not(:last-child)::after,
  .site-preheader .preheader-right>*:not(:last-child)::after {
    height: 10px;
    margin: 0 4px;
  }

  .site-preheader .preheader-phone {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0;
    line-height: 1;
  }

  .site-preheader .preheader-phone i {
    font-size: 16px;
    margin: 0;
  }

  .preheader-campus,
  .preheader-inscripciones {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Logo más pequeño en móviles muy pequeños */
  .site-logo img {
    height: 40px;
  }

  /* Botón CTA aún más compacto */
  .site-cta .btn-cta {
    padding: 8px 14px;
    min-height: 36px;
    white-space: nowrap;
  }

  .site-cta .btn-cta::before {
    font-size: 13px;
  }

  .site-cta .btn-cta::after {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  :root {
    --preheader-height: 36px;
    --header-height: 60px;
  }

  .site-logo img {
    height: 36px;
  }

  .preheader-dropdown>a {
    font-size: 11px;
  }
}

.preheader-submenu a[href$=".pdf"]::before {
  content: "\f1c1";
  /* fa-file-pdf-o */
  font: normal normal normal 14px/1 FontAwesome;
  display: inline-block;
  margin-right: 8px;
  color: var(--brand-red);
}

/* Tipografía y espaciado estilo referencia (UDAVINCI) */
.site-preheader,
.site-preheader a,
.preheader-submenu,
.preheader-submenu a,
.preheader-submenu .submenu-title {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  letter-spacing: .2px;
}

.site-nav .sp-megamenu-parent>li>a {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  font-size: 14px;
  padding: 10px 8px;
}

/* ========== BOTÓN DE MENÚ MÓVIL ========== */
.mobile-menu-btn {
  display: none;
  /* Oculto por defecto en desktop */
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--brand-blue);
  color: #ffffff;
  border: none;
  padding: 7px 12px;
  border-radius: 9999px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 100;
  min-height: 36px;
  max-height: 36px;
  white-space: nowrap;
}

.mobile-menu-btn:hover {
  background: var(--brand-blue-dark);
  transform: scale(1.05);
}

.mobile-menu-btn i {
  font-size: 12px;
}

/* ========== MODAL DE MENÚ MÓVIL ========== */
.mobile-menu-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-modal.active {
  visibility: visible;
  opacity: 1;
}

.mobile-menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 350px;
  height: 100%;
  background: #ffffff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.mobile-menu-modal.active .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: var(--brand-blue);
  color: #ffffff;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-header h3 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.mobile-menu-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.mobile-menu-close:hover {
  transform: rotate(90deg);
}

.mobile-menu-nav {
  padding: 0;
}

.mobile-menu-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-menu-nav>ul>li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mobile-menu-nav>ul>li>a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  color: #283457;
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s ease;
}

.mobile-menu-nav>ul>li>a:hover {
  background: #f5f7fb;
  color: var(--brand-blue);
  padding-left: 25px;
}

.mobile-menu-nav>ul>li>a i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  color: var(--brand-blue);
}

/* Submenú móvil */
.mobile-submenu {
  display: none;
  background: #f8f9fa;
  padding: 0;
  margin: 0;
  list-style: none;
}

.mobile-menu-has-submenu.active .mobile-submenu {
  display: block;
}

.mobile-submenu li a {
  display: block;
  padding: 12px 20px 12px 52px;
  color: #495057;
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.mobile-submenu li a:hover {
  background: #ffffff;
  color: var(--brand-blue);
  border-left-color: var(--brand-blue);
  padding-left: 56px;
}

.mobile-submenu-toggle {
  position: relative;
}

.mobile-submenu-toggle .fa-chevron-down {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.mobile-menu-has-submenu.active .mobile-submenu-toggle .fa-chevron-down {
  transform: rotate(180deg);
}

/* ========== RESPONSIVE MOBILE ========== */
@media (max-width: 900px) {

  /* Mostrar botón de menú en móvil */
  .mobile-menu-btn {
    display: inline-flex;
  }

  /* Ocultar navegación desktop en móvil */
  .site-nav {
    display: none !important;
  }

  /* Ajustar alineación del header en móvil */
  .site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    height: 100%;
    width: 100%;
  }

  /* Logo a la izquierda */
  .site-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 100%;
  }

  /* Botón de menú y CTA agrupados a la derecha */
  .mobile-menu-btn {
    flex: 0 0 auto;
    margin: 0;
    order: 2;
  }

  /* Botón CTA a la derecha - alineado verticalmente */
  .site-cta {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    order: 3;
  }

  .site-cta .btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    height: auto;
    min-height: 36px;
    max-height: 36px;
    white-space: nowrap;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  #sp-header.site-header .container {
    padding: 6px 4px;
  }

  .site-header-inner {
    gap: 2px;
  }

  .site-logo img {
    height: 36px;
  }
}

@media (max-width: 480px) {
  :root {
    --header-height: 56px;
  }

  #sp-header.site-header .container {
    padding: 4px 8px;
  }

  .site-header-inner {
    gap: 4px;
  }

  .mobile-menu-content {
    width: 90%;
  }

  .mobile-menu-btn {
    padding: 5px 8px;
    font-size: 10px;
    min-height: 30px;
    max-height: 30px;
    gap: 3px;
  }

  .mobile-menu-btn i {
    font-size: 10px;
  }

  .mobile-menu-btn span {
    display: inline;
    /* Mantener texto "Menú" visible */
  }

  .site-cta .btn-cta {
    padding: 5px 8px;
    min-height: 30px;
    max-height: 30px;
    font-size: 0;
    white-space: nowrap;
  }

  .site-cta .btn-cta::before {
    font-size: 10px;
  }

  .site-cta .btn-cta::after {
    font-size: 10px;
  }

  .site-logo img {
    height: 32px;
  }
}

/* Media query específica para 370px */
@media (max-width: 370px) {
  :root {
    --header-height: 52px;
  }

  #sp-header.site-header .container {
    padding: 3px 6px;
  }

  .site-header-inner {
    gap: 3px;
  }

  .site-logo img {
    height: 28px;
  }

  .mobile-menu-btn {
    padding: 4px 6px;
    font-size: 9px;
    min-height: 28px;
    max-height: 28px;
    gap: 2px;
  }

  .mobile-menu-btn i {
    font-size: 9px;
  }

  .site-cta .btn-cta {
    padding: 4px 6px;
    min-height: 28px;
    max-height: 28px;
    white-space: nowrap;
  }

  .site-cta .btn-cta::before {
    font-size: 9px;
  }

  .site-cta .btn-cta::after {
    font-size: 9px;
  }
}