/*
 * The flight search form, pinned under the site header on the SRPs.
 *
 * This file is only the shell — position, layering and the slide-in. The form
 * inside it is FlightSearchFormV3's compact variant, styled in
 * flight-search-v3.css alongside the default one.
 */

/* Zero-height marker left where the hero panel ends. It is what the observer
   watches, so it must stay in normal flow — it cannot be display:none. */
.flight-sticky-sentinel {
    height: 0;
    margin: 0;
    pointer-events: none;
}

.flight-sticky-bar {
    position: fixed;
    /* Measured from the real header at runtime and published by the component.
       The literal is a fallback for the frame before the first measurement —
       and `.wrapper`'s own padding is 62/50/47px across three breakpoints, so
       no single literal would have been right anyway. */
    top: var(--flight-header-h, 62px);
    left: 0;
    right: 0;
    /*
     * Between Bootstrap's two layers, on purpose.
     *
     * The filter sidebar uses `.sticky-top` ($zindex-sticky: 1020) and sits
     * after this bar in the DOM, so at an equal z-index it would paint over the
     * dropdowns that open out of this form. The site header is `.fixed-top`
     * ($zindex-fixed: 1030) and must stay above this. 1025 is the only gap.
     */
    z-index: 1025;
    background: var(--color-white);
    border-bottom: 1px solid var(--bs-border-color);
    box-shadow: 0 4px 16px rgba(15, 39, 51, 0.08);
    /* Slides down rather than appearing: the bar arrives because the traveller
       scrolled, and motion tied to that reads as the page responding. */
    transform: translateY(-100%);
    opacity: 0;
    transition: transform .22s ease, opacity .22s ease;
}

.flight-sticky-bar.is-pinned {
    transform: translateY(0);
    opacity: 1;
}

/*
 * Deliberately not a scroll container.
 *
 * `overflow` establishes a clipping context, and every panel in the form
 * (airports, travellers) is `position: absolute` inside its own `.fs-field`.
 * Capping the height here trapped all of them: they rendered inside the bar and
 * had to be scrolled to, instead of opening over the results.
 *
 * Letting them overflow costs nothing — they are absolutely positioned, so they
 * add no height here. The bar stays as tall as its fields and the panels paint
 * over the results below.
 */
.flight-sticky-bar__inner {
    position: relative;
}

@media (prefers-reduced-motion: reduce) {
    .flight-sticky-bar { transition: none; }
}

/* ── Which layout the pinned bar shows ────────────────────────────────────
 *
 * The split is at lg, not at a phone width, because the compact form stops
 * being compact well before a phone: its row wraps below 1200px and its cells
 * go full width below 576px. Left alone at tablet widths it is a stacked form
 * inside a fixed bar, which is the overlap this replaces — just less of it.
 */
.flight-sticky-bar__narrow { display: none; }

@media (max-width: 991.98px) {
    .flight-sticky-bar__wide { display: none; }
    .flight-sticky-bar__narrow { display: block; }

    /*
     * Sticky, not fixed, below lg — and that difference is load-bearing.
     *
     * Fixed costs no layout space, which is correct on desktop where the bar
     * only appears once the hero has scrolled past and it is meant to overlay
     * the list. Below lg the hero is hidden, so this bar is the top of the
     * page: fixed would leave it hovering over the first results with nothing
     * reserving room for it. Sticky puts it in normal flow, so the results
     * start beneath it and pin under the site header on scroll.
     *
     * Always on screen too — no slide-in, since it did not arrive because
     * anyone scrolled.
     */
    .flight-sticky-bar {
        position: sticky;
        top: var(--flight-header-h, 62px);
        transform: none;
        opacity: 1;
        transition: none;
    }
}

/* ── The summary itself ───────────────────────────────────────────────── */

.flight-summary-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.flight-summary-bar__text {
    /* min-width:0 is what lets the two lines below actually truncate: a flex
       item defaults to min-content, so without it a long city pair widens the
       row and pushes Edit off the screen instead of ellipsising. */
    flex: 1 1 auto;
    min-width: 0;
}

.flight-summary-bar__route,
.flight-summary-bar__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flight-summary-bar__route {
    font-family: var(--font-family-inter);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text-black, #13253a);
}

.flight-summary-bar__meta {
    font-family: var(--font-family-inter);
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--color-grey, #7c7c7c);
    margin-top: 2px;
}

.flight-summary-bar__edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    /* 44px of height: the touch-target floor, which a 17px icon and 12px label
       do not reach on their own. */
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--color-first);
    border-radius: 999px;
    background: transparent;
    color: var(--color-first);
    font-family: var(--font-family-inter);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

/* ── The edit drawer ──────────────────────────────────────────────────── */

/*
 * Dimmed results behind the drawer.
 *
 * The point of the dim is that the list is still *there*: the traveller is
 * amending a search, not navigating away, and a drawer over a visible page
 * says that where a full white screen says the opposite.
 */
.flight-edit-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1039;
    background: rgba(15, 39, 51, 0.45);
    opacity: 0;
    transition: opacity 0.26s ease;
}

.flight-edit-backdrop.is-open {
    opacity: 1;
}

.flight-edit-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Above the site header (1030) and the bar it opened from: a drawer with
       the header still painted over it reads as a stuck page. */
    z-index: 1040;
    /* Only as tall as the form needs, capped so the dimmed results always show
       beneath it — that strip of page is what makes this read as a drawer
       rather than a new screen. */
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 12px 32px rgba(15, 39, 51, 0.22);
    /* Starts just above its own top edge and slides down into place. */
    transform: translateY(-100%);
    transition: transform 0.26s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.flight-edit-sheet.is-open {
    transform: translateY(0);
}

/*
 * The transform is dropped once the drawer has arrived, and that is a fix, not
 * a tidy-up.
 *
 * A transformed ancestor becomes the containing block for `position: fixed`
 * descendants, and mobile browsers anchor a native <select>'s popup against it
 * too — which is why the Cabin Class menu opened detached from its field. An
 * identity transform is enough to cause it, so it cannot simply be left on.
 *
 * Safe to animate through: `none` and `translateY(0)` are visually identical,
 * and a transition from either to `translateY(-100%)` still runs, so closing
 * animates whether or not this class is on.
 */
.flight-edit-sheet.is-settled {
    transform: none;
    will-change: auto;
}

/* Motion here is decoration on top of an instant state change, so it is the
   whole animation that goes — not a shortened version of it. The drawer still
   appears and disappears; the JS close timer simply runs against no movement. */
@media (prefers-reduced-motion: reduce) {
    .flight-edit-backdrop,
    .flight-edit-sheet {
        transition: none;
    }
}

.flight-edit-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bs-border-color);
    flex: 0 0 auto;
}

.flight-edit-sheet__title {
    font-family: var(--font-family-inter);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-black, #13253a);
}

.flight-edit-sheet__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-inline-end: -8px;
    border: 0;
    background: transparent;
    color: var(--color-text-black, #13253a);
    cursor: pointer;
}

/* Smart Filters' best guess when it opened this sheet — an info banner, not
   an applied change: nothing below it is touched until the traveller edits
   the real fields themselves. Reuses the same info-box palette as the review
   page's flight-detail callouts, for one consistent "here's a note" look. */
.flight-edit-sheet__seed-banner {
    margin: 12px 16px 0;
    padding: 10px 12px;
    border: 1px solid var(--review-flight-info-border, #bfdbfe);
    background: var(--review-flight-info-bg, #eff6ff);
    color: var(--review-flight-blue, #147ad6);
    border-radius: 8px;
    font-family: var(--font-family-inter);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.flight-edit-sheet__body {
    flex: 1 1 auto;
    /*
     * This scrolls, unlike the desktop bar — a stacked form on a phone is
     * taller than the screen and the Search button has to stay reachable.
     *
     * But `overflow` is a clipping context, and the form's panels are
     * `position: absolute` inside their own field, so scrolling here traps
     * them exactly as the note above .flight-sticky-bar__inner warns. The
     * panels are therefore taken out of absolute positioning below and expand
     * in flow instead: nothing to clip, and the drawer scrolls to whatever
     * opened.
     */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px 20px;
}

/*
 * Panels expand in place rather than floating over the drawer.
 *
 * An absolutely-positioned panel inside a scroll container can only ever be
 * clipped by it or escape it, and escaping means re-deriving its position in
 * JS on every scroll. In flow it simply pushes the fields below it down and
 * the drawer scrolls, which is also how a phone-sized picker is expected to
 * behave.
 *
 * Its own `max-height` goes too: a scroll area inside a scroll area is
 * miserable on touch, and the drawer is already the thing that scrolls.
 */
.flight-edit-sheet .fs-dropdown {
    position: static;
    min-width: 0;
    max-width: none;
    max-height: none;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--bs-border-color);
    box-shadow: none;
}

/*
 * Field typography inside the drawer.
 *
 * The form's sizes are set for the hero panel, where a field is one of six
 * across a wide band. Stacked full-width on a phone the same sizes leave each
 * row taller than it needs to be, so the drawer runs out of screen before the
 * Search button — which is exactly what pushed that button out of reach.
 * Scoped to the drawer so the hero panel and the desktop bar are untouched.
 */
.flight-edit-sheet .fs-trigger {
    min-height: 56px;
    padding: 8px 14px;
}

.flight-edit-sheet .fs-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-grey, #7c7c7c);
}

.flight-edit-sheet .fs-value {
    font-size: 15px;
}

.flight-edit-sheet .fs-sub {
    font-size: 11px;
}

.flight-edit-sheet .fs-head {
    margin-bottom: 2px;
}
