/*
 * Nearby-dates strip on the flight SRP.
 *
 * Colocated and imported by the component rather than added to the global
 * sheets, following flight-search-v3.css next door: these rules describe one
 * widget on two routes and have no business loading on the other forty.
 *
* Borders use Bootstrap's --bs-border-color, the same variable the `border`
 * utility resolves to everywhere else here, so the strip matches the cards it
 * sits above in both themes.
 *
 * The strip sits on the results background in both
 * themes, and hardcoding either the surface or the accent would make it the one
 * element on the page that does not follow light-dark().
 */

.flight-date-strip {
    background: var(--color-white);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    overflow: hidden;
}

/* The seven cells are wider than a phone. They scroll inside the strip rather
   than widening the page — the component centres the selected one on mount. */
.flight-date-strip__scroller {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
}
.flight-date-strip__scroller::-webkit-scrollbar {
    display: none;
}

.flight-date-strip__cell {
    flex: 1 0 auto;
    min-width: 7.5rem;
    /* 44px is the minimum comfortable touch target; the two stacked lines and
       this padding clear it with room to spare. */
    padding: 0.625rem 0.75rem;
    text-align: center;
    text-decoration: none;
    /* Transparent, not none: the selected cell swaps the colour in, and a cell
       that only grows a border on selection would shift its neighbours. */
    border-bottom: 3px solid transparent;
    transition: background-color .2s ease;
}

.flight-date-strip__cell + .flight-date-strip__cell {
    border-left: 1px solid var(--bs-border-color);
}

.flight-date-strip__cell:hover {
    background: var(--color-blue-light3);
}

.flight-date-strip__cell:focus-visible {
    outline: 2px solid var(--color-first);
    outline-offset: -2px;
}

.flight-date-strip__date {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-content);
    white-space: nowrap;
}

/*
 * The second line of a cell: a skeleton, a price, or "View".
 *
 * One slot for all three, at one fixed height. Prices arrive from a separate
 * Amadeus call that lands ten seconds or so after the results list, and a strip
 * that grew or shrank at that moment would shove the whole list down — on
 * mobile it is pinned chrome, so it would shove it under the user's thumb
 * mid-scroll.
 *
 * `1.5em` resolves against this element's own 0.8125rem, which is exactly the
 * line box "View" occupied before prices existed. The strip's height is
 * therefore unchanged by this feature, in either state.
 */
.flight-date-strip__slot {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    font-size: 0.8125rem;
    line-height: 1.5;
    min-height: 1.5em;
}

/* The number the traveller is comparing across seven cells: near-black and
   heavier than the date above it, so the row scans as prices rather than as
   two rows of similar grey text. Deliberately not the accent — colour here is
   reserved for "View", which is an action rather than a value. */
.flight-date-strip__price {
    font-weight: 700;
    color: var(--color-dark);
    white-space: nowrap;
}

/* Unchanged: the fallback for a date the airline never priced, and for a
   calendar call that did not answer. */
.flight-date-strip__action {
    color: var(--color-second);
}

.flight-date-strip__cell.is-selected {
    background: var(--color-blue-light3);
    border-bottom-color: var(--color-second);
}

.flight-date-strip__cell.is-selected .flight-date-strip__date {
    color: var(--color-first);
    font-weight: 700;
}

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

/*
 * Pinned under the search summary on phones and tablets.
 *
 * Below lg the summary bar replaces the form, and the date strip is the only
 * way to move off the chosen date without opening it — so it follows the
 * traveller down the list rather than scrolling away with the first result.
 * `--flight-chrome-h` is header + summary bar, measured and published by
 * FlightSearchStickyBar, so this lands directly beneath it at any header
 * height rather than guessing one.
 *
 * Desktop is deliberately unchanged: the form itself stays pinned there, and a
 * third sticky row would eat the screen the results need.
 */
@media (max-width: 991.98px) {
    /*
     * The COLUMN is what sticks, not the strip inside it — and that is the
     * whole fix.
     *
     * A sticky element can only travel within its own containing block, and
     * the strip's is this column, which wraps nothing but the strip. Sticking
     * the strip therefore pinned it to a box exactly its own height: it moved
     * zero pixels and scrolled away with the grid. The column's containing
     * block is the results row, which spans every flight card, so pinning here
     * gives it the whole list to travel down.
     */
    .flight-date-strip-col {
        position: sticky;
        top: var(--flight-chrome-h, 110px);
        /* Under the search bar (1025), above the cards it scrolls over. */
        z-index: 1020;

        /*
         * Edge to edge, like the summary bar above it.
         *
         * Both are pinned chrome, and a full-width band under an inset card
         * reads as two unrelated things. The column sits inside a padded
         * container *and* a gutter, so cancelling either one alone still
         * leaves it short — this spans the viewport regardless of how its
         * ancestors are padded. The padding is then put back inside, so the
         * cells keep their inset while the band does not.
         */
        width: 100vw;
        max-width: 100vw;
        margin-inline: calc(50% - 50vw);
        padding-inline: 12px;
        padding-block: 6px;
        background: var(--color-white);
        box-shadow: 0 4px 12px rgba(15, 39, 51, 0.08);
    }

    .flight-date-strip-col .flight-date-strip {
        /* The band is the card now. Dropping the strip's own frame stops it
           reading as a card inside a card, and the shadow moves to the column
           above so it spans the full width too. */
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }
}
