/**
 * Airline ticket cards.
 *
 * Columns, left to right: journey, fare facts, optional cabin photo (same slot as
 * the charter aircraft photo), then price. The route grid fills its column so
 * departure sits on the left edge and arrival against the fare divider — the same
 * span as the carrier / product head above it. Stretching only within the routes
 * column (not across the whole card) keeps the two ends readable as one journey.
 *
 * The dividers are hairlines, not panels. Nothing on this card is a coloured pill:
 * a badge that appears on every card carries no information, and five of them in a
 * row read as decoration. Emphasis is carried by type size and one accent colour.
 *
 * Built on the site's own tokens, so both themes follow without a second
 * definition. Responsive rules live in tbo-ticket-card-responsive*.css.
 */

.tbo-ticket-list {
    display: flex;
    flex-direction: column;
    gap: 22px;

    /* Compact rules key off list width, not the viewport — a narrow results
       column on a wide screen must not keep the three-column desktop grid. */
    container-type: inline-size;
    container-name: tbo-tickets;
}

.tbo-ticket-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/*
 * Tablet results grid — same band and tracks as `.flights-list` in
 * flight-cards-apple.css. The ticket block spans the full row; each cabin
 * section lays its own cards out two-up so tiers never interleave.
 */
@media (min-width: 769px) and (max-width: 1024px) {
    .flights-list > .tbo-ticket-block,
    .bookmarks-list > .tbo-ticket-block,
    .flights-list > .tbo-ticket-list,
    .bookmarks-list > .tbo-ticket-list {
        grid-column: 1 / -1;
    }

    .flights-list > .tbo-ticket-block > .tbo-ticket-list > .tbo-ticket-section,
    .bookmarks-list > .tbo-ticket-block > .tbo-ticket-list > .tbo-ticket-section,
    .flights-list > .tbo-ticket-list > .tbo-ticket-section,
    .bookmarks-list > .tbo-ticket-list > .tbo-ticket-section {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        align-items: start;
    }

    .flights-list .tbo-ticket-section > .tbo-ticket-heading,
    .bookmarks-list .tbo-ticket-section > .tbo-ticket-heading {
        grid-column: 1 / -1;
    }

    .flights-list .tbo-ticket-section > .tbo-ticket-card,
    .bookmarks-list .tbo-ticket-section > .tbo-ticket-card {
        min-width: 0;
    }
}

/* Heading — cabin-tier label in the same panel language as ticket controls. */
.tbo-ticket-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 0.5px solid rgba(60, 60, 67, 0.14);
    border-radius: 16px;
    background: var(--color-surface);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.045),
        0 1px 2px rgba(0, 0, 0, 0.025);
}

:root[data-theme="dark"] .tbo-ticket-heading {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(28, 30, 36, 0.52);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(22px) saturate(120%);
    -webkit-backdrop-filter: blur(22px) saturate(120%);
}

.tbo-ticket-heading__title {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--color-text);
}

/* Keep one line; emphasize brand certification inside the title, not above it. */
.tbo-ticket-heading--certified {
    border-color: rgba(68, 93, 239, 0.55);
    border-width: 1px;
}

:root[data-theme="dark"] .tbo-ticket-heading--certified {
    border-color: rgba(68, 93, 239, 0.6);
}

.tbo-ticket-heading--certified .tbo-ticket-heading__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.35em;
}

.tbo-ticket-heading__mark {
    color: var(--primary-dark, #2f40c2);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.tbo-ticket-heading__sep {
    color: var(--color-text-muted);
    font-weight: 500;
}

.tbo-ticket-heading__product {
    color: var(--color-text);
    font-weight: 600;
}

.tbo-ticket-heading__note {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

@media (max-width: 480px) {
    .tbo-ticket-heading {
        padding: 12px 14px;
    }

    .tbo-ticket-heading__title {
        font-size: 17px;
    }
}

.tbo-ticket-card {
    /* Brand teal — same primary as the rest of the product surface. */
    --tt-accent: #445def;
    --tt-accent-soft: rgba(68, 93, 239, 0.1);
    --tt-accent-line: rgba(68, 93, 239, 0.28);
    --tt-bg: var(--color-surface);
    --tt-border: rgba(60, 60, 67, 0.14);
    --tt-hairline: rgba(60, 60, 67, 0.12);
    --tt-good: #157f52;
    --tt-warn: #9a5b00;
    --tt-alert: #b3261e;
    --tt-radius: 18px;

    display: grid;

    /* Same three tracks as charter: route | detail (facts+photo) | price. */
    grid-template:
        "head fare aside" auto
        "routes fare aside" 1fr
        / minmax(0, 1.15fr) minmax(210px, 1.2fr) minmax(168px, 188px);
    column-gap: 24px;

    --tt-cabin-photo-radius: var(--fc-aircraft-photo-radius, 14px);

    padding: 18px 20px;
    color: var(--color-text);
    background: var(--tt-bg);
    border: 0.5px solid var(--tt-border);
    border-radius: var(--tt-radius);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.tbo-ticket-card:hover {
    border-color: var(--tt-accent-line);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 0 1px var(--tt-accent-line);
}

/*
 * With a cabin photo: mirror the charter aircraft column —
 * facts on the left, 4:3 photo on the right. Photo max stays ~38% so its
 * absolute width matches the prior 46%-of-narrower-detail size; the wider
 * detail track goes to the facts column. Do not steal a fourth column.
 */
.tbo-ticket-card--has-cabin-photo .tbo-ticket__fare {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(104px, 38%);
    column-gap: 16px;
    align-items: center;
}

.tbo-ticket__fare-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.tbo-ticket__cabin-photo {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    width: 100%;
    min-width: 0;
    height: 100%;
}

.tbo-ticket__cabin-photo-frame {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--tt-cabin-photo-radius);
    background: #f2f2f7;
    box-shadow: inset 0 0 0 0.5px rgba(60, 60, 67, 0.1);
}

:root[data-theme='dark'] .tbo-ticket__cabin-photo-frame {
    background: rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

.tbo-ticket__cabin-photo-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
    cursor: zoom-in;
}

@media (hover: hover) and (pointer: fine) {
    .tbo-ticket__cabin-photo-img:hover {
        filter: brightness(1.03);
    }
}

/* Who flies it, and what kind of fare this is. */

.tbo-ticket__head {
    grid-area: head;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding-bottom: 14px;
}

.tbo-ticket__carrier {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tbo-ticket__airline-marks {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
}

.tbo-ticket__airline-logo {
    display: block;
    width: 30px;
    height: 30px;
    object-fit: contain;
    background: transparent;
    border: none;
    border-radius: 0;
}

.tbo-ticket__airline-name {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Product mark, kept away from the carrier name so the two are not one label. */
.tbo-ticket__kind {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.09em;
    color: var(--tt-accent);
    text-transform: uppercase;
    white-space: nowrap;
}

/* The journey. City first, code as its caption. */

.tbo-ticket__routes {
    grid-area: routes;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.tbo-route__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.tbo-route__direction {
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--tt-accent);
    text-transform: uppercase;
}

/*
 * The date of this end of the journey, above its time. Stated at both ends because
 * a time only means something with the day it belongs to: an arrival after midnight
 * says so in words rather than as a "+1" the reader has to decode.
 */
.tbo-route__date {
    overflow: hidden;
    font-size: 11px;
    letter-spacing: 0.01em;
    color: var(--color-text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tbo-route__grid {
    display: grid;
    grid-template-columns: minmax(76px, 1fr) minmax(92px, 1.15fr) minmax(76px, 1fr);
    gap: 14px;
    align-items: start;
    width: 100%;
}

.tbo-route__point {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* Flush to the fare divider, mirroring departure on the left. */
.tbo-route__point--arrival {
    text-align: right;
    justify-self: stretch;
}

.tbo-route__time {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.tbo-route__city {
    overflow: hidden;
    font-size: 14px;
    font-weight: 550;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--color-text);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tbo-route__caption {
    overflow: hidden;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* The line between them: total time above, where it stops below. */

/* Pushed down by the height of the date line, so the total time sits level with
   the clock times it spans. */
.tbo-route__path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding-top: 22px;
}

.tbo-route__duration {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.tbo-route__line {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 7px;
}

.tbo-route__line::before {
    position: absolute;
    right: 0;
    left: 0;
    height: 1px;
    content: "";
    background: linear-gradient(
        to right,
        transparent,
        var(--tt-accent-line) 12%,
        var(--tt-accent-line) 88%,
        transparent
    );
}

.tbo-route__node {
    position: relative;
    width: 7px;
    height: 7px;
    background: var(--tt-bg);
    border: 1.5px solid var(--tt-accent);
    border-radius: 50%;
}

.tbo-route__via {
    overflow: hidden;
    max-width: 100%;
    font-size: 12px;
    letter-spacing: -0.005em;
    color: var(--color-text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tbo-route__via--stops {
    font-weight: 550;
    color: var(--color-text-secondary);
}

/*
 * Price aside. Seats urgency (when present) sits top-right; the passenger note,
 * amount, and Flight details share one foot stack — same order as FP-sample.
 * Buying still starts in the details modal, not from a scanning list.
 */

.tbo-ticket__aside {
    grid-area: aside;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    padding-left: 22px;
    border-left: 1px solid var(--tt-hairline);
}

.tbo-ticket__seats {
    align-self: flex-end;
    margin: 0;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.3;
    color: var(--tt-alert);
    white-space: nowrap;
    text-align: right;
}

.tbo-ticket__commit {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
    min-width: 0;
    margin-top: auto;
}

.tbo-ticket__price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    min-width: 0;
    text-align: right;
}

.tbo-ticket__price-note {
    font-size: 11px;
    line-height: 1.3;
    color: var(--color-text-muted);
}

.tbo-ticket__amount {
    font-size: 26px;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

/* Same filled CTA as charter-card Book; keep this button's width/radius. */
.tbo-ticket__details-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 36px;
    padding: 9px 14px;
    font-family:
        -apple-system, "blinkmacsystemfont", "SF Pro Text", "SF Pro Display",
        system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: #fff;
    cursor: pointer;
    background: var(--primary);
    border: 0.5px solid var(--primary-dark);
    border-radius: 11px;
    -webkit-font-smoothing: antialiased;
    box-shadow:
        0 1px 2px rgba(0, 168, 148, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s cubic-bezier(0.25, 0.1, 0.25, 1),
        opacity 0.15s ease;
}

.tbo-ticket__details-button:hover {
    color: #fff;
    background: var(--primary-hover);
    border-color: var(--primary);
    box-shadow:
        0 2px 6px rgba(68, 93, 239, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tbo-ticket__details-button:active {
    transform: scale(0.97);
    opacity: 0.94;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.tbo-ticket__details-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Dark theme: the same glass treatment the charter cards use. */

:root[data-theme="dark"] .tbo-ticket-card {
    --tt-accent: #445def;
    --tt-accent-soft: rgba(68, 93, 239, 0.16);
    --tt-accent-line: rgba(68, 93, 239, 0.38);
    --tt-bg: rgba(28, 30, 36, 0.52);
    --tt-border: rgba(255, 255, 255, 0.14);
    --tt-hairline: rgba(255, 255, 255, 0.12);
    --tt-good: #6ee7a8;
    --tt-warn: #f6c177;
    --tt-alert: #ff938c;

    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(22px) saturate(120%);
    -webkit-backdrop-filter: blur(22px) saturate(120%);
}

:root[data-theme="dark"] .tbo-route__node {
    background: rgba(20, 22, 28, 0.9);
}
