/* ============================================================
   TripManga – Hotel Search Form
   Colors: Green #038a52  |  Orange #f47c04  |  Slate #1e293b

   Z-INDEX STACK (reasonable values)
   ─────────────────────────────
   Form elements               z-index: 1-100
   .hotel-sf__dropdown         z-index: 1000 (guest selector)
   .pac-container              z-index: 1000 (Google autocomplete)

   Calendar styling lives in public_html/css/shared-calendar.css (.tm-cal-popover)
   - the shared 2-month range calendar used across all modules.
   ============================================================ */

/* ── Form container ── */
.hotel-search-form-container {
    display: flex;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    /* NO z-index here to avoid creating limiting stacking context */
}

/* ── Form wrapper ── */
.hotel-search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
    padding: 0;
    width: 100%;
    max-width: 1400px;
    box-sizing: border-box;
    position: relative;
    /* NO z-index to avoid limiting stacking context */
}

/* Override g-form-control padding for hotel search form */
.g-form-control .hotel-search-form-container {
    margin-left: -100px;
    margin-right: -100px;
    width: calc(100% + 200px);
    padding: 0 100px;
}

.g-form-control .hotel-search-form {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 990px) {
    .g-form-control .hotel-search-form-container {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        padding: 0;
    }
}
/* Catch bleed-out between 991-1100px where container may be narrower */
@media (min-width: 991px) and (max-width: 1100px) {
    .g-form-control .hotel-search-form-container {
        margin-left: -50px;
        margin-right: -50px;
        width: calc(100% + 100px);
        padding: 0 50px;
    }
}

/* ── Individual field ──
   position:relative is the anchor for every popup inside it.
   overflow:visible lets the popup escape the field boundary.       */
.hotel-sf__field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 65px;
    background: #fff;
    border: 2px solid #c8c8c8;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    overflow: visible;
    z-index: 1;          /* default: behind sibling popups */
}

/* Raise the field that owns the currently open popup so its
   popup is never clipped by a later sibling's background.          */
.hotel-sf__field.is-active {
    z-index: 20;
}

/* Raise location field when typing so autocomplete dropdown isn't clipped */
.hotel-sf__field--where:focus-within {
    z-index: 20;
}

/* ── Field variants ── */
.hotel-sf__field--where {
    flex: 1.5 1 0;
    min-width: 200px;
}

.hotel-sf__field--checkin{
    flex: 1.2 1 0;
    min-width: 160px;
}

.hotel-sf__field--checkout {
    flex: 1.4 1 0;
    min-width: 160px;
}

.hotel-sf__field--travellers {
    flex: 1.5 1 0;
    min-width: 220px;
}

/* ── Icon column ── */
.hotel-sf__icon {
    flex-shrink: 0;
    font-size: 18px;
    color: #1e293b;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0fdf4;
    border: 1.5px solid #d1fae5;
    border-radius: 10px;
}

/* ── Content column ── */
.hotel-sf__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hotel-sf__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    margin-bottom: 2px;
    pointer-events: none;
}

.hotel-sf__input,
.hotel-sf__input.location-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    padding: 0;
    width: 100%;
    line-height: 1.4;
    font-family: 'Poppins', sans-serif;
}

.hotel-sf__input::placeholder {
    color: #94a3b8;
}

/* ── Date display area ── */
.hotel-sf__date-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

.hotel-sf__date-sep {
    color: #94a3b8;
    font-weight: 400;
}

/* Hidden native date input used by Flatpickr */
.hotel-sf__datepicker-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ── Travellers trigger ── */
.hotel-sf__travellers-trigger {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
    width: 100%;
    line-height: 1.4;
}

.hotel-sf__travellers-trigger:focus {
    outline: none;
}

/* ── Search button ── */
.hotel-sf__search-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    min-width: 130px;
    min-height: 65px;
    padding: 0 28px;
    background: #f47c04 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif !important;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .25s, transform .15s;
    flex-shrink: 0;
    white-space: nowrap;
    box-sizing: border-box;
    position: relative;
    z-index: 0;
}

.hotel-sf__search-btn:hover {
    background: #038a52 !important;
    transform: translateY(-1px);
}

.hotel-sf__search-btn:active {
    transform: translateY(0);
}

.hotel-sf__search-btn i {
    font-size: 14px;
}

/* ============================================================
   Travellers / Guest dropdown

   Anchored to its .hotel-sf__field--travellers parent via
   position:absolute. Sits flush below the field with a small
   gap. z-index:999999 keeps it above all page elements.
   ============================================================ */
.hotel-sf__dropdown {
    display: none;
    /* position/top/left set by JS via setProperty */
    position: fixed;
    min-width: 280px;
    width: max-content;
    max-width: 340px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .14);
    padding: 20px 24px;
    z-index: 9999;
    animation: sfDropIn .18s ease;
    box-sizing: border-box;
    pointer-events: auto;
}

.hotel-sf__dropdown.is-open {
    display: block;
}

/* Flip upward when there is not enough space below */
.hotel-sf__dropdown.drop-up {
    top: auto;
    bottom: calc(100% + 6px);
    animation: sfDropUp .18s ease;
}

@keyframes sfDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes sfDropUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Guest row */
.tm-dropdown__guest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.tm-dropdown__guest-row:last-of-type {
    border-bottom: none;
}

.tm-dropdown__guest-label {
    font-size: 14px;
    color: #1e293b;
}

.tm-dropdown__guest-label strong {
    font-weight: 600;
}

.tm-dropdown__guest-counter {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* +/- buttons */
.tm-dropdown__counter-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #c8c8c8;
    background: #fff;
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s;
    line-height: 1;
    padding: 0;
    pointer-events: auto;
}

.tm-dropdown__counter-btn:hover {
    border-color: #038a52;
    color: #038a52;
}

.tm-dropdown__counter-btn:active {
    background: #f0faf5;
}

.tm-dropdown__counter-value {
    min-width: 24px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

/* Done button */
.hotel-sf__done-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: #f47c04;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .25s;
    pointer-events: auto;
}

.hotel-sf__done-btn:hover {
    background: #038a52;
    cursor: pointer;
}

/* ============================================================
   Google Places Autocomplete
   ============================================================ */
.pac-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .12);
    font-family: 'Poppins', sans-serif;
    margin-top: 4px;
    z-index: 1000 !important;
    pointer-events: auto !important;
}

.pac-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    color: #1e293b;
    pointer-events: auto !important;
    transition: background .15s, color .15s;
}

.pac-item:last-child {
    border-bottom: none;
}

.pac-item:hover,
.pac-item-selected {
    background: #f0faf5;
    color: #038a52;
    cursor: pointer;
}

.pac-item-query {
    font-weight: 600;
    color: #038a52;
}

.pac-matched {
    color: #f47c04;
    font-weight: 600;
}

.pac-icon {
    width: 18px;
    height: 18px;
    margin-right: 12px;
}

.pac-item > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pac-logo {
    display: none;
}

/* ============================================================
   Responsive – Tablet
   ============================================================ */
@media (max-width: 1200px) {
    .hotel-search-form {
        max-width: 100%;
    }
}

/* Tablet - compact 2-column grid (768–1024px).
   Scoped under .g-form-control (homepage hero) so it outranks the stale
   cross-file .hotel-search-form rules in tm-search-form.css. Fields pair
   two-per-row; a lone field (e.g. Tour's end date) grows to fill its row;
   the Search button always spans full width. */
@media (min-width: 768px) and (max-width: 1024px) {
    .g-form-control .hotel-search-form {
        flex-flow: row wrap;
        gap: 10px;
        align-items: stretch;
    }

    .g-form-control .hotel-search-form .hotel-sf__field,
    .g-form-control .hotel-search-form .hotel-sf__field--where,
    .g-form-control .hotel-search-form .hotel-sf__field--checkin,
    .g-form-control .hotel-search-form .hotel-sf__field--checkout,
    .g-form-control .hotel-search-form .hotel-sf__field--travellers {
        /* -8px (gap is 10px) leaves slack so two columns never wrap */
        flex: 1 1 calc(50% - 8px);
        max-width: none;
        min-width: 0;
        min-height: 64px;
    }

    .g-form-control .hotel-search-form .hotel-sf__search-btn {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        min-height: 52px;
        margin-top: 2px;
    }

    /* Popovers anchored to a half-width field - keep them sane */
    .g-form-control .hotel-search-form .hotel-sf__dropdown {
        max-width: 100%;
    }
}

/* ============================================================
   Responsive – Mobile
   ============================================================ */
@media (max-width: 767px) {
    .hotel-search-form-container {
        padding: 0 12px;
    }

    .hotel-search-form {
        gap: 12px;
        flex-direction: column;
    }

    .hotel-sf__field {
        padding: 14px;
        min-height: auto;
        border-radius: 10px;
        width: 100%;
        flex: 1 1 auto !important;
        min-width: unset !important;
    }

    .hotel-sf__icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .hotel-sf__label {
        font-size: 10px;
        font-weight: 600;
    }

    .hotel-sf__input,
    .hotel-sf__date-display,
    .hotel-sf__travellers-trigger {
        font-size: 13px;
        width: 100%;
    }

    .hotel-sf__search-btn {
        padding: 14px 20px;
        font-size: 14px;
        min-height: auto;
        border-radius: 10px;
        gap: 6px;
        width: 100%;
        margin-top: 4px;
    }

    .hotel-sf__search-btn i {
        font-size: 13px;
    }

    /* Popups: JS positions via setProperty - just allow full width */
    .hotel-sf__dropdown {
        max-width: none;
    }
}

/* ============================================================
   Small phones
   ============================================================ */
@media (max-width: 575px) {
    .hotel-search-form-container {
        padding: 0 10px;
    }

    .hotel-search-form {
        gap: 8px;
    }

    .hotel-sf__field {
        padding: 12px;
        min-height: auto;
        font-size: 12px;
    }

    .hotel-sf__icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .hotel-sf__label {
        font-size: 10px;
        letter-spacing: .3px;
    }

    .hotel-sf__input,
    .hotel-sf__date-display,
    .hotel-sf__travellers-trigger {
        font-size: 12px;
    }

    .hotel-sf__search-btn {
        padding: 12px 16px;
        font-size: 13px;
        min-height: auto;
        border-radius: 8px;
    }

    .hotel-sf__search-btn i {
        font-size: 12px;
    }
}

/* ============================================================
   Box-sizing reset (scoped to form only)
   ============================================================ */
.hotel-search-form-container *,
.hotel-search-form * {
    box-sizing: border-box;
}

/* ============================================================
   TM Destination Autocomplete Dropdown (shared: hotel, tour)
   ============================================================ */
.tm-sf-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 9999;
    display: none;
}
.tm-sf-suggestions::-webkit-scrollbar { display: none; }
.tm-sf-suggestions.is-open { display: block; }
.tm-sf-section-head {
    padding: 6px 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.tm-sf-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: #1a2b48;
    transition: background .1s;
}
.tm-sf-suggestion:last-child { border-bottom: none; }
.tm-sf-suggestion:hover { background: #f8fafc; }
.tm-sf-sug-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #f1f5f9 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    color: #1a2b48 !important;
}
.tm-sf-sug-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.tm-sf-sug-loc  { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.tm-sf-sug-empty { padding: 16px; text-align: center; color: #94a3b8; font-size: 13px; }