/*
  mp-responsive.css
  ------------------------------------------------------------
  ✅ Este archivo SOLO contiene overrides responsive.
  ✅ Se debe cargar DESPUÉS de tus CSS existentes (front.css, planes.css, etc.).
  ✅ Objetivo: mejorar experiencia móvil sin romper desktop.
*/

/* ============================================================
   1) Global mobile basics
   ============================================================ */

@media (max-width: 900px) {
  /* evitar zoom iOS en inputs */
  input, select, textarea, button { font-size: 16px; }

  .mp-wrap { padding-left: 14px; padding-right: 14px; }

  /* targets táctiles */
  .mp-btn, .mp-input, select, input[type="date"], input[type="text"], input[type="number"], input[type="email"]{
    min-height: 48px;
  }

  /* safe-area iPhone */
  .mp-wrap { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
}

/* ============================================================
   6) Selector de viajeros (popover) sin desbordes en móvil
   - Convierte el popover en “bottom sheet” (más legible)
   ============================================================ */

@media (max-width: 600px) {
  .mp-paxwrap.is-open .mp-paxpop {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
    max-height: 70vh !important;
    overflow: auto !important;
    border-radius: 22px !important;
    z-index: 9999 !important;
  }

  .mp-paxrow { padding: 12px 0 !important; }
  .mp-paxlbl strong { font-size: 16px !important; }
  .mp-paxsub { font-size: 13px !important; }

  .mp-paxbtn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 14px !important;
  }

  .mp-paxnum { font-size: 16px !important; }
  .mp-paxfoot .mp-small { font-size: 12px !important; }
}

/* ============================================================
   2) Home / Página paquetes: buscador (compacto + fácil de tocar)
   ============================================================ */

@media (max-width: 900px) {
  /* contenedor buscador: menos alto */
  .mp-wrap.mp-search .mp-searchbar {
    padding: 14px !important;
    border-radius: 26px !important;
  }

  /* layout: Origen + Botón en fila 1, Destino fila 2, fechas fila 3, pax/moneda fila 4 */
  .mp-wrap.mp-search .mp-searchbar__row {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .mp-wrap.mp-search .mp-searchbar__row > * { min-width: 0; }

  /* Origen */
  .mp-wrap.mp-search .mp-searchbar__row > .mp-field:nth-child(1) {
    grid-column: 1 / span 4 !important;
    grid-row: 1 !important;
  }

  /* Botón Buscar (más compacto, no “cuadro gigante”) */
  .mp-wrap.mp-search .mp-searchbar__row > .mp-searchbar__btn {
    grid-column: 5 / span 2 !important;
    grid-row: 1 !important;
    min-height: 54px !important;
    border-radius: 18px !important;
    padding: 12px 10px !important;
  }
  .mp-wrap.mp-search .mp-searchbar__btn .mp-searchbar__icon { width: 20px !important; height: 20px !important; }
  .mp-wrap.mp-search .mp-searchbar__btn .mp-searchbar__txt { font-size: 16px !important; line-height: 1.1 !important; }

  /* Destino */
  .mp-wrap.mp-search .mp-searchbar__row > .mp-field:nth-child(2) {
    grid-column: 1 / span 6 !important;
    grid-row: 2 !important;
  }

  /* Check-in / Check-out */
  .mp-wrap.mp-search .mp-searchbar__row > .mp-field:nth-child(3) {
    grid-column: 1 / span 3 !important;
    grid-row: 3 !important;
  }
  .mp-wrap.mp-search .mp-searchbar__row > .mp-field:nth-child(4) {
    grid-column: 4 / span 3 !important;
    grid-row: 3 !important;
  }

  /* Viajeros / Moneda */
  .mp-wrap.mp-search .mp-searchbar__row > .mp-field:nth-child(5) {
    grid-column: 1 / span 3 !important;
    grid-row: 4 !important;
  }
  .mp-wrap.mp-search .mp-searchbar__row > .mp-field:nth-child(6) {
    grid-column: 4 / span 3 !important;
    grid-row: 4 !important;
  }

  /* fila inferior */
  .mp-wrap.mp-search .mp-searchbar__row--bottom {
    margin-top: 10px !important;
    padding-top: 10px !important;
  }
  .mp-wrap.mp-search .mp-searchbar__row--bottom .mp-small {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  /* inputs más “touch” pero no tan altos */
  .mp-wrap.mp-search .mp-label { font-size: 13px !important; margin-bottom: 6px !important; }
  .mp-wrap.mp-search .mp-input,
  .mp-wrap.mp-search select,
  .mp-wrap.mp-search input[type="date"] {
    min-height: 48px !important;
    padding: 12px 14px !important;
    border-radius: 16px !important;
  }
}

/* ============================================================
   2.1) Home / Página paquetes: popover viajeros (no se desborda)
   ============================================================ */

@media (max-width: 900px) {
  /* solo en el buscador (página paquetes) */
  .mp-wrap.mp-search .mp-paxwrap.is-open .mp-paxpop {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    top: auto !important;
    max-height: 72vh !important;
    overflow: auto !important;
    border-radius: 18px !important;
    z-index: 9999 !important;
  }

  .mp-wrap.mp-search .mp-paxpop .mp-paxrow {
    padding: 12px 0 !important;
  }

  .mp-wrap.mp-search .mp-paxpop .mp-paxlbl strong { font-size: 15px !important; }
  .mp-wrap.mp-search .mp-paxpop .mp-paxsub { font-size: 13px !important; }

  .mp-wrap.mp-search .mp-paxpop .mp-paxbtn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 14px !important;
    font-size: 20px !important;
  }

  .mp-wrap.mp-search .mp-paxpop .mp-paxfoot .mp-small {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  /* ==========================================================
     BUSCADOR (markup nuevo: .mp-searchbar__grid / __field)
     - Compacto en móvil
     - Botón "Buscar" abajo, ancho completo
     ========================================================== */

  .mp-searchbar {
    padding: 14px !important;
    border-radius: 24px !important;
  }

  .mp-searchbar__grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .mp-searchbar__field {
    padding: 12px !important;
    border-radius: 18px !important;
  }

  .mp-searchbar__label {
    font-size: 13px !important;
    margin: 0 0 8px !important;
    line-height: 1.1 !important;
  }

  /* Reacomodo por orden real de campos:
     1=Origen, 2=Botón, 3=Destino, 4=Check-in, 5=Check-out, 6=Viajeros, 7=Moneda */
  .mp-searchbar__grid > .mp-searchbar__field:nth-child(1) { grid-column: 1 / -1 !important; grid-row: 1 !important; }
  .mp-searchbar__grid > .mp-searchbar__field:nth-child(3) { grid-column: 1 / -1 !important; grid-row: 2 !important; }
  .mp-searchbar__grid > .mp-searchbar__field:nth-child(4) { grid-column: 1 / 2 !important;  grid-row: 3 !important; }
  .mp-searchbar__grid > .mp-searchbar__field:nth-child(5) { grid-column: 2 / 3 !important;  grid-row: 3 !important; }
  .mp-searchbar__grid > .mp-searchbar__field:nth-child(6) { grid-column: 1 / 2 !important;  grid-row: 4 !important; }
  .mp-searchbar__grid > .mp-searchbar__field:nth-child(7) { grid-column: 2 / 3 !important;  grid-row: 4 !important; }

  /* Botón "Buscar" al final */
  .mp-searchbar__field--btn {
    grid-column: 1 / -1 !important;
    grid-row: 5 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .mp-searchbar__btn {
    width: 100% !important;
    min-height: 56px !important;
    height: 56px !important;
    border-radius: 18px !important;
    padding: 0 16px !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }

  /* Inputs/Dropdowns dentro del buscador */
  .mp-searchbar__control,
  .mp-searchbar__control input,
  .mp-searchbar__control select,
  .mp-searchbar__control .mp-dd__btn {
    min-height: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
    font-size: 16px !important; /* evita zoom iOS */
  }

  .mp-searchbar__help {
    margin-top: 10px !important;
    font-size: 12px !important;
  }

  /* Selector de viajeros (popover) -> bottom sheet en móvil para que no se desborde */
  .mp-paxwrap.is-open .mp-paxpop {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
    top: auto !important;
    width: auto !important;
    max-height: 70vh !important;
    overflow: auto !important;
    border-radius: 22px !important;
    z-index: 99999 !important;
  }

  .mp-paxpop .mp-paxrow { padding: 12px 0 !important; }
  .mp-paxpop .mp-paxlbl strong { font-size: 16px !important; }
  .mp-paxpop .mp-paxsub { font-size: 13px !important; }
  .mp-paxpop .mp-paxbtn { width: 40px !important; height: 40px !important; }
}

/* ============================================================
   3) Listados / Cards (promos 2x1 + paquetes más vendidos)
      ✅ 2 columnas en móvil
   ============================================================ */

@media (max-width: 900px) {
  .mp-bestpacks { padding-top: 10px; }

  /* títulos más pequeños (evita desborde) */
  .mp-bestpacks__title {
    font-size: clamp(20px, 6vw, 26px) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.02em !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    margin-bottom: 14px !important;
  }

  /* 2 columnas */
  .mp-bestpacks__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  /* cards más compactas */
  .mp-bestpack { border-radius: 22px !important; }
  .mp-bestpack__media { height: 160px !important; border-radius: 22px !important; }
  .mp-bestpack__overlay { padding: 12px !important; }

  .mp-bestpack__name {
    font-size: 15px !important;
    line-height: 1.15 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .mp-bestpack__meta {
    font-size: 12px !important;
    line-height: 1.2 !important;
    opacity: .92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 420px) {
  .mp-bestpacks__title { font-size: 24px !important; }
  .mp-bestpack__media { height: 140px !important; }
}

/* ============================================================
   4) Single plan (mp_plan): apilar hero/form + hoteles
   ============================================================ */

@media (max-width: 900px) {
  .mp-planhero { display: block !important; }

  .mp-planhero__img {
    height: 220px !important;
    border-radius: 26px !important;
    margin-bottom: 14px !important;
  }

  .mp-planhero__body { padding: 0 !important; }

  .mp-planform__grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* ==========================================================
     HOTEL EN MÓVIL
     - Mover “Elige tu hotel” arriba (no obliga a scrollear todo)
     - Usar carrusel horizontal: menos alto, más fácil de tocar
     ========================================================== */

  .mp-plansections {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  #mpHotelPickSection {
    order: 1 !important;
  }

  .mp-plansec:not(#mpHotelPickSection) {
    order: 2 !important;
  }

  .mp-hotelsgrid {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    gap: 12px !important;
    padding: 2px 2px 10px !important;
    scroll-snap-type: x mandatory;
  }

  .mp-hotelsgrid::-webkit-scrollbar {
    height: 6px;
  }

  .mp-hotelsgrid > .mp-hotelcard {
    flex: 0 0 78% !important;
    max-width: 78% !important;
    scroll-snap-align: start;
  }

  .mp-hotelcard__img {
    height: 160px !important;
  }

  .mp-hotelcard__name {
    font-size: 16px !important;
    line-height: 1.2 !important;
  }

  .mp-hotelcard__hint {
    font-size: 13px !important;
  }

  /* modal hotel: fullscreen */
  .mp-hotelmodal__box {
    width: calc(100vw - 20px) !important;
    max-width: 540px !important;
    margin: 10px auto !important;
    border-radius: 22px !important;
  }

  .mp-hotelmodal__body { max-height: 70vh !important; overflow: auto !important; }
}

/* ============================================================
   5) Vuelos: sidebar arriba + cards apiladas
   ============================================================ */

@media (max-width: 900px) {
  .mp-flights {
    display: block !important;
  }

  .mp-flights__filters {
    width: 100% !important;
    margin-bottom: 14px !important;
    position: static !important;
  }

  .mp-flightcard {
    display: block !important;
  }

  .mp-flightcard__left,
  .mp-flightcard__right {
    width: 100% !important;
  }

  .mp-flightcard__right {
    border-left: 0 !important;
    border-top: 1px solid rgba(0,0,0,.08) !important;
  }
}

/* ============================================================
   6) Selector de viajeros (popover) sin desbordes en móvil
   - Convierte el popover en “bottom sheet” (más legible)
   ============================================================ */

@media (max-width: 600px) {
  .mp-paxwrap.is-open .mp-paxpop {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
    top: auto !important;
    max-height: 72vh !important;
    overflow: auto !important;
    border-radius: 22px !important;
    z-index: 9999 !important;
  }

  .mp-paxpop .mp-paxrow {
    padding: 12px 0 !important;
  }

  .mp-paxpop .mp-paxlbl strong {
    font-size: 16px !important;
  }

  .mp-paxpop .mp-paxsub {
    font-size: 13px !important;
  }

  .mp-paxpop .mp-paxbtn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 14px !important;
  }
}
/* ==========================================================
   ✅ HOTEL (PAQUETES) – evitar desbordes en resumen / fechas
   (Mobile overrides)
   ========================================================== */
@media (max-width: 820px){
  /* En algunos templates el detalle del hotel usa .mp-plan__grid + .mp-plan__right */
  .mp-plan__grid{
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .mp-plan__right{
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 14px !important;
    border-radius: 18px !important;
  }
  .mp-plan__right *{
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Tabla/resumen: permitir wrap y que NO corte los valores de la derecha */
  .mp-plan__right .mp-summary{
    overflow: visible !important;
  }
  .mp-plan__right .mp-summary__row{
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
  }
  .mp-plan__right .mp-summary__row > span{
    flex: 1 1 55% !important;
    min-width: 0 !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
  }
  .mp-plan__right .mp-summary__row > strong{
    flex: 0 1 45% !important;
    min-width: 0 !important;
    text-align: right !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
  }
  .mp-plan__right .mp-summary__row > strong select{
    width: 100% !important;
    max-width: 160px !important;
    min-height: 44px !important;
    font-size: 16px !important; /* evita zoom iOS */
  }

  /* Inputs/Selects dentro del panel derecho */
  .mp-plan__right input,
  .mp-plan__right select,
  .mp-plan__right button,
  .mp-plan__right .mp-btn{
    max-width: 100% !important;
  }
  .mp-plan__right input,
  .mp-plan__right select{
    min-height: 46px !important;
    font-size: 16px !important;
  }
  .mp-plan__right .mp-btn{
    width: 100% !important;
    padding: 14px 16px !important;
  }

  /* Fechas (si vienen en 2 columnas, que no se salgan) */
  .mp-plan__right .mp-dates,
  .mp-plan__right .mp-dategrid,
  .mp-plan__right .mp-datesgrid,
  .mp-plan__right .mp-fields--dates{
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
}
@media (max-width: 420px){
  .mp-plan__right .mp-dates,
  .mp-plan__right .mp-dategrid,
  .mp-plan__right .mp-datesgrid,
  .mp-plan__right .mp-fields--dates{
    grid-template-columns: 1fr !important;
  }
}
