/* ==========================================================================
   TicketHub design tokens
   ========================================================================== */
:root {
    --th-primary: #5b3df5;
    --th-primary-dark: #4527d9;
    --th-primary-soft: #efecff;
    --th-accent: #ff6b3d;
    --th-ink: #14112b;
    --th-ink-2: #3b3854;
    --th-muted: #6b6882;
    --th-surface: #f6f5fb;
    --th-border: #e8e6f1;
    --th-shadow-sm: 0 1px 2px rgba(20, 17, 43, .04), 0 1px 3px rgba(20, 17, 43, .06);
    --th-shadow: 0 4px 6px -1px rgba(20, 17, 43, .06), 0 10px 24px -6px rgba(20, 17, 43, .08);

    --bs-primary: var(--th-primary);
    --bs-primary-rgb: 91, 61, 245;
    --bs-link-color: var(--th-primary);
    --bs-link-color-rgb: 91, 61, 245;
    --bs-link-hover-color: var(--th-primary-dark);
    --bs-link-hover-color-rgb: 69, 39, 217;
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-font-size: .9375rem;
    --bs-body-color: var(--th-ink);
    --bs-border-color: var(--th-border);
    --bs-secondary-color: var(--th-muted);
}

body { background: #fff; -webkit-font-smoothing: antialiased; }
.site { min-height: 100vh; display: flex; flex-direction: column; }
.site > main { flex: 1 0 auto; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { letter-spacing: -.02em; color: var(--th-ink); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a.btn:hover, a.card:hover, .nav-link:hover, .dropdown-item:hover, a.category-pill:hover, a.th-brand:hover { text-decoration: none; }
.bg-surface { background: var(--th-surface); }
.text-muted { color: var(--th-muted) !important; }
.text-ink-2 { color: var(--th-ink-2); }
.fw-800 { font-weight: 800; }
.small, small { font-size: .8125rem; }
.font-monospace { font-size: .85em; letter-spacing: .01em; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--th-muted); }

/* Buttons */
.btn { border-radius: .6rem; font-weight: 600; letter-spacing: -.005em; }
.btn-sm { border-radius: .5rem; padding: .3rem .65rem; font-size: .8125rem; }
.btn-lg { border-radius: .75rem; font-size: 1rem; padding: .7rem 1.25rem; }
.btn-primary {
    --bs-btn-bg: var(--th-primary); --bs-btn-border-color: var(--th-primary);
    --bs-btn-hover-bg: var(--th-primary-dark); --bs-btn-hover-border-color: var(--th-primary-dark);
    --bs-btn-active-bg: var(--th-primary-dark); --bs-btn-active-border-color: var(--th-primary-dark);
    --bs-btn-disabled-bg: var(--th-primary); --bs-btn-disabled-border-color: var(--th-primary);
    box-shadow: 0 1px 2px rgba(91, 61, 245, .25);
}
.btn-outline-primary {
    --bs-btn-color: var(--th-primary); --bs-btn-border-color: rgba(91, 61, 245, .35);
    --bs-btn-hover-bg: var(--th-primary-soft); --bs-btn-hover-color: var(--th-primary-dark); --bs-btn-hover-border-color: var(--th-primary);
    --bs-btn-active-bg: var(--th-primary-soft); --bs-btn-active-color: var(--th-primary-dark); --bs-btn-active-border-color: var(--th-primary);
}
.btn-light-subtle { background: #fff; border: 1px solid var(--th-border); color: var(--th-ink-2); }
.btn-light-subtle:hover { background: var(--th-surface); color: var(--th-ink); border-color: #d9d6e6; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; }

/* Admin notification bell */
.notif-bell { width: 36px; height: 36px; border-radius: 50%; font-size: 1.05rem; }
.notif-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ff6b3d; color: #fff; font-size: .65rem; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.notif-menu { width: 320px; max-width: calc(100vw - 2rem); max-height: 420px; overflow-y: auto; border-radius: 1rem; }
.notif-item + .notif-item { border-top: 1px solid var(--th-border); }
.notif-item:hover { background: var(--th-surface); }
.notif-item.unread { background: var(--th-primary-soft); }
.notif-item.unread:hover { background: #e6e0ff; }
.notif-icon { width: 30px; height: 30px; border-radius: .6rem; background: #fff3d6; color: #b7791f; display: grid; place-items: center; flex-shrink: 0; }

/* Forms */
.form-control, .form-select { border-radius: .6rem; border-color: var(--th-border); }
.form-control::placeholder { color: #a3a0b8; }
.form-control:focus, .form-select:focus { border-color: var(--th-primary); box-shadow: 0 0 0 .2rem rgba(91, 61, 245, .14); }
.form-label { color: var(--th-ink-2); }
.form-check-input:checked { background-color: var(--th-primary); border-color: var(--th-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(91, 61, 245, .14); border-color: var(--th-primary); }

/* Cards */
.card { border-color: var(--th-border); border-radius: 1rem; box-shadow: var(--th-shadow-sm); }
.card-header { background: #fff; border-bottom-color: var(--th-border); }
.card-header:first-child { border-radius: 1rem 1rem 0 0; }
.card-title-sm { font-size: .95rem; font-weight: 700; margin: 0; }
.rounded-4 { border-radius: 1rem !important; }

/* Soft status badges */
.badge { font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.badge-soft { padding: .35em .7em; border-radius: 999px; font-size: .72rem; display: inline-flex; align-items: center; gap: .35em; }
.badge-soft::before { content: ""; width: .45em; height: .45em; border-radius: 50%; background: currentColor; }
.badge-soft.success { background: #e7f8ee; color: #15803d; }
.badge-soft.warning { background: #fff4e0; color: #b45309; }
.badge-soft.danger { background: #fdecec; color: #c62828; }
.badge-soft.neutral { background: #eff0f4; color: #55536b; }
.badge-soft.info { background: var(--th-primary-soft); color: var(--th-primary-dark); }
.badge-kind { background: var(--th-ink); color: #fff; font-size: .65rem; padding: .3em .6em; border-radius: .4rem; text-transform: uppercase; letter-spacing: .06em; }
.badge-kind.early { background: #fff4e0; color: #b45309; }

/* Tables */
.table { --bs-table-color: var(--th-ink); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .85rem 1rem; border-bottom-color: var(--th-border); }
.table thead th { background: var(--th-surface); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--th-muted); font-weight: 700; border-bottom: 1px solid var(--th-border); white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #faf9fe; }
.card > .table-responsive:first-child thead th:first-child { border-top-left-radius: 1rem; }
.card > .table-responsive:first-child thead th:last-child { border-top-right-radius: 1rem; }
.dash-main .table td { white-space: nowrap; }
.dash-main .table td.wrap { white-space: normal; min-width: 220px; }
.cell-title { font-weight: 600; color: var(--th-ink); }
.cell-title:hover { color: var(--th-primary); }
.cell-sub { font-size: .8rem; color: var(--th-muted); }
.thumb { width: 56px; height: 38px; border-radius: .5rem; object-fit: cover; flex-shrink: 0; }

/* Navigation */
.th-nav { border-bottom: 1px solid var(--th-border); background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(10px); }
.th-nav .nav-link { font-weight: 600; color: var(--th-ink-2); font-size: .9rem; }
.th-nav .nav-link:hover, .th-nav .nav-link.active { color: var(--th-primary); }
.th-brand { font-weight: 800; letter-spacing: -.03em; color: var(--th-ink); display: inline-flex; align-items: center; gap: .45rem; }
.th-brand .mark { width: 30px; height: 30px; border-radius: .55rem; background: linear-gradient(135deg, #7b61ff, #5b3df5 55%, #3a22b8); display: grid; place-items: center; color: #fff; font-size: .95rem; box-shadow: 0 4px 10px rgba(91, 61, 245, .35); }
.th-brand .dot { color: var(--th-accent); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--th-primary-soft); color: var(--th-primary-dark); font-weight: 700; font-size: .8rem; display: inline-grid; place-items: center; flex-shrink: 0; }
.dropdown-menu { border-color: var(--th-border); border-radius: .8rem; box-shadow: var(--th-shadow); padding: .4rem; font-size: .9rem; }
.dropdown-item { border-radius: .5rem; padding: .45rem .75rem; }
.dropdown-item:active { background: var(--th-primary); }

/* Hero */
.th-hero {
    background: radial-gradient(circle at 85% 0%, rgba(255, 107, 61, .35), transparent 38%),
                radial-gradient(circle at 0% 100%, rgba(123, 97, 255, .45), transparent 40%),
                linear-gradient(135deg, #150f38 0%, #2c1a92 55%, #5b3df5 100%);
    color: #fff;
}
.th-hero h1 { color: #fff; }
.th-hero .search-box { background: #fff; border-radius: 1rem; padding: .5rem; box-shadow: 0 24px 60px rgba(10, 6, 40, .35); }
.th-hero .search-box .form-control, .th-hero .search-box .form-select { border: 0; box-shadow: none; }
.hero-stat { border-left: 2px solid rgba(255, 255, 255, .25); padding-left: .9rem; }
.hero-stat .n { font-size: 1.4rem; font-weight: 800; line-height: 1.1; }
.hero-stat .l { font-size: .8rem; opacity: .7; }

/* Featured events slideshow in the hero */
.hero-featured { border-radius: 1.25rem; overflow: hidden; box-shadow: 0 30px 70px rgba(10, 6, 40, .45); background: #14112b; }
.hero-slide { position: relative; display: block; color: #fff; text-decoration: none; }
.hero-slide:hover { color: #fff; }
.hero-slide img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 17, 43, 0) 30%, rgba(20, 17, 43, .65) 55%, rgba(20, 17, 43, .95) 100%); }
.hero-slide-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 1.25rem 1.25rem 2.25rem; }
.hero-slide .eyebrow { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #ffb199; }
.hero-slide .title { font-size: 1.5rem; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; margin: .2rem 0 .4rem; }
.hero-slide .meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; opacity: .85; }
.hero-slide .price { font-size: 1.15rem; font-weight: 800; }
.hero-slide .price .from { font-size: .75rem; font-weight: 600; opacity: .75; }
.hero-slide .featured-tag { z-index: 1; }
.hero-featured .carousel-indicators { margin-bottom: .8rem; z-index: 2; }
/* 8px dots with a larger invisible tap area around each one. */
.hero-featured .carousel-indicators [data-bs-target] { width: 8px; height: 8px; border-radius: 50%; border: 0; box-sizing: content-box; padding: 6px; background-clip: content-box; margin: 0 2px; }
.hero-featured .carousel-control-prev, .hero-featured .carousel-control-next { width: 3rem; height: 3rem; top: 38%; bottom: auto; transform: translateY(-50%); margin: 0 .5rem; border-radius: 50%; background: rgba(20, 17, 43, .45); opacity: .9; z-index: 2; }
.hero-featured .carousel-control-prev-icon, .hero-featured .carousel-control-next-icon { width: 1.2rem; height: 1.2rem; }
@media (max-width: 1199.98px) {
    /* Arrows would cover the event title on narrower cards; dots, swipe and auto-advance remain. */
    .hero-featured .carousel-control-prev, .hero-featured .carousel-control-next { display: none; }
}
@media (max-width: 575.98px) {
    .hero-slide img { aspect-ratio: 1 / 1; }
    .hero-slide .title { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-featured .carousel-item { transition: none; }
}

/* Event cards */
.event-card { transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; }
.event-card:hover { transform: translateY(-3px); box-shadow: var(--th-shadow); }
.event-card .banner { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; background: var(--th-surface); }
.event-card .title { font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--th-ink); }
.event-card .meta { font-size: .8125rem; color: var(--th-muted); display: flex; gap: .4rem; align-items: flex-start; }
.event-card .price { font-weight: 700; color: var(--th-ink); }
.date-chip { position: absolute; top: .75rem; left: .75rem; background: #fff; border-radius: .7rem; padding: .3rem .6rem; text-align: center; line-height: 1.1; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); min-width: 46px; }
.date-chip .m { font-size: .65rem; text-transform: uppercase; font-weight: 800; color: var(--th-accent); letter-spacing: .06em; }
.date-chip .d { font-size: 1.15rem; font-weight: 800; color: var(--th-ink); }
.featured-tag { position: absolute; top: .75rem; right: .75rem; background: rgba(20, 17, 43, .75); backdrop-filter: blur(6px); color: #fff; font-size: .7rem; font-weight: 700; padding: .3rem .6rem; border-radius: 999px; }
.featured-tag i { color: #ffc24b; }
.category-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem 1rem; border: 1px solid var(--th-border); border-radius: 999px; color: var(--th-ink); font-weight: 600; font-size: .875rem; background: #fff; transition: all .15s; }
.category-pill:hover { border-color: var(--th-primary); color: var(--th-primary); box-shadow: var(--th-shadow-sm); }
.category-pill .count { background: var(--th-surface); color: var(--th-muted); border-radius: 999px; font-size: .7rem; padding: .1rem .45rem; }
.section-title { font-size: 1.5rem; font-weight: 800; }

/* Event detail */
.event-hero { position: relative; background: #14112b; overflow: hidden; }
.event-hero img { width: 100%; max-height: 340px; object-fit: cover; display: block; }
.event-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(20, 17, 43, .45)); }
.info-tile { display: flex; gap: .9rem; }
.info-tile .ico { width: 44px; height: 44px; border-radius: .8rem; background: var(--th-primary-soft); color: var(--th-primary); display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.ticket-row { padding: 1rem 0; border-bottom: 1px solid var(--th-border); }
.ticket-row:last-of-type { border-bottom: 0; }

/* Auth */
.auth-shell { min-height: calc(100vh - 64px); }
.auth-aside { background: radial-gradient(circle at 80% 10%, rgba(255, 107, 61, .35), transparent 40%), linear-gradient(160deg, #150f38, #3a22b8 70%, #5b3df5); color: #fff; }
.auth-aside h2 { color: #fff; }
.auth-aside .point { display: flex; gap: .75rem; margin-bottom: 1.1rem; }
.auth-aside .point i { width: 36px; height: 36px; border-radius: .7rem; background: rgba(255, 255, 255, .12); display: grid; place-items: center; flex-shrink: 0; }

/* Dashboard shell */
.dash-shell { min-height: 100vh; }
.dash-sidebar { width: 252px; background: #120f26; color: #b9b5d0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.dash-sidebar .nav-link { color: #b9b5d0; border-radius: .6rem; padding: .5rem .8rem; display: flex; align-items: center; gap: .7rem; font-weight: 500; font-size: .9rem; }
.dash-sidebar .nav-link i { font-size: 1.05rem; opacity: .85; }
.dash-sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.dash-sidebar .nav-link.active { background: rgba(123, 97, 255, .18); color: #fff; box-shadow: inset 3px 0 0 #8b74ff; }
.dash-sidebar .nav-link.active i { color: #a99bff; opacity: 1; }
.dash-sidebar .section-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: #6f6b8d; padding: 1.1rem .8rem .4rem; font-weight: 700; }
.dash-sidebar .th-brand { color: #fff; }
.dash-sidebar .sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .08); }
.dash-main { background: var(--th-surface); min-width: 0; }
.dash-topbar { background: #fff; border-bottom: 1px solid var(--th-border); padding: 1rem 1.75rem; position: sticky; top: 0; z-index: 10; }
.dash-topbar h1 { font-size: 1.35rem; font-weight: 800; margin: 0; }
.dash-content { padding: 1.75rem; }

@media (min-width: 992px) {
    /* Event page ticket box follows the reader on wide screens only. */
    .ticket-panel { position: sticky; top: 90px; z-index: 5; }
}

@media (max-width: 991.98px) {
    /* Stack sidebar above content and let content fill the screen, so short pages don't end in a dark band. */
    .dash-shell { display: flex; flex-direction: column; }
    .dash-sidebar { width: 100%; height: auto; position: static; }
    .dash-topbar { position: static; padding: 1rem; }
    .dash-content { padding: 1rem; }
}

/* Stat cards */
.stat-card .card-body { padding: 1.1rem 1.2rem; }
.stat-card .icon { width: 42px; height: 42px; border-radius: .8rem; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-card .label { font-size: .78rem; font-weight: 600; color: var(--th-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; }
.stat-card .value .cur { font-size: .8rem; font-weight: 700; color: var(--th-muted); margin-right: .2rem; }

@media (max-width: 575.98px) {
    /* Two stat cards share a phone row: let labels and amounts wrap instead of being cut off. */
    .stat-card .card-body { padding: .9rem; }
    .stat-card .icon { width: 34px; height: 34px; font-size: 1rem; }
    .stat-card .label { white-space: normal; }
    .stat-card .value { font-size: 1.1rem; white-space: normal; overflow-wrap: anywhere; }
    .stat-card .value .cur { display: block; line-height: 1.2; }
    .col-6 > .stat-card .card-body { flex-direction: column; align-items: flex-start !important; gap: .6rem !important; }
}

/* Attention list */
.attention { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem; background: #fff; border: 1px solid #fde6c4; border-radius: .9rem; color: var(--th-ink); box-shadow: var(--th-shadow-sm); }
.attention .ico { width: 36px; height: 36px; border-radius: .7rem; background: #fff4e0; color: #b45309; display: grid; place-items: center; }
.attention:hover { border-color: #f7c77d; text-decoration: none; color: var(--th-ink); }

/* Progress */
.progress { background: #ecebf3; border-radius: 999px; }
.progress-bar { background: var(--th-primary); border-radius: 999px; }

/* Ticket stubs */
.ticket-stub { border: 1px solid var(--th-border); border-radius: 1rem; background: #fff; position: relative; display: flex; overflow: hidden; }
.ticket-stub .qr-side { padding: .9rem; border-right: 2px dashed var(--th-border); background: #fff; display: grid; place-items: center; }
.ticket-stub .qr-side img { width: 104px; height: 104px; }
.ticket-stub .info { padding: .9rem 1rem; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ticket-stub::before, .ticket-stub::after { content: ""; position: absolute; left: 127px; width: 16px; height: 16px; border-radius: 50%; background: var(--th-surface); border: 1px solid var(--th-border); }
.ticket-stub::before { top: -9px; }
.ticket-stub::after { bottom: -9px; }
.ticket-stub.used .qr-side img { opacity: .2; }

/* Pagination */
.pagination { --bs-pagination-active-bg: var(--th-primary); --bs-pagination-active-border-color: var(--th-primary); --bs-pagination-color: var(--th-ink-2); --bs-pagination-border-color: var(--th-border); --bs-pagination-border-radius: .6rem; }

/* Segmented filter */
.segmented { display: inline-flex; flex-wrap: wrap; gap: .25rem; background: #fff; border: 1px solid var(--th-border); padding: .25rem; border-radius: .75rem; }
.segmented a { padding: .35rem .8rem; border-radius: .55rem; font-size: .8125rem; font-weight: 600; color: var(--th-muted); }
.segmented a:hover { color: var(--th-ink); background: var(--th-surface); text-decoration: none; }
.segmented a.active { background: var(--th-primary); color: #fff; }

/* Empty states */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .ico { width: 56px; height: 56px; border-radius: 1rem; background: var(--th-primary-soft); color: var(--th-primary); display: inline-grid; place-items: center; font-size: 1.5rem; margin-bottom: .75rem; }

/* Footer */
.site-footer { background: #0f0c22; color: #a9a5c2; }
.site-footer a { color: #cfcbe3; }
.site-footer a:hover { color: #fff; }
.site-footer .th-brand { color: #fff; }
.site-footer h6 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }

/* Scanner */
.scan-result { border-radius: 1rem; padding: 1.5rem; color: #fff; text-align: center; transition: background .2s; }
.scan-result.ok { background: #16a34a; }
.scan-result.warn { background: #d97706; }
.scan-result.bad { background: #dc2626; }
.scan-result.idle { background: #262143; }
#reader { border-radius: 1rem; overflow: hidden; min-height: 120px; }
#reader video { border-radius: 1rem; }

.dash-shell { background: #120f26; }
.text-white { color: #fff !important; }
.auth-aside .th-brand { color: #fff; }
.btn-check:checked + .btn-light-subtle { border-color: var(--th-primary); background: var(--th-primary-soft); box-shadow: 0 0 0 1px var(--th-primary); color: var(--th-ink); }
.card-header, .card-footer { background: transparent !important; }
