/**
 * Booking V3 – popup layout.
 *
 * <dialog class="bsv3 bsv3-dialog"> state attributes set by components/shell.js:
 *   data-basket  "1" ledger aside / bottom-bar basket visible
 *   data-count   number of basket positions ("0" hides the basket summary)
 *   data-footer  "1" when the step has a CTA
 *   data-history "0" on the first step (back buttons hidden)
 *   data-step, data-system
 *
 * Desktop >= 1100: modal, header 84px with dots stepper, body grid main + 340px ledger.
 * Tablet 768–1099: modal 96vw × 94vh, single column (760 max), bottom bar, drawer.
 * Phone <= 767: full screen, app bar + progress line, bottom bar, bottom sheet drawer.
 */

/* ------------------------------------------------------------------ dialog */

.bsv3.bsv3-dialog {
    position: fixed;
    inset: 0;
    width: min(1320px, 94vw);
    height: min(920px, 92vh);
    height: min(920px, 92dvh);
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--bs-r-modal);
    background: var(--bs-surface);
    color: var(--bs-text);
    box-shadow: var(--bs-shadow-modal);
    overflow: hidden;
    overscroll-behavior: contain;
}

.bsv3.bsv3-dialog[open] {
    display: block;
    animation: bsv3-dialog-in var(--bs-motion) var(--bs-ease);
}

.bsv3.bsv3-dialog::backdrop {
    background: rgba(0, 0, 0, 0.75);
    background: var(--bs-backdrop, rgba(0, 0, 0, 0.75));
}

.bsv3.bsv3-dialog[open]::backdrop {
    animation: bsv3-fade-in 220ms ease-out;
}

@keyframes bsv3-dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
}

@keyframes bsv3-fade-in {
    from {
        opacity: 0;
    }
}

.bsv3 .bsv3-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--bs-surface);
}

/* ------------------------------------------------------------------ header (desktop, tablet) */

.bsv3 .bsv3-header {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 250px;
    align-items: center;
    gap: 40px;
    height: var(--bs-header-h);
    padding: 0 24px;
    background: var(--bs-surface);
    border-bottom: 1px solid var(--bs-line);
}

.bsv3 .bsv3-header__start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.bsv3 .bsv3-header__end {
    display: flex;
    justify-content: flex-end;
}

.bsv3 .bsv3-brand {
    min-width: 0;
    overflow: hidden;
    font-size: var(--bs-fs-xs);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-lead);
}

.bsv3.bsv3-dialog[data-history="0"] .bsv3-header__back {
    display: none;
}

/* dots stepper */

.bsv3 .bsv3-stepper {
    min-width: 0;
}

.bsv3 .bsv3-stepper__list {
    display: flex;
    align-items: flex-start;
}

.bsv3 .bsv3-stepper__item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.bsv3 .bsv3-stepper__item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 5px;
    left: calc(50% + 14px);
    right: calc(-50% + 14px);
    height: 2px;
    border-radius: 1px;
    background: var(--bs-line);
    transition: background-color var(--bs-motion) var(--bs-ease);
}

.bsv3 .bsv3-stepper__item.is-done:not(:last-child)::after {
    background: var(--bs-lead);
}

.bsv3 .bsv3-stepper__dot {
    display: block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--bs-line);
    border-radius: 50%;
    background: var(--bs-surface);
    transition: background-color var(--bs-motion) var(--bs-ease), border-color var(--bs-motion) var(--bs-ease);
}

.bsv3 .bsv3-stepper__item:is(.is-done, .is-current) .bsv3-stepper__dot {
    border-color: var(--bs-lead);
    background: var(--bs-lead);
}

.bsv3 .bsv3-stepper__item.is-current .bsv3-stepper__dot {
    box-shadow: 0 0 0 4px rgba(73, 95, 118, 0.14);
}

.bsv3 .bsv3-stepper__label {
    max-width: 100%;
    overflow: hidden;
    font-size: var(--bs-fs-xs);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-stepper__item:is(.is-done, .is-current) .bsv3-stepper__label {
    color: var(--bs-lead);
}

.bsv3 .bsv3-stepper__item.is-current .bsv3-stepper__label {
    font-weight: 700;
}

/* ------------------------------------------------------------------ app bar + progress line (phone) */

.bsv3 .bsv3-appbar {
    display: none;
    flex-shrink: 0;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    height: calc(var(--bs-appbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 6px 0;
    background: var(--bs-surface);
    border-bottom: 1px solid var(--bs-line);
}

.bsv3 .bsv3-appbar__title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-lead);
}

.bsv3.bsv3-dialog[data-history="0"] .bsv3-appbar__back {
    visibility: hidden;
}

.bsv3 .bsv3-progress-line {
    display: none;
    flex-shrink: 0;
    padding: 10px 16px 0;
}

.bsv3 .bsv3-progress-line:empty {
    display: none;
}

.bsv3 .bsv3-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bsv3 .bsv3-progress__text {
    display: flex;
    gap: 6px;
    min-width: 0;
    font-size: 12px;
    line-height: 1.3;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-progress__step {
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--bs-lead);
}

.bsv3 .bsv3-progress__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bsv3 .bsv3-progress__bar {
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--bs-tint);
}

.bsv3 .bsv3-progress__fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background: var(--bs-lead);
    transform: scaleX(var(--bsv3-progress, 0));
    transform-origin: left center;
    transition: transform var(--bs-motion) var(--bs-ease);
}

/* ------------------------------------------------------------------ offline banner */

.bsv3 .bsv3-offline {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bs-warn-bg);
    color: var(--bs-warn);
    font-size: var(--bs-fs-small);
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

/* ------------------------------------------------------------------ body: main + ledger */

.bsv3 .bsv3-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.bsv3 .bsv3-main {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-top: var(--bs-pad);
    background: var(--bs-surface);
}

.bsv3 .bsv3-main__inner {
    display: flex;
    flex-direction: column;
    gap: var(--bs-gap);
    width: 100%;
    min-height: 100%;
    margin-inline: auto;
    padding: var(--bs-pad);
}

.bsv3 .bsv3-stephead {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bsv3 .bsv3-title {
    font-size: var(--bs-fs-title);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: var(--bs-ls-title);
    text-transform: uppercase;
    color: var(--bs-lead);
    -webkit-hyphens: auto;
    hyphens: auto;
}

.bsv3 .bsv3-lead {
    max-width: 72ch;
    font-size: var(--bs-fs-body);
    line-height: var(--bs-lh-body);
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-step {
    display: flex;
    flex-direction: column;
    gap: var(--bs-gap);
    min-width: 0;
}

.bsv3 .bsv3-ledger {
    display: none;
}

.bsv3 .bsv3-ledger__panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.bsv3 .bsv3-ledger__cta {
    flex-shrink: 0;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--bs-line);
}

/* ------------------------------------------------------------------ CTA slots */

.bsv3 .bsv3-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bsv3 .bsv3-cta:empty {
    display: none;
}

.bsv3 :is(.bsv3-ledger__cta, .bsv3-drawer__cta) {
    flex-direction: column-reverse;
    align-items: stretch;
}

/* footer hint next to the CTA (ledger, drawer), e.g. the missing terms consent on the summary;
   last in the DOM, so column-reverse shows it above the button */
.bsv3 .bsv3-cta__hint {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: var(--bs-fs-small);
    line-height: 1.45;
    color: var(--bs-muted-text);
}

.bsv3 .bsv3-cta__hint .bsv3-icon {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--bs-lead);
}

.bsv3 :is(.bsv3-ledger__cta, .bsv3-drawer__cta) .bsv3-btn {
    width: 100%;
}

/* ------------------------------------------------------------------ bottom bar */

.bsv3 .bsv3-bar {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--bs-bar-h);
    padding: 10px 24px;
    background: var(--bs-surface);
    border-top: 1px solid var(--bs-line);
    box-shadow: var(--bs-shadow-bar);
}

.bsv3 .bsv3-bar__cta {
    margin-left: auto;
}

.bsv3 .bsv3-bar__basket {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: var(--bs-tap);
    padding: 4px 10px 4px 4px;
    border-radius: var(--bs-r-control);
    text-align: left;
    color: var(--bs-text);
    transition: background-color var(--bs-motion-fast) var(--bs-ease);
}

.bsv3 .bsv3-bar__basket:hover {
    background: var(--bs-tint);
}

.bsv3 .bsv3-bar__bag {
    position: relative;
    display: inline-flex;
    padding: 6px 8px 0 0;
    color: var(--bs-lead);
}

.bsv3 .bsv3-bar__count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--bs-lead);         /* white 11px text: --bs-secondary is only 2.9:1 */
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.bsv3 .bsv3-bar__sums {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.bsv3 .bsv3-bar__total {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--bs-lead);
    font-variant-numeric: tabular-nums;
}

.bsv3 .bsv3-bar__meta {
    overflow: hidden;
    font-size: var(--bs-fs-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-muted-text);
}

.bsv3.bsv3-dialog:is([data-basket="0"], [data-count="0"]) .bsv3-bar__basket,
.bsv3.bsv3-dialog[data-history="0"] .bsv3-bar__back {
    display: none;
}

/* ------------------------------------------------------------------ drawer (tablet, phone) */

.bsv3 .bsv3-drawer {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: block;
}

.bsv3 .bsv3-drawer__scrim {
    position: absolute;
    inset: 0;
    background: var(--bs-scrim);
    opacity: 0;
    transition: opacity var(--bs-motion) var(--bs-ease);
}

.bsv3 .bsv3-drawer__sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100% - 48px);
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: var(--bs-r-sheet) var(--bs-r-sheet) 0 0;
    background: var(--bs-surface);
    box-shadow: var(--bs-shadow-sheet);
    transform: translateY(100%);
    transition: transform var(--bs-motion) var(--bs-ease);
}

.bsv3 .bsv3-drawer[data-state="open"] .bsv3-drawer__scrim {
    opacity: 1;
}

.bsv3 .bsv3-drawer[data-state="open"] .bsv3-drawer__sheet {
    transform: translateY(0);
}

.bsv3 .bsv3-drawer__handle {
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    margin: 0 auto;
    border-radius: 2px;
    background: var(--bs-line-600);
}

.bsv3 .bsv3-drawer__panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.bsv3 .bsv3-drawer__cta {
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ toasts */

.bsv3 .bsv3-toasts {
    position: absolute;
    z-index: 30;
    left: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(420px, calc(100% - 48px));
    pointer-events: none;
}

.bsv3.bsv3-dialog[data-basket="0"][data-footer="1"] .bsv3-toasts {
    bottom: calc(var(--bs-bar-h) + 16px);
}

.bsv3.bsv3-toasts--page {
    position: fixed;
    z-index: 100000;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
}

/* While the drawer is open, toasts live inside its sheet (focus trap, aria-modal) between the lines and
   the CTA instead of floating over it. */
.bsv3 .bsv3-drawer__sheet .bsv3-toasts--sheet {
    position: static;
    z-index: auto;
    width: auto;
    flex-shrink: 0;
}

.bsv3 .bsv3-toasts--sheet:empty {
    display: none;
}

/* ------------------------------------------------------------------ desktop >= 1100 */

@media (min-width: 1100px) {
    .bsv3.bsv3-dialog[data-basket="1"] .bsv3-body {
        grid-template-columns: minmax(0, 1fr) var(--bs-ledger-w);
    }

    .bsv3.bsv3-dialog[data-basket="1"] .bsv3-ledger {
        display: flex;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
        background: var(--bs-surface);
        border-left: 1px solid var(--bs-line);
    }

    .bsv3.bsv3-dialog[data-basket="0"] .bsv3-main__inner {
        max-width: 960px;
    }

    .bsv3 .bsv3-bar {
        padding: 0 var(--bs-pad);
        box-shadow: none;
    }

    .bsv3 .bsv3-bar :is(.bsv3-bar__back, .bsv3-bar__basket),
    .bsv3 .bsv3-drawer {
        display: none;
    }

    .bsv3.bsv3-dialog:is([data-basket="1"], [data-footer="0"]) .bsv3-bar {
        display: none;
    }
}

/* ------------------------------------------------------------------ tablet 768–1099 */

@media (max-width: 1099px) {
    .bsv3.bsv3-dialog {
        width: 96vw;
        height: 94vh;
        height: 94dvh;
    }

    .bsv3 .bsv3-header {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 24px;
        padding: 0 16px;
    }

    .bsv3 .bsv3-header__back {
        display: none;
    }

    .bsv3 .bsv3-brand {
        max-width: 180px;
    }

    .bsv3 .bsv3-main__inner {
        max-width: 760px;
    }

    .bsv3 .bsv3-bar {
        padding: 10px 16px;
    }

    .bsv3 .bsv3-bar__cta .bsv3-btn--primary,
    .bsv3 .bsv3-bar__cta .bsv3-btn--confirm {
        height: var(--bs-btn-h-lg);
        padding: 0 28px;
        font-size: 16px;
    }

    .bsv3.bsv3-dialog[data-footer="0"][data-history="0"]:is([data-basket="0"], [data-count="0"]) .bsv3-bar {
        display: none;
    }

    @media (min-width: 768px) {
        .bsv3 .bsv3-drawer__sheet {
            left: 50%;
            right: auto;
            width: min(760px, 100%);
            transform: translate(-50%, 100%);
        }

        .bsv3 .bsv3-drawer[data-state="open"] .bsv3-drawer__sheet {
            transform: translate(-50%, 0);
        }
    }
}

/* ------------------------------------------------------------------ phone <= 767 */

@media (max-width: 767px) {
    .bsv3.bsv3-dialog {
        inset: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .bsv3 .bsv3-header {
        display: none;
    }

    .bsv3 .bsv3-appbar {
        display: grid;
    }

    .bsv3 .bsv3-progress-line {
        display: block;
    }

    .bsv3 .bsv3-bar {
        min-height: 0;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    /* 0,3,0: components.css (loaded later) sets .bsv3 .bsv3-btn { display: inline-flex } at 0,2,0; the app bar has the back arrow */
    .bsv3 .bsv3-bar .bsv3-bar__back {
        display: none;
    }

    .bsv3 .bsv3-bar__cta .bsv3-btn--primary,
    .bsv3 .bsv3-bar__cta .bsv3-btn--confirm {
        height: var(--bs-btn-h-md);
        padding: 0 18px;
        font-size: 14px;
    }

    .bsv3.bsv3-dialog:is([data-basket="0"], [data-count="0"]) .bsv3-bar__cta {
        flex: 1 1 auto;
        margin-left: 0;
    }

    .bsv3.bsv3-dialog:is([data-basket="0"], [data-count="0"]) .bsv3-bar__cta .bsv3-cta__primary {
        flex: 1 1 auto;
    }

    .bsv3.bsv3-dialog[data-footer="0"]:is([data-basket="0"], [data-count="0"]) .bsv3-bar {
        display: none;
    }

    .bsv3 .bsv3-toasts {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: calc(var(--bs-bar-h) + 12px + env(safe-area-inset-bottom, 0px));
    }

    .bsv3.bsv3-toasts--page {
        left: 16px;
        right: 16px;
        transform: none;
    }
}

@media (min-width: 768px) and (max-width: 1099px) {
    .bsv3 .bsv3-toasts {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: calc(var(--bs-bar-h) + 12px);
    }
}

/* ------------------------------------------------------------------ narrow phones <= 420 */

@media (max-width: 420px) {
    /* the bag badge already shows the count and the drawer shows the duration: the CTA gets the room */
    .bsv3 .bsv3-bar {
        gap: 8px;
    }

    .bsv3 .bsv3-bar .bsv3-bar__meta {
        display: none;
    }

    .bsv3 .bsv3-bar__basket {
        padding-right: 6px;
    }

    .bsv3 .bsv3-bar__cta {
        min-width: 0;
    }

    .bsv3 .bsv3-bar__cta .bsv3-btn--primary,
    .bsv3 .bsv3-bar__cta .bsv3-btn--confirm {
        padding: 0 16px;
        font-size: 13px;
    }
}

/* ------------------------------------------------------------------ phone toasts: action on its own row */

@media (max-width: 767px) {
    .bsv3 .bsv3-toast {
        flex-wrap: wrap;
        row-gap: 0;
    }

    .bsv3 .bsv3-toast__icon {
        order: 0;
    }

    /* 0,3,0: components.css (loaded after this file) sets flex: 1 1 auto on .bsv3 .bsv3-toast__text */
    .bsv3 .bsv3-toast .bsv3-toast__text {
        order: 1;
        flex: 1 1 0;
    }

    .bsv3 .bsv3-toast .bsv3-toast__close {
        order: 2;
    }

    /* line break between the message row and the action */
    .bsv3 .bsv3-toast::after {
        content: "";
        order: 3;
        flex-basis: 100%;
    }

    .bsv3 .bsv3-toast__action {
        order: 4;
        margin: 0 0 4px 18px;
    }
}
