/* ==========================================================================
   Ticketing — seat picker, checkout and printable tickets
   ========================================================================== */

/* ------------------------------------------------------------ shell */

.ticket-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px;
    align-items: start;
}

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.panel-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.18rem; }
.panel-body { padding: 24px; }

/* Offset from the shrunken bar - by the time this is sticky, the page has
   been scrolled and the header has already collapsed. */
.summary-panel { position: sticky; top: calc(var(--nav-h-stuck) + 20px); }

/* ------------------------------------------------------- seat canvas */

.seatmap {
    position: relative;
    background:
        linear-gradient(var(--bone-2) 1px, transparent 1px) 0 0 / 100% 40px,
        linear-gradient(90deg, var(--bone-2) 1px, transparent 1px) 0 0 / 40px 100%,
        var(--bone);
    border-bottom: 1px solid var(--line);
    overflow: auto;
    overscroll-behavior: contain;
    max-height: min(70vh, 720px);
    cursor: grab;
}

.seatmap.is-panning { cursor: grabbing; }

.seatmap-canvas {
    position: relative;
    transform-origin: 0 0;
    transition: transform .18s ease-out;
}

.seat-stage {
    position: absolute;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #24242c, var(--ink));
    color: #e3c964;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    box-shadow: var(--sh-2);
}

/* --- a table and its numbered chairs --- */

.st-table { position: absolute; transform: translate(-50%, -50%); }

.st-top {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
    display: grid;
    place-items: center;
    background: var(--white);
    border: 2px solid var(--line);
    box-shadow: var(--sh-1);
    font-family: var(--display);
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    text-align: center;
}

.st-round .st-top { border-radius: 50%; }
.st-rect .st-top { border-radius: 10px; }

.st-top small {
    display: block;
    font-family: var(--sans);
    font-size: .56rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-top: 2px;
}

/* zone colour bleeds through the table top */
.st-table[data-zone-color] .st-top { border-color: var(--zone, var(--line)); }
.st-table.is-full .st-top { background: var(--bone-2); color: var(--muted-2); }

.seat {
    position: absolute;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border-radius: 50%;
    border: 2px solid transparent;
    display: grid;
    place-items: center;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
    background: #d9f0dd;
    color: #14532d;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s, color .14s;
    user-select: none;
}

.seat:hover:not(.is-sold):not(.is-blocked):not(.is-held) {
    transform: scale(1.28);
    z-index: 5;
    box-shadow: var(--sh-2);
}

.seat.is-selected {
    background: var(--red);
    border-color: #fff;
    color: #fff;
    transform: scale(1.22);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, .3);
    z-index: 6;
}

.seat.is-sold { background: #e8e4dd; color: #a29c94; cursor: not-allowed; }
.seat.is-held { background: #fde6c7; color: #92610b; cursor: not-allowed; }
.seat.is-blocked { background: repeating-linear-gradient(45deg, #e8e4dd, #e8e4dd 3px, #d8d3ca 3px, #d8d3ca 6px); color: #a29c94; cursor: not-allowed; }

/* --------------------------------------------------------- controls */

.map-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bone);
    flex-wrap: wrap;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--white);
    display: grid;
    place-items: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    transition: border-color .16s, background .16s;
}

.tool-btn:hover { border-color: var(--ink); }
.tool-btn.wide { width: auto; padding-inline: 14px; font-size: .85rem; }

.zoom-label { font-size: .8rem; color: var(--muted); min-width: 46px; text-align: center; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-left: auto; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 14px; height: 14px; border-radius: 50%; display: block; flex: none; }
.legend .av { background: #d9f0dd; }
.legend .se { background: var(--red); }
.legend .so { background: #e8e4dd; }
.legend .he { background: #fde6c7; }

.zone-key { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--line); }

.zone-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 15px;
    border: 1px solid var(--line);
    border-radius: 100px;
    font-size: .85rem;
    background: var(--white);
}

.zone-chip i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.zone-chip b { font-weight: 600; }

/* ------------------------------------------------------ seat summary */

.sel-list { display: grid; gap: 10px; margin-bottom: 20px; max-height: 260px; overflow-y: auto; }

.sel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    background: var(--bone);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: .9rem;
}

.sel-row b { font-weight: 600; }
.sel-row small { display: block; color: var(--muted-2); font-size: .78rem; }

.sel-remove {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: rgba(200, 16, 46, .1);
    color: var(--red);
    display: grid;
    place-items: center;
    flex: none;
}

.sel-remove:hover { background: var(--red); color: #fff; }

.sel-empty { text-align: center; padding: 28px 12px; color: var(--muted-2); font-size: .92rem; }
.sel-empty svg { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--line); }

.totals { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 4px; }
.totals-row { display: flex; justify-content: space-between; gap: 12px; font-size: .93rem; color: var(--muted); margin-bottom: 9px; }
.totals-row.grand { font-size: 1.16rem; font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.totals-row.grand b { font-family: var(--display); font-size: 1.5rem; }

.hold-timer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 15px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--r-sm);
    font-size: .85rem;
    color: #78350f;
    margin-bottom: 18px;
}

.hold-timer b { font-variant-numeric: tabular-nums; }
.hold-timer.is-urgent { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }

/* ------------------------------------------------ general admission */

.qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.qty-row:last-child { border-bottom: 0; }
.qty-row h4 { margin: 0 0 4px; font-family: var(--sans); font-size: 1rem; }
.qty-row p { margin: 0; font-size: .87rem; color: var(--muted); }
.qty-price { font-family: var(--display); font-size: 1.2rem; color: var(--ink); margin-top: 6px; display: block; }

.stepper { display: flex; align-items: center; gap: 4px; flex: none; }

.stepper button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--white);
    font-size: 1.1rem;
    color: var(--ink);
    display: grid;
    place-items: center;
}

.stepper button:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }

.stepper input {
    width: 52px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    text-align: center;
    font: inherit;
    font-weight: 600;
    -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.soldout { font-size: .82rem; font-weight: 600; color: var(--muted-2); }

/* ------------------------------------------- one guest per ticket */

.att-row {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.att-row:first-child { padding-top: 0; }
.att-row:last-child { border-bottom: 0; padding-bottom: 0; }

.att-label {
    font-weight: 600;
    font-size: .92rem;
    color: var(--ink);
}

.att-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    gap: 10px;
}

.att-fields .input { padding: 11px 13px; font-size: .92rem; }

@media (max-width: 820px) {
    .att-row { grid-template-columns: 1fr; gap: 10px; }
    .att-fields { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------- checkout */

.order-lines { display: grid; gap: 12px; }

.order-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
    font-size: .94rem;
}

.order-line:last-child { border-bottom: 0; padding-bottom: 0; }
.order-line b { font-weight: 600; }

.pay-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    background: var(--bone);
    border: 1px solid var(--line);
    border-radius: 100px;
    font-size: .84rem;
    color: var(--muted);
}

.sandbox-note {
    background: #fffbeb;
    border: 1px dashed #fbbf24;
    border-radius: var(--r);
    padding: 16px 20px;
    font-size: .89rem;
    color: #78350f;
    margin-bottom: 22px;
}

/* -------------------------------------------------------- tickets */

.ticket-stub {
    display: grid;
    grid-template-columns: 1fr 220px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--sh-1);
    margin-bottom: 22px;
}

.ticket-stub-main { padding: 28px; }
.ticket-stub-main h3 { margin-bottom: 6px; }

.ticket-seat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    background: var(--ink);
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: var(--display);
    font-size: 1.25rem;
    margin: 14px 0;
}

.ticket-seat span { font-family: var(--sans); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-light); }

.ticket-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-top: 16px; }
.ticket-facts div { font-size: .87rem; }
.ticket-facts dt { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 3px; }
.ticket-facts dd { margin: 0; font-weight: 600; color: var(--ink); }

.ticket-qr {
    border-left: 2px dashed var(--line);
    padding: 24px 20px;
    text-align: center;
    background: var(--bone);
    display: grid;
    align-content: center;
    gap: 10px;
}

.ticket-qr img { width: 160px; height: 160px; margin-inline: auto; border-radius: 8px; background: #fff; }
.ticket-qr code { font-size: .82rem; font-weight: 700; letter-spacing: .06em; color: var(--ink); }

.verify-card { max-width: 520px; margin-inline: auto; text-align: center; }

.verify-badge {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
}

.verify-badge svg { width: 42px; height: 42px; }
.verify-ok { background: #dcfce7; color: #15803d; }
.verify-bad { background: #fee2e2; color: #b91c1c; }
.verify-warn { background: #fef3c7; color: #b45309; }

/* ------------------------------------------------------ responsive */

@media (max-width: 1040px) {
    .ticket-shell { grid-template-columns: 1fr; }
    .summary-panel { position: static; }
}

@media (max-width: 700px) {
    .ticket-stub { grid-template-columns: 1fr; }
    .ticket-qr { border-left: 0; border-top: 2px dashed var(--line); }
    .seatmap { max-height: 60vh; }
    .legend { width: 100%; margin-left: 0; }
}

/* ----------------------------------------------------------- print */

@media print {
    .topbar, .nav, .footer, .no-print, .btn { display: none !important; }
    body { background: #fff; }
    .ticket-stub { break-inside: avoid; page-break-inside: avoid; box-shadow: none; border: 1px solid #ccc; margin-bottom: 30px; }
    .section { padding-block: 0; }
}
