/**
 * ATX Book-Alt — ride alternatives list.
 *
 * Vertical radio list. Each row is a 4-column / 3-row grid:
 *   row 1: [ radio ] [ icon ] [ title ............... price ]
 *   row 2:                    [ note  (wraps)               ]
 *   row 3:                    [ badge (wraps, severity)     ]
 * Note and badge rows collapse to 0 height when absent.
 *
 * Selected state uses the theme's --are-color brand accent.
 */

.atx-book-alt {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;

    /* Row layout vars — single source of truth. */
    --atx-bka-pad-x:        14px;   /* horizontal padding of .__label  */
    --atx-bka-indicator-w:  22px;   /* 18px content + 2px border each side */
    --atx-bka-icon-w:       32px;
    --atx-bka-col-gap:      12px;
    --atx-bka-stack-gap:    4px;    /* vertical gap between title / note / badge rows */
}

.atx-book-alt__row {
    background: transparent;
}

.atx-book-alt__label {
    display: grid;
    grid-template-columns:
        var(--atx-bka-indicator-w)
        var(--atx-bka-icon-w)
        1fr
        auto;
    grid-template-areas:
        "ind icon title  price"
        ".   .    note   note"
        ".   .    notice notice";
    align-items: center;       /* centres radio + icon + price on row 1 (title row) */
    column-gap: var(--atx-bka-col-gap);
    row-gap: 0;                /* spacing between stacked rows is via margin-top below
                                  so empty rows don't leave a visible gap */
    padding: 10px var(--atx-bka-pad-x);
    cursor: pointer;
    margin: 0;
}

/* Native radio is hidden; we draw our own indicator. */
.atx-book-alt__radio {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
}

.atx-book-alt__indicator {
    grid-area: ind;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #b5b5b5;
    background: #fff;
    position: relative;
    flex: none;
    transition: border-color 120ms ease;
}

.atx-book-alt__row.is-selected .atx-book-alt__indicator {
    border-color: var(--are-color, #E52713);
}

.atx-book-alt__row.is-selected .atx-book-alt__indicator::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--are-color, #E52713);
}

/* Extras are checkboxes (several can be picked): a square box with a white
   tick in the site colour – the vehicles above stay round (one of them). */
.atx-book-alt-extras__row .atx-book-alt__indicator { border-radius: 4px; }
.atx-book-alt-extras__row.is-selected .atx-book-alt__indicator { background: var(--are-color, #E52713); }
.atx-book-alt-extras__row.is-selected .atx-book-alt__indicator::after {
    inset: auto;
    left: 4px;
    top: 0;
    width: 5px;
    height: 10px;
    border-radius: 0;
    background: none;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.atx-book-alt__radio:focus-visible + .atx-book-alt__indicator {
    outline: 2px solid var(--are-color, #E52713);
    outline-offset: 2px;
}

.atx-book-alt__icon {
    grid-area: icon;
    width: var(--atx-bka-icon-w);
    height: var(--atx-bka-icon-w);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.atx-book-alt__icon img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.atx-book-alt__title {
    grid-area: title;
    font-weight: 600;
    color: #1a1a1a;
    min-width: 0;
    overflow-wrap: anywhere;
}

.atx-book-alt__price {
    grid-area: price;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    min-width: 5em;
    text-align: right;
}

/* Note — own row, left-aligned with title, wraps freely. */
.atx-book-alt__note {
    grid-area: note;
    margin-top: var(--atx-bka-stack-gap);
    color: #6a6a6a;
    font-size: 0.9em;
    min-width: 0;
    overflow-wrap: anywhere;
}

.atx-book-alt__empty {
    padding: 14px;
    border: 1px dashed #d8d8d8;
    border-radius: 8px;
    color: #6a6a6a;
    margin: 0;
}

/* When the empty state also carries a __notice--{info|warn|error}
   modifier (tier-driven), it becomes the page-level "banner".
   Two-column grid: narrow text on the left, CTA pill pinned top-right
   on the same row as the title. Stronger left accent (thicker bar)
   set via border-left-width/style here; the colour is supplied by the
   --info/--warn/--error modifier (we deliberately do NOT touch
   border-left-color or color so the modifier wins). */
.atx-book-alt__empty.atx-book-alt__notice {
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left-width: 5px;
    border-left-style: solid;
    padding: 12px 14px 12px 16px;
    border-radius: 6px;
    margin-top: 24px; /* breathing room from the alternatives list above */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: start;
}

/* Stacked notices (primary + advisory tier) — the primary keeps its
   24px gap from the list above; siblings sit closer to the previous
   notice so the advisory reads as an attached note rather than a
   second standalone banner. */
.atx-book-alt__empty.atx-book-alt__notice + .atx-book-alt__empty.atx-book-alt__notice {
    margin-top: 8px;
}

/* Info-severity banner has no CTA pill — collapse the grid to a
   single column and let the title/body span the full notice width
   (overrides the 52ch max-width on .__empty-title/-body below). */
.atx-book-alt__empty.atx-book-alt__notice[data-atx-banner-severity="info"] {
    grid-template-columns: minmax(0, 1fr);
}
.atx-book-alt__empty.atx-book-alt__notice[data-atx-banner-severity="info"] .atx-book-alt__empty-title,
.atx-book-alt__empty.atx-book-alt__notice[data-atx-banner-severity="info"] .atx-book-alt__empty-body {
    max-width: none;
}

.atx-book-alt__empty-title {
    margin: 0 0 4px 0;
    font-size: 1em;
    grid-column: 1;
    max-width: 52ch;
}

.atx-book-alt__empty-body {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.4;
    grid-column: 1;
    max-width: 52ch;
}

.atx-book-alt__empty-cta {
    margin: 0;
    font-size: 0.95em;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
}

/* Support pill — reuses the global .atx-btn--primary palette + hover
   transition (defined in style.css). Locally we just make it a pill
   shape, set the icon/label gap, and pin colours so the notice tier
   palette (red/amber/blue body text) doesn't bleed through. */
.atx-book-alt__empty-call {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    color: #ffffff;
    text-decoration: none;
    line-height: 1;
}

.atx-book-alt__empty-call:hover,
.atx-book-alt__empty-call:focus-visible {
    text-decoration: none;
}

.atx-book-alt__empty-call-icon {
    flex: none;
    display: block;
}

.atx-book-alt__empty-call-label {
    font-weight: 600;
}

/* ============================================================
   Notice (badge) — own row, left-aligned with title, wraps freely.
   The colours are the house notice (.atx-notice--info|warn|error,
   style.css); here only the compact size inside a card.
   Markup: <p class="atx-notice atx-notice--{sev} atx-book-alt__notice atx-book-alt__notice--{sev}">
   ============================================================ */
.atx-book-alt__notice {
    grid-area: notice;
    margin: var(--atx-bka-stack-gap) 0 0 0;
    padding: 6px 10px;
    font-size: 0.875em;
    line-height: 1.35;
    border-left-width: 3px;
    border-radius: 4px;
    overflow-wrap: anywhere;
}

/* Banner-form (.__empty.__notice) palette overrides — higher
   specificity than .__empty's gray default and any descendant <p>
   color inherited from the booking step. The combined selector wins
   the cascade against both .__empty and any later same-tier rule. */
.atx-book-alt__empty.atx-book-alt__notice--info .atx-book-alt__empty-title,
.atx-book-alt__empty.atx-book-alt__notice--info .atx-book-alt__empty-body {
    color: inherit;
}
.atx-book-alt__empty.atx-book-alt__notice--warn .atx-book-alt__empty-title,
.atx-book-alt__empty.atx-book-alt__notice--warn .atx-book-alt__empty-body {
    color: inherit;
}
.atx-book-alt__empty.atx-book-alt__notice--error .atx-book-alt__empty-title,
.atx-book-alt__empty.atx-book-alt__notice--error .atx-book-alt__empty-body {
    color: inherit;
}

/* Narrow screens: slightly smaller icon column, tighter padding and
   column gap, and drop the 5em min-width reservation on the price so
   the vehicle-type caption (".__title") gets every available pixel and
   doesn't wrap to a second line on common phone widths. */
@media (max-width: 520px) {
    .atx-book-alt {
        --atx-bka-icon-w: 28px;
        --atx-bka-col-gap: 8px;
        --atx-bka-pad-x:  10px;
    }

    .atx-book-alt__price {
        /* Size to content — the price string is short ("245 SEK") and
           doesn't need a fixed slot on mobile. */
        min-width: 0;
    }

    /* Banner restructure: collapse the 2-column grid (text | CTA pill)
       into a single column. Title + body get the full banner width and
       the call button drops below them, centered. */
    .atx-book-alt__empty.atx-book-alt__notice {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 12px;
    }

    .atx-book-alt__empty-title,
    .atx-book-alt__empty-body {
        grid-column: 1;
        max-width: none;
    }

    .atx-book-alt__empty-cta {
        grid-column: 1;
        grid-row: auto;
        justify-self: center;
        align-self: center;
        text-align: center;
    }
}

/* ============================================================
   Extras — right cluster (stepper + price) + bottom notice
   ============================================================ */
.atx-book-alt-extras__title-sub {
    color: #6a6a6a;
    font-weight: 400;
    font-size: 0.85em;
    margin-left: 0.35em;
}

.atx-book-alt-extras__right {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

/* The quantity is the house stepper (.atx-stepper, style.css), here in a
   small size. It is always laid out (so the row's geometry is identical
   selected vs. unselected and the title/price don't shift when the user
   ticks the checkbox); it's just hidden until the row is .is-selected. */
.atx-stepper.atx-book-alt-extras__stepper { visibility: hidden; }
.atx-book-alt-extras__row.is-selected .atx-stepper.atx-book-alt-extras__stepper { visibility: visible; }
.atx-stepper.atx-book-alt-extras__stepper > .atx-stepper__btn {
    width: 28px;
    min-height: 28px;
    font-size: 1.05rem;
}
.atx-stepper.atx-book-alt-extras__stepper > .atx-stepper__value {
    min-width: 30px;
    padding: 0 0.4rem;
    font-size: 0.85rem;
}

.atx-book-alt-extras__price {
    min-width: 5.0em;
}

/* Compact qty <select> — alternative to the +/− stepper, shown only
   on ultra-narrow phones (see media query below). Hidden by default
   so the stepper owns the layout on every viewport that can fit it. */
/* The house dropdown --compact (style.css) around the select. */
.atx-book-alt-extras__select {
    display: none;
}

/* ============================================================
   Extras — narrow-screen layout tweaks
   ============================================================
   Hybrid layout on mobile:
     Row 1: [radio][icon] title …… [stepper] [price]
     Row 2:              sub-text (left-aligned with title, wraps)

   The stepper is reserved (visibility:hidden when unselected, see
   above) so nothing shifts on select. Title is single-line with
   ellipsis on tiny screens — long captions truncate instead of
   wrapping under the stepper. */
@media (max-width: 520px) {
    /* Sub-text drops to its own line directly under the title,
       sharing the title cell's left edge. */
    .atx-book-alt-extras__row .atx-book-alt-extras__title-sub {
        display: block;
        margin-left: 0;
        margin-top: 2px;
        line-height: 1.25;
    }

    /* Single-line title with ellipsis when the cell runs out of
       room. min-width:0 is required for ellipsis inside a CSS grid
       cell that started life as 1fr. */
    .atx-book-alt-extras__row .atx-book-alt__title {
        min-width: 0;
        overflow: hidden;
    }
    .atx-book-alt-extras__row .atx-book-alt__title > :first-child,
    .atx-book-alt-extras__row .atx-book-alt__title {
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    /* The sub-text below the title is allowed to wrap freely. */
    .atx-book-alt-extras__row .atx-book-alt-extras__title-sub {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    /* Tighter right cluster: smaller stepper buttons + drop the
       price's 4em reservation so the title cell gets every extra
       pixel. */
    .atx-stepper.atx-book-alt-extras__stepper > .atx-stepper__btn {
        width: 22px;
        font-size: 1rem;
    }
    .atx-stepper.atx-book-alt-extras__stepper > .atx-stepper__value {
        min-width: 26px;
        padding: 0 0.3rem;
    }
    .atx-book-alt-extras__right {
        gap: 2px;
    }
    /* Fixed-width price slot so the price column never shifts when
       a row is selected/deselected or when the value changes. Overrides
       the generic .atx-book-alt__price { min-width: 0 } rule applied to
       step 2 (vehicle rows), which is intentionally shrink-to-fit there.
       3.75em holds "250 kr" (a higher price widens it); narrow so the
       stepper sits far right and leaves the text under the title room. */
    .atx-book-alt-extras__price {
        min-width: 3.75em;
        text-align: right;
    }
}

/* Ultra-narrow phones: swap the +/− stepper for a native qty <select>
   pill. The stepper's ~72px footprint doesn't fit alongside the
   reserved 4.5em price slot on viewports ≤380px; the dropdown is
   ~50px including its chevron and uses the OS-native picker.

   The select only appears once the row is actually selected — there's
   no qty to pick before the user opts in, and hiding it gives the
   title every available pixel in the unselected state. _setExtraQty
   already keeps the select's value in sync (resets to "1" when the
   row is cleared, so it's ready for the next activation). */
@media (max-width: 380px) {
    .atx-stepper.atx-book-alt-extras__stepper {
        /* Don't reserve space — the select fully replaces it here. */
        display: none !important;
    }
    .atx-book-alt-extras__row.is-selected .atx-book-alt-extras__select {
        display: inline-flex;
    }
}
