/* =========================================================================
   Ticketing additions on top of site.css (the same design system as the attendance app)
   ========================================================================= */

/* ===== Public site shell ================================================= */
.site-bar { position: sticky; top: 0; z-index: 1030; padding: 10px 12px 0; }
.site-inner {
    max-width: 1100px; margin: 0 auto; height: 64px; padding: 0 .6rem 0 .9rem; border-radius: 16px;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border: 1px solid var(--line); box-shadow: var(--shadow);
}
.site { width: 100%; max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; display: flex; flex-direction: column; gap: 1.1rem; }
.site.site-wide { max-width: 1100px; }
.site > * { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.site > *:nth-child(2) { animation-delay: .05s; }
.site > *:nth-child(n+3) { animation-delay: .1s; }
.site-foot { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 2rem; display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; color: var(--muted); }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--brand); }
.site .crumbs { margin-bottom: -.4rem; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: .5rem; }
.section-title h2 { font-size: 1.2rem; font-weight: 700; margin: 0; }

.concert-hero { margin-bottom: 0; padding: 2rem 1.9rem; }
.concert-hero .hero-title { font-size: 2.2rem; }
.hero-sub { color: rgba(255,255,255,.88); font-size: 1.02rem; margin: -.15rem 0 .8rem; max-width: 560px; }
@media (max-width: 575.98px) { .concert-hero .hero-title { font-size: 1.6rem; } }

.concert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.concert-card { display: flex; flex-direction: column; justify-content: space-between; gap: 1.1rem; padding: 1.2rem; color: var(--text); transition: transform .25s, box-shadow .25s; }
.concert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--text); }
.concert-card h3 { font-size: 1.1rem; font-weight: 700; margin: 0 0 .35rem; }
.concert-card .meta { font-size: .82rem; color: var(--muted); display: flex; gap: .4rem; }
.concert-card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: .9rem; border-top: 1px solid var(--line); }
.concert-card .price { font-weight: 700; color: var(--brand); }

/* Concert page: details + sticky booking card */
.concert-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 899.98px) { .concert-layout { grid-template-columns: 1fr; } }
.booking { position: sticky; top: 92px; overflow: hidden; }
.kv-lg { font-size: .95rem; gap: .9rem 1.4rem; }
.kv-lg dt i { color: var(--brand); margin-right: .45rem; }
.prose p { color: var(--text-2); line-height: 1.65; }
.prose p:last-child { margin-bottom: 0; }

.tier-list { display: flex; flex-direction: column; }
.tier { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.35rem; border-bottom: 1px solid var(--line); transition: background .2s; }
.tier:last-child { border-bottom: 0; }
.tier.is-picked { background: var(--brand-soft); }
.tier.is-out { opacity: .6; }
.tier-name { font-weight: 700; font-size: .98rem; }
.tier-desc { font-size: .8rem; color: var(--muted); }
.tier-price { font-family: var(--font); font-weight: 700; color: var(--brand); margin-top: .15rem; }
.stepper { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.stepper input { width: 3rem; text-align: center; font-weight: 700; font-size: 1rem; border: 0; background: transparent; color: var(--text); -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }
.stepper .btn:disabled { opacity: .35; }

.booking-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.35rem; border-top: 1px solid var(--line); background: var(--surface-2); }
.booking-total { font-family: var(--font); font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ===== Order / ticket wallet ============================================= */
.order-head { padding: 1.8rem 1.4rem; }
.order-title { font-size: 1.9rem; font-weight: 700; margin: .35rem 0 .35rem; }
.pay-total { display: flex; align-items: baseline; justify-content: space-between; padding: 1rem 1.1rem; border-radius: 16px; background: var(--brand-soft); border: 1px solid var(--brand-line); margin-bottom: 1rem; }
.pay-total b { font-family: var(--font); font-size: 1.6rem; color: var(--brand); }
.pay-how { white-space: pre-line; padding: 1rem 1.1rem; border-radius: 16px; background: var(--surface-2); border: 1px dashed var(--line-strong); font-weight: 550; color: var(--text-2); }

.ticket-list { display: flex; flex-direction: column; gap: 1rem; }
.ticket {
    --notch: 14px;
    position: relative; display: grid; grid-template-columns: 1fr 210px; border-radius: var(--r-xl); overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
    /* Punched half-circles where the stub tears off */
    -webkit-mask: radial-gradient(circle var(--notch) at calc(100% - 210px) 0, transparent 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at calc(100% - 210px) 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
    mask: radial-gradient(circle var(--notch) at calc(100% - 210px) 0, transparent 98%, #000) top / 100% 51% no-repeat,
          radial-gradient(circle var(--notch) at calc(100% - 210px) 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
}
.ticket::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.ticket-main { padding: 1.4rem 1.5rem 1.1rem; min-width: 0; }
.ticket-brand { display: flex; align-items: center; gap: .55rem; font-family: var(--font); font-weight: 700; font-size: .9rem; color: var(--text-2); }
.ticket-tier { padding: .2rem .7rem; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; font-size: .75rem; letter-spacing: .02em;  }
.ticket h3 { font-size: 1.35rem; font-weight: 700; margin: .9rem 0 .8rem; }
.ticket-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem 1rem; margin: 0; }
.ticket-facts .wide { grid-column: span 3; }
.ticket-facts dt { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.ticket-facts dd { margin: 0; font-weight: 650; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.ticket-foot { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--line-strong); font-size: .78rem; color: var(--muted); font-weight: 600; }
.ticket-foot code, .ticket-qr code { color: var(--text-2); font-size: .78rem; letter-spacing: .04em; }
.ticket-qr { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1.25rem 1rem; border-left: 2px dashed var(--line-strong); background: var(--surface-2); }
.qr-ticket { width: 100%; max-width: 180px; padding: 8px; border-radius: 14px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .08); }
.qr-locked { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; background: var(--hover); color: var(--muted); font-size: .78rem; font-weight: 600; text-align: center; box-shadow: none; border: 2px dashed var(--line-strong); }
.qr-locked i { font-size: 1.6rem; }
.ticket-stamp { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }
.ticket.is-used .qr-box svg { opacity: .25; }
.ticket.is-inactive { box-shadow: var(--shadow); }
.ticket.is-inactive::before { background: var(--line-strong); }

@media (max-width: 575.98px) {
    .ticket { grid-template-columns: 1fr; -webkit-mask: none; mask: none; }
    .ticket-qr { border-left: 0; border-top: 2px dashed var(--line-strong); order: -1; padding-top: 1.6rem; }
    .qr-ticket { max-width: 240px; }
    .ticket-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ticket-facts .wide { grid-column: span 2; }
}

/* Single ticket page: QR on top */
.single-ticket { max-width: 440px; width: 100%; margin: 0 auto; }
.ticket-vertical { grid-template-columns: 1fr; -webkit-mask: none; mask: none; }
.ticket-vertical .ticket-qr { border-left: 0; border-bottom: 2px dashed var(--line-strong); padding-top: 1.8rem; }
.ticket-vertical .qr-ticket { max-width: 260px; }

/* ===== Staff ============================================================== */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1099.98px) { .dash-grid { grid-template-columns: 1fr; } }
.kpi-money { font-size: 1.55rem; }
.tier-stat + .tier-stat { margin-top: 1rem; }
a.flash { text-decoration: none; }
a.flash:hover { filter: brightness(.98); }
.tier-edit { padding: .9rem 1rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.stack.gap-2 { gap: .6rem; }
.input-group-text { background: var(--hover); border-color: var(--line-strong); color: var(--muted); font-size: .82rem; }
.pill input { display: none; }

/* ===== Door scanner ======================================================= */
.scan-stage { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.scan-view { position: relative; aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden; background: #0b1430; display: grid; place-items: center; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.scan-view.live video { opacity: 1; }
.scan-frame { position: absolute; inset: 18% 24%; pointer-events: none; opacity: 0; transition: opacity .3s; }
.scan-view.live .scan-frame { opacity: 1; }
.scan-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; filter: drop-shadow(0 0 6px rgba(0,0,0,.5)); }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.scan-view.live .scan-frame::after { content: ""; position: absolute; left: 6%; right: 6%; height: 2px; background: #7dd3fc; box-shadow: 0 0 12px #38bdf8; animation: sweep 2.2s ease-in-out infinite alternate; }
@keyframes sweep { from { top: 8%; } to { top: 92%; } }
.scan-idle { position: relative; text-align: center; padding: 1.5rem; color: #c3cbe4; }
.scan-idle .text-muted { color: #8b96b8 !important; }
.scan-idle .pub-icon { background: rgba(255,255,255,.08); color: #9db9ff; }

.scan-result {
    position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 1.5rem; text-align: center; color: #fff; animation: resultIn .25s cubic-bezier(.2, .8, .2, 1);
}
.scan-result.tone-present { background: linear-gradient(135deg, #10b981, #047857); }
.scan-result.tone-excused { background: linear-gradient(135deg, #f59e0b, #b45309); }
.scan-result.tone-absent { background: linear-gradient(135deg, #f43f5e, #9f1239); }
.scan-result > i { font-size: 4.2rem; line-height: 1; margin-bottom: .6rem; }
.scan-result .r-head { font-family: var(--font); font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.scan-result .r-name { font-size: 1.3rem; font-weight: 650; margin-top: .2rem; }
.scan-result .r-detail { opacity: .92; margin-top: .35rem; max-width: 420px; }
.scan-result .r-meta { opacity: .75; font-size: .82rem; margin-top: .4rem; font-weight: 600; }
@keyframes resultIn { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
.scan-manual { display: flex; gap: .5rem; align-items: center; }

/* ===== Print: tickets only ================================================ */
@media print {
    @page { margin: 12mm; }
    body { background: #fff !important; }
    .backdrop, .site-bar, .site-foot, .toasts, .no-print, .flash, .order-head .success-mark, .section-title, .panel:not(.order-head) { display: none !important; }
    .site > * { animation: none !important; }
    .order-head { box-shadow: none !important; border: 0 !important; background: none !important; padding: 0 0 6mm !important; }
    .ticket { break-inside: avoid; box-shadow: none !important; border: 1px solid #ccc !important; -webkit-mask: none !important; mask: none !important; margin-bottom: 6mm; }
    .ticket, .ticket-qr { background: #fff !important; }
    .ticket-tier { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== PHP edition ======================================================== */
.kv { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; font-size: .87rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 550; }
.kv dd { margin: 0; color: var(--text); font-weight: 550; }
.site-bar .lang-pills { margin: 0 .15rem; }
.site-bar .brand-tag { display: block; }
.site-foot { flex-direction: column; align-items: center; text-align: center; }
.site-foot .app-footer { margin: 0; }
.ticket-brand .logo-badge { flex-shrink: 0; }
.concert-hero .hero-title { color: #fff; }
.hero-eyebrow.text-brand { color: var(--brand); }
.order-head .badge-x { font-size: .82rem; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.total td { font-weight: 650; background: var(--surface-2); }
.report-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.report-filters .form-select { width: auto; max-width: 100%; }
.scan-stage .scan-manual .search { position: relative; }
@media (max-width: 575.98px) {
    .site-inner { height: 58px; }
    .site-bar .brand-tag { display: none; }
    .booking-foot { flex-wrap: wrap; }
    .booking-foot .btn { width: 100%; }
}

/* ===== Committee door scanner ============================================ */
.door-pin { max-width: 420px; margin: 1.5rem auto 0; width: 100%; }
.door-pin-input { font-size: 2rem; letter-spacing: .4em; padding-left: .4em; height: 4rem; }
.door-pin-show { font-size: 1.9rem; font-weight: 650; letter-spacing: .25em; padding: .35rem .9rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line); }
.door-head h1 { font-size: 1.6rem; margin: .2rem 0; }
.door-head .actions { align-items: center; }
