/* ===========================================================================
   ClawFlights mobile layer - November 2026. Loaded LAST in layouts/header.php.
   ---------------------------------------------------------------------------
   WHY THIS FILE EXISTS
   vista-flight.css hides the header call button at <=1180px through four
   separate !important rules (.vd-header-actions, .vd-vista-header-actions,
   .vd-pro-header-actions - twice). Editing them in place is a specificity
   fight. Everything here wins on load order plus one extra class, and this is
   the one place to look for mobile header and mobile results behaviour.

   Desktop above 1180px is not affected by anything in this file except the
   phone icon rule in section 1, which keeps that icon hidden on desktop.

   The sticky bottom call bar is NOT here: it is self-contained in
   app/Views/partials/mobile_call_bar.php so the standalone pages get it too.
   =========================================================================== */


/* 1. Header call button on tablets and phones ------------------------------
   Stays visible and sits immediately before the menu toggle. DOM order
   already puts it there; the nav is hidden at this width, so the grid is
   logo | call | menu. */
.vd-pro-header .cf-call-ico { display: none !important; }

@media (max-width: 1180px) {
    .vd-pro-header .vd-pro-header-inner {
        grid-template-columns: minmax(0, 1fr) auto auto !important;
        gap: 10px !important;
    }
    .vd-pro-header .vd-pro-header-actions {
        display: flex !important;
        align-items: center !important;
        justify-self: end !important;
        gap: 0 !important;
    }
    .vd-pro-header .vd-pro-header-actions .vd-call-now-btn {
        height: 42px !important;
        min-width: 0 !important;
        padding: 0 16px !important;
        gap: 7px !important;
        font-size: 12.5px !important;
        letter-spacing: .03em !important;
        white-space: nowrap !important;
    }
    .vd-pro-header .cf-call-ico { display: block !important; width: 16px !important; height: 16px !important; flex-shrink: 0; }
    .vd-pro-header .cf-call-arrow { display: none !important; }
    .vd-pro-header .vd-mobile-menu { width: 42px !important; height: 42px !important; min-width: 42px !important; }
}

/* Narrow phones: drop "Tap to" so the lockup, button and menu always fit. */
@media (max-width: 400px) {
    .vd-pro-header .vd-pro-header-inner { gap: 8px !important; }
    .vd-pro-header .vd-pro-header-actions .vd-call-now-btn { padding: 0 13px !important; letter-spacing: .02em !important; }
    .vd-pro-header .cf-call-long { display: none !important; }
}


/* 2. Results page: results first on phones --------------------------------
   The full search form and the full filter panel used to stack above the
   first flight. On phones both collapse behind two buttons; the crumb in
   the top bar already restates the search. Collapsing is switched on by a
   class the page adds with JS, so without JS everything stays visible. It
   is only switched on when there are results to show. */
.cf-rs-mobilebar { display: none; }

@media (max-width: 920px) {
    .cf-rs-mobilebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 4px 0 14px;
    }
    .cf-rs-mobilebar button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 46px;
        padding: 0 12px;
        border-radius: 14px;
        border: 1px solid #dbe4f0;
        background: #fff;
        color: #0f172a;
        font: 700 14px/1 Inter, system-ui, -apple-system, sans-serif;
        box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background .15s ease, color .15s ease, border-color .15s ease;
    }
    .cf-rs-mobilebar button svg { width: 17px; height: 17px; flex-shrink: 0; color: #1d4ed8; }
    .cf-rs-mobilebar button[aria-expanded="true"] { background: #0A2A5C; border-color: #0A2A5C; color: #fff; }
    .cf-rs-mobilebar button[aria-expanded="true"] svg { color: #f0b429; }
    .cf-rs-mobilebar button:focus-visible { outline: 3px solid rgba(29, 78, 216, .35); outline-offset: 2px; }

    .cf-rs-badge {
        display: inline-grid;
        place-items: center;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        border-radius: 999px;
        background: #f0b429;
        color: #1f1400;
        font-size: 11px;
        font-weight: 800;
    }
    .cf-rs-badge[hidden] { display: none; }

    html.cf-rs-collapse .vd-flight-results-v16 .vd-rs-search:not(.cf-open),
    html.cf-rs-collapse .vd-flight-results-v16 .vd-filters-v16:not(.cf-open) {
        display: none !important;
    }
    .vd-flight-results-v16 .vd-rs-search.cf-open,
    .vd-flight-results-v16 .vd-filters-v16.cf-open {
        animation: cfPanelIn .18s ease-out;
        margin-bottom: 16px;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .vd-flight-results-v16 .vd-rs-search.cf-open,
    .vd-flight-results-v16 .vd-filters-v16.cf-open { animation: none; }
    .cf-rs-mobilebar button { transition: none; }
}


/* 3. Results pagination -------------------------------------------------
   The page renders every deduplicated offer so sorting and filtering cover
   the full set; the inline pager in flights/results.php shows them 20 at a
   time by toggling this class. */
/* vista-flight.css forces display:grid !important on the cards, which beats
   both this class AND the [hidden] attribute that the stops / airline /
   price filters in vista-flight.js set. So filtering never actually hid a
   card. These selectors outrank that rule at every width. */
.vd-flight-results-v16 .vd-flight-card-v16[hidden],
.vd-flight-results-v16 .vd-flight-card-v16.cf-page-hidden,
.vd-flight-results-v16 [data-no-results][hidden] { display: none !important; }

.cf-rs-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    min-height: 48px;
    margin: 18px auto 4px;
    padding: 0 20px;
    border-radius: 14px;
    border: 1px solid #c7d7ee;
    background: #fff;
    color: #0A2A5C;
    font: 700 14.5px/1 Inter, system-ui, -apple-system, sans-serif;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.cf-rs-more:hover { border-color: #0A2A5C; }
.cf-rs-more:focus-visible { outline: 3px solid rgba(29, 78, 216, .35); outline-offset: 2px; }
.cf-rs-more small { font-size: 12px; font-weight: 600; color: #64748b; }
.cf-rs-more[hidden] { display: none; }


/* 4. Compact flight cards on phones and small tablets ----------------------
   Below 920px the legacy layout stacked all five card blocks vertically, so
   one card was about 470px tall and a phone showed a single flight. This is
   three rows instead: airline / depart - route - arrive / price + Select. */
@media (max-width: 920px) {
    .vd-flight-results-v16 .vd-flight-list-v16 { gap: 10px !important; }

    .vd-flight-results-v16 .vd-flight-card-v16 {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        grid-template-areas: "air air air" "dep route arr" "price price price" !important;
        gap: 8px 12px !important;
        align-items: center !important;
        min-height: 0 !important;
        padding: 12px 14px !important;
        border-radius: 16px !important;
    }
    .vd-flight-results-v16 .vd-flight-card-v16:hover { transform: none !important; }

    .vd-flight-results-v16 .vd-flight-card-v16 > * {
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .vd-flight-results-v16 .vd-flight-card-v16 > .vd-airline-v16 {
        grid-area: air !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .vd-flight-results-v16 .vd-logo-circle-v16 { width: 30px !important; height: 30px !important; min-width: 30px !important; }
    .vd-flight-results-v16 .vd-logo-circle-v16 img { width: 26px !important; height: 26px !important; }
    .vd-flight-results-v16 .vd-airline-v16 strong { font-size: 14px !important; }
    .vd-flight-results-v16 .vd-airline-v16 small { margin-top: 2px !important; font-size: 11px !important; }

    .vd-flight-results-v16 .vd-flight-card-v16 > .vd-time-v16 {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
    }
    .vd-flight-results-v16 .vd-flight-card-v16 > .vd-time-v16:nth-child(2) { grid-area: dep !important; align-items: flex-start !important; text-align: left !important; }
    .vd-flight-results-v16 .vd-flight-card-v16 > .vd-time-v16:nth-child(4) { grid-area: arr !important; align-items: flex-end !important; text-align: right !important; }
    .vd-flight-results-v16 .vd-time-v16 strong { font-size: 18px !important; line-height: 1.1 !important; }
    .vd-flight-results-v16 .vd-time-v16 span { font-size: 12px !important; }

    .vd-flight-results-v16 .vd-flight-card-v16 > .vd-route-line-v16 {
        grid-area: route !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 4px !important;
        padding-inline: 4px !important;
        text-align: center !important;
    }
    .vd-flight-results-v16 .vd-route-line-v16 > small { line-height: 1.2 !important; font-size: 11.5px !important; }
    .vd-flight-results-v16 .vd-route-line-v16 > b { align-self: stretch !important; margin: 0 !important; }
    .vd-flight-results-v16 .vd-route-line-v16 > span { margin: 0 !important; padding: 2px 8px !important; line-height: 1.3 !important; }

    .vd-flight-results-v16 .vd-flight-card-v16 > .vd-price-v16 {
        grid-area: price !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        padding-top: 8px !important;
        border-top: 1px solid #edf2f7 !important;
    }
    .vd-flight-results-v16 .vd-price-v16 small { order: 1; margin: 0 !important; font-size: 11px !important; }
    .vd-flight-results-v16 .vd-price-v16 strong { order: 2; margin-right: auto !important; font-size: 22px !important; line-height: 1 !important; }
    .vd-flight-results-v16 .vd-price-v16 a {
        order: 3;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        height: 38px !important;
        min-height: 38px !important;
        margin: 0 !important;
        padding: 0 22px !important;
    }
}
