/* Tu Destino — header público. Concepto "liquid glass": una franja de fondo
   navy con brillos degradados magenta/naranja, y encima dos piezas de
   vidrio esmerilado flotando (blur real vía backdrop-filter) — el menú
   arriba, la barra de categorías abajo como cápsulas individuales. */

.mega-header { position: relative; z-index: 100; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Franja de fondo ---- */
.mega-header-stage {
  position: relative;
  padding: 18px 0 22px;
  background:
    radial-gradient(560px 300px at 18% 10%, rgba(252,20,115,.36), transparent 60%),
    radial-gradient(680px 340px at 88% 0%, rgba(255,93,0,.30), transparent 65%),
    var(--navy);
}

/* ---- Vidrio 1: logo + menú + búsqueda ---- */
/* z-index más alto que la barra de abajo a propósito: así el mega-menú
   (Cruceros, Nosotros, Holding), que vive dentro de este bloque, siempre
   queda por encima de la barra de categorías en vez de taparse con ella. */
.mega-header-top {
  position: relative;
  z-index: 4;
  max-width: 1200px;
  margin: 0 auto 12px;
  padding: 12px 24px;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.22);
}
.mega-header-top-inner {
  display: flex; align-items: center; flex-wrap: wrap;
  padding: 0; margin: 0; max-width: none; gap: 12px 20px;
}

.mega-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.mega-logo-img { height: 34px; max-width: 180px; object-fit: contain; }
.mega-logo-text { font-family: var(--font-sans); font-weight: 800; font-size: 1.3rem; letter-spacing: .5px; }
.mega-logo-tu { color: var(--naranja); }
.mega-logo-destino { color: var(--magenta); }
.mega-logo-flag { display: inline-flex; align-items: center; }
.mega-logo-flag-svg { border-radius: 2px; }

.mega-menu-toggle {
  display: none; align-items: center; justify-content: center;
  background: none; border: none; padding: 6px;
  width: 32px; height: 32px; color: #fff; cursor: pointer; flex-shrink: 0;
}
.mega-menu-toggle svg { stroke: #fff; }

.mega-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
.mega-nav-link {
  background: none; border: none; font: inherit; cursor: pointer;
  font-size: .85rem; font-weight: 600; color: rgba(255,255,255,.92);
  display: flex; align-items: center; gap: 4px;
  text-decoration: none; padding: 8px 12px; border-radius: 999px; white-space: nowrap;
}
.mega-nav-link:hover { background: linear-gradient(135deg, rgba(252,20,115,.55), rgba(255,93,0,.5)); color: #fff; }
.mega-nav-link .caret { font-size: .6rem; color: rgba(255,255,255,.6); }
.mega-nav-soon { cursor: default; opacity: .5; }
.mega-nav-soon:hover { background: none; color: rgba(255,255,255,.92); }

.mega-nav-item { position: relative; }

.mega-dropdown {
  display: block; position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 12px; box-shadow: 0 16px 40px rgba(11,29,51,.28);
  padding: 20px; z-index: 50;
  visibility: hidden; opacity: 0; pointer-events: none;
}
.mega-nav-item.open .mega-dropdown {
  visibility: visible; opacity: 1; pointer-events: auto;
}

.mega-dropdown-simple { min-width: 180px; left: 0; transform: none; padding: 10px; }
.mega-dropdown-simple a {
  display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none;
  color: var(--texto); font-size: .88rem;
}
.mega-dropdown-simple a:hover { background: var(--arena); color: var(--magenta); }

.mega-dropdown-empty { font-size: .85rem; color: var(--texto-suave); margin: 0; min-width: 200px; }

.mega-dropdown-cruceros {
  display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 24px 28px;
  min-width: 560px; max-width: 90vw;
}
.mega-cruceros-item {
  display: flex; align-items: center; justify-content: center; height: 46px;
}
.mega-cruceros-item img { max-height: 44px; max-width: 100%; object-fit: contain; }
.mega-cruceros-noimg { font-size: .78rem; font-weight: 600; color: var(--navy); text-align: center; }

.mega-dropdown-holding { min-width: 260px; padding: 8px; }
.mega-dropdown-holding a {
  display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 12px 10px;
  border-bottom: 1px solid var(--borde);
}
.mega-dropdown-holding a:last-child { border-bottom: none; }
.mega-dropdown-holding a:hover { background: var(--arena); border-radius: 8px; }
.mega-dropdown-holding small { color: var(--texto-suave); font-size: .78rem; }
.mega-dropdown-holding .mega-logo-text { font-size: 1rem; }

/* ---- Buscador ---- */
.mega-search {
  display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  width: 190px;
  transition: width .2s ease, background .2s ease;
}
.mega-search:focus-within { width: 230px; background: rgba(255,255,255,.16); }
.mega-search input {
  background: none; border: none; outline: none; color: #fff;
  font-size: .82rem; width: 100%; font-family: inherit; min-width: 0;
}
.mega-search input::placeholder { color: rgba(255,255,255,.55); }
.mega-search-icon-btn {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); padding: 0;
}
.mega-search-icon-btn:hover { background: linear-gradient(135deg, var(--magenta), var(--naranja)); color: #fff; }

.mega-search-mobile-btn {
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 6px; flex-shrink: 0;
  background: none; border: none; color: #fff;
}

/* Popover que se abre al hacer clic en el ícono de búsqueda cuando el
   input completo está oculto (header.js lo inyecta) — antes ese botón era
   un link directo a buscar.html sin poder escribir nada, así que siempre
   caía en "todos los paquetes". Ahora deja escribir antes de navegar. */
.mega-header-top-inner { position: relative; }
.mega-search-popover {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 24px;
  z-index: 20;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 16px 40px rgba(11,29,51,.28);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.mega-search-popover.open { display: flex; }
.mega-search-popover input {
  border: none; outline: none; background: none; font-size: .88rem; width: 180px;
  font-family: inherit; color: var(--texto);
}
.mega-search-popover input::placeholder { color: var(--texto-suave); }
.mega-search-popover button {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--magenta), var(--naranja)); color: #fff; padding: 0;
}
@media (max-width: 480px) {
  .mega-search-popover { right: 16px; }
  .mega-search-popover input { width: 130px; }
}

/* ---- Vidrio 2: barra de categorías (cada link es su propia cápsula) ---- */
.mega-header-bar {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.mega-header-bar-inner {
  display: flex; align-items: center; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0; margin: 0; max-width: none; scrollbar-width: none; scroll-behavior: smooth;
}
.mega-header-bar-inner::-webkit-scrollbar { display: none; }
.mega-header-bar-inner a {
  flex-shrink: 0; display: flex; align-items: center; gap: 7px;
  text-decoration: none; color: rgba(255,255,255,.92); font-size: .8rem; font-weight: 600;
  padding: 10px 14px; white-space: nowrap;
  background: rgba(255,255,255,.09);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.18);
}
.mega-header-bar-inner a svg { stroke: #ffc2dc; flex-shrink: 0; }
.mega-header-bar-inner a:hover {
  background: linear-gradient(135deg, rgba(252,20,115,.55), rgba(255,93,0,.5));
  border-color: rgba(255,255,255,.32);
}
.mega-header-bar-inner a:hover svg { stroke: #fff; }

/* Flechas que indican que la barra se puede deslizar — aparecen/desaparecen
   solas según la posición del scroll (ver header.js), a cualquier ancho de
   pantalla, no solo en móvil, porque con 11 categorías la fila no entra
   completa ni en escritorio. */
.mega-header-bar-arrow-left,
.mega-header-bar-arrow-right {
  display: none; align-items: center; justify-content: center;
  position: absolute; top: 0; bottom: 0; width: 52px;
  border: none; cursor: pointer; color: #fff; padding: 0;
  /* Encima de las cápsulas: cada una tiene backdrop-filter propio, lo que
     las promueve a su propio stacking context (z-index:auto) — un
     z-index bajo acá quedaba "empatado" con ellas y la última cápsula, al
     ser opaca, ganaba visualmente el tramo final del degradado en vez de
     desvanecerse debajo de él. */
  z-index: 6;
}
.mega-header-bar-arrow-left svg,
.mega-header-bar-arrow-right svg { stroke-width: 3; position: relative; z-index: 1; }
.mega-header-bar.can-scroll-right .mega-header-bar-arrow-right { display: flex; }
.mega-header-bar.can-scroll-left .mega-header-bar-arrow-left { display: flex; }
.mega-header-bar-arrow-right {
  right: 24px;
  background: linear-gradient(90deg, rgba(11,29,51,0) 0%, var(--navy) 55%, var(--navy) 100%);
}
.mega-header-bar-arrow-left {
  left: 24px;
  background: linear-gradient(270deg, rgba(11,29,51,0) 0%, var(--navy) 55%, var(--navy) 100%);
}

/* ---- Responsive ---- */
/* Entre 900 y ~1480px el menú (que creció con "Cupos Confirmados", "Seguros
   de Viaje", "Holding Tu Destino") ya no cabe junto al buscador completo
   (el input de texto) dentro del max-width:1200px del header, pero todavía
   entra horizontal sin pasar a hamburguesa — acá el buscador se reduce a
   solo el ícono para no forzar el wrap del menú/desbordar la tarjeta de
   vidrio. El corte se subió de 1320 a 1480 porque a 1366px (resolución de
   notebook muy común) el conjunto ya no entraba y el buscador completo se
   salía de la tarjeta. mega-header-top-inner además ahora tiene
   flex-wrap:wrap como respaldo, por si en algún ancho puntual el contenido
   sigue sin entrar: pasa a una segunda línea en vez de desbordar. */
@media (max-width: 1480px) {
  .mega-search { display: none; }
  .mega-search-mobile-btn { display: flex; margin-left: auto; }
}

@media (max-width: 900px) {
  .mega-menu-toggle { display: flex; align-items: center; justify-content: center; margin-left: 2px; }
  .mega-nav {
    display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: #fff; border-radius: 16px; flex-direction: column;
    align-items: stretch; gap: 0; padding: 8px 14px 14px; box-shadow: 0 16px 40px rgba(11,29,51,.26);
    z-index: 5;
  }
  .mega-nav.open { display: flex; }
  .mega-nav-link {
    color: var(--texto); padding: 12px 4px; border-bottom: 1px solid var(--borde);
    border-radius: 0; justify-content: space-between;
  }
  .mega-nav-link:hover { background: none; color: var(--magenta); }
  .mega-nav-link .caret { color: var(--texto-suave); }
  .mega-dropdown {
    position: static; transform: none; box-shadow: none; border: 1px solid var(--borde);
    margin: 0; max-height: 0; padding: 0 10px; overflow: hidden; border-radius: 10px;
  }
  .mega-nav-item.open .mega-dropdown { margin: 6px 0 10px; padding: 16px; max-height: none; }
  .mega-dropdown-cruceros { grid-template-columns: repeat(3, 1fr); min-width: 0; gap: 16px; }
  .mega-dropdown-simple { min-width: 0; }

  .mega-header-top { margin: 0 16px 10px; padding: 10px 16px; }
  .mega-header-bar { padding: 0 16px; }
  .mega-header-bar-arrow-right { right: 16px; }
  .mega-header-bar-arrow-left { left: 16px; }
}
