/* =============================================================================
   La Lista - public site styles
   =============================================================================
   Built on Bootstrap 5. Every colour that an organiser can change is read from
   a CSS custom property, which the server writes into the page head from their
   branding settings - so one stylesheet serves every tenant.
   ============================================================================= */

:root {
    /* Overridden per organiser; these are the fallbacks. */
    --brand-primary: #4a3aff;
    --brand-primary-dark: #3a2ecc;
    --brand-primary-light: #7a6dff;
    --brand-primary-rgb: 74, 58, 255;
    --brand-secondary: #ff5c00;
    --brand-secondary-dark: #cc4a00;
    --brand-secondary-rgb: 255, 92, 0;
    --on-primary: #ffffff;
    --on-secondary: #ffffff;

    --ink: #101828;
    --ink-muted: #667085;
    --ink-faint: #98a2b3;
    --surface: #ffffff;
    --surface-alt: #f8f9fc;
    --surface-sunken: #f2f4f7;
    --line: #e4e7ec;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 4px 16px rgba(16, 24, 40, .08);
    --shadow-lg: 0 18px 40px rgba(16, 24, 40, .12);

    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-head: var(--font-body);
}

/* -----------------------------------------------------------------------------
   Base
   ----------------------------------------------------------------------------- */
body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-head);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
}

h1 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.12; }
h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); line-height: 1.18; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-dark); text-decoration: underline; }

.text-muted { color: var(--ink-muted) !important; }
.text-faint { color: var(--ink-faint); }

/* Visible focus for keyboard users, on every interactive element. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(var(--brand-primary-rgb), .45);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    padding: .75rem 1.25rem;
    background: var(--brand-primary);
    color: var(--on-primary);
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; color: var(--on-primary); }

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
    border-radius: 999px;
    font-weight: 600;
    padding: .65rem 1.5rem;
    transition: transform .12s ease, box-shadow .18s ease, background-color .18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-brand {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--on-primary);
}
.btn-brand:hover, .btn-brand:focus {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    color: var(--on-primary);
    box-shadow: 0 6px 18px rgba(var(--brand-primary-rgb), .3);
}

.btn-brand-outline {
    border: 1.5px solid var(--brand-primary);
    color: var(--brand-primary);
    background: transparent;
}
.btn-brand-outline:hover {
    background: var(--brand-primary);
    color: var(--on-primary);
}

.btn-accent {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: var(--on-secondary);
}
.btn-accent:hover { background: var(--brand-secondary-dark); color: var(--on-secondary); }

.btn-lg { padding: .9rem 2rem; font-size: 1.05rem; }
.btn-sm { padding: .4rem 1rem; font-size: .875rem; }

/* -----------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.site-header .navbar-brand img { max-height: 42px; width: auto; }
.site-header .navbar-brand {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.site-header .nav-link {
    color: var(--ink);
    font-weight: 500;
    padding: .5rem .9rem;
    border-radius: var(--radius-sm);
}
.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--brand-primary);
    background: rgba(var(--brand-primary-rgb), .07);
    text-decoration: none;
}

.lang-switch .dropdown-toggle {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .35rem .85rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
}
.lang-switch .dropdown-menu { min-width: 12rem; max-height: 22rem; overflow-y: auto; }
.lang-switch .dropdown-item.active {
    background: rgba(var(--brand-primary-rgb), .1);
    color: var(--brand-primary);
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Hero
   ----------------------------------------------------------------------------- */
.hero {
    background:
        radial-gradient(1200px 400px at 12% -10%, rgba(var(--brand-primary-rgb), .16), transparent 60%),
        radial-gradient(900px 380px at 92% 0%, rgba(var(--brand-secondary-rgb), .13), transparent 55%),
        var(--surface-alt);
    padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4.5rem);
    border-bottom: 1px solid var(--line);
}
.hero p.lead { color: var(--ink-muted); font-size: clamp(1rem, 2vw, 1.2rem); max-width: 46ch; }

/* -----------------------------------------------------------------------------
   Event cards
   ----------------------------------------------------------------------------- */
.event-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.event-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--brand-primary-rgb), .35);
}

.event-card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    overflow: hidden;
}
.event-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.event-card__date {
    position: absolute;
    top: .85rem;
    left: .85rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: .35rem .6rem;
    text-align: center;
    line-height: 1.05;
    box-shadow: var(--shadow-sm);
    min-width: 3.2rem;
}
.event-card__date .day { display: block; font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.event-card__date .month {
    display: block;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-muted);
    font-weight: 700;
}

.event-card__body { padding: 1.1rem 1.15rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.event-card__title { font-size: 1.1rem; font-weight: 700; margin-bottom: .3rem; line-height: 1.3; }
.event-card__title a { color: var(--ink); }
.event-card__title a:hover { color: var(--brand-primary); text-decoration: none; }
.event-card__meta { font-size: .85rem; color: var(--ink-muted); display: flex; gap: .4rem; align-items: center; margin-bottom: .25rem; }
.event-card__footer {
    margin-top: auto;
    padding-top: .9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.event-card__price { font-weight: 700; color: var(--ink); }
.event-card__price small { font-weight: 500; color: var(--ink-muted); }

/* Status pills */
.pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .25rem .6rem;
    border-radius: 999px;
}
.pill-free      { background: #d1fadf; color: #027a48; }
.pill-soldout   { background: #fee4e2; color: #b42318; }
.pill-few       { background: #fef0c7; color: #b54708; }
.pill-brand     { background: rgba(var(--brand-primary-rgb), .12); color: var(--brand-primary); }
.pill-neutral   { background: var(--surface-sunken); color: var(--ink-muted); }
.pill-live      { background: #d1fadf; color: #027a48; }

/* -----------------------------------------------------------------------------
   Event detail
   ----------------------------------------------------------------------------- */
.event-hero {
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 21 / 9;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
}
.event-hero img { width: 100%; height: 100%; object-fit: cover; }

.event-meta-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.booking-panel {
    position: sticky;
    top: 5.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.35rem;
}

.option-row {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .9rem 1rem;
    margin-bottom: .7rem;
    transition: border-color .15s ease, background-color .15s ease;
}
.option-row:hover { border-color: rgba(var(--brand-primary-rgb), .4); }
.option-row.has-selection {
    border-color: var(--brand-primary);
    background: rgba(var(--brand-primary-rgb), .04);
}
.option-row__name { font-weight: 650; }
.option-row__price { font-weight: 700; white-space: nowrap; }

.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty-control button {
    width: 2.1rem; height: 2.1rem;
    border: 0; background: var(--surface-alt);
    font-weight: 700; color: var(--ink); line-height: 1;
}
.qty-control button:disabled { opacity: .35; cursor: not-allowed; }
.qty-control input {
    width: 2.6rem; text-align: center; border: 0;
    font-weight: 700; background: var(--surface);
    -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.discount-note {
    background: #ecfdf3;
    border: 1px dashed #6ce9a6;
    color: #027a48;
    border-radius: var(--radius-sm);
    padding: .6rem .8rem;
    font-size: .875rem;
}

/* -----------------------------------------------------------------------------
   Tickets
   ----------------------------------------------------------------------------- */
.ticket {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 420px;
    margin: 0 auto;
}
.ticket__head {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    color: var(--on-primary);
    padding: 1.4rem 1.4rem 1.2rem;
}
.ticket__head h2 { color: inherit; font-size: 1.25rem; margin: 0; }
.ticket__head .meta { opacity: .9; font-size: .9rem; }

/* The notch and perforation that make it read as a ticket. */
.ticket__rip {
    position: relative;
    height: 26px;
    background: var(--brand-primary-dark);
}
.ticket__rip::before,
.ticket__rip::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface-alt);
    transform: translateY(-50%);
}
.ticket__rip::before { left: -13px; }
.ticket__rip::after { right: -13px; }

.ticket__body { padding: 1.5rem 1.4rem; text-align: center; }
.ticket__qr {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem;
    display: inline-block;
    border: 1px solid var(--line);
}
.ticket__qr svg { display: block; width: 100%; height: auto; max-width: 260px; }
.ticket__serial {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.15rem;
    letter-spacing: .12em;
    font-weight: 700;
    margin-top: .9rem;
}
.ticket__photo {
    width: 104px; height: 104px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 3px solid var(--surface);
    box-shadow: var(--shadow);
}
.ticket--used { filter: grayscale(1); opacity: .72; }
.ticket--used .ticket__head { background: #667085; }

.rolling-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.4rem;
    letter-spacing: .25em;
    font-weight: 700;
    color: var(--brand-primary);
}
.rolling-bar { height: 4px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; }
.rolling-bar span { display: block; height: 100%; background: var(--brand-primary); transition: width 1s linear; }

/* -----------------------------------------------------------------------------
   Credits
   ----------------------------------------------------------------------------- */
.wallet-card {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    box-shadow: var(--shadow);
}
.wallet-card .balance { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.wallet-card .label { opacity: .88; font-weight: 600; letter-spacing: .02em; }

.ledger-row { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-amount { font-weight: 700; white-space: nowrap; }
.ledger-amount.plus { color: #027a48; }
.ledger-amount.minus { color: #b42318; }

/* -----------------------------------------------------------------------------
   Calendar
   ----------------------------------------------------------------------------- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar-head { background: var(--surface-alt); padding: .6rem .4rem; text-align: center; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.calendar-cell { background: var(--surface); min-height: 104px; padding: .45rem; }
.calendar-cell.is-outside { background: var(--surface-alt); opacity: .55; }
.calendar-cell.is-today { box-shadow: inset 0 0 0 2px var(--brand-primary); }
.calendar-day { font-weight: 700; font-size: .85rem; color: var(--ink-muted); margin-bottom: .25rem; }
.calendar-event {
    display: block;
    font-size: .74rem;
    padding: .18rem .35rem;
    border-radius: 4px;
    background: rgba(var(--brand-primary-rgb), .12);
    color: var(--brand-primary);
    margin-bottom: .18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.calendar-event:hover { background: var(--brand-primary); color: var(--on-primary); text-decoration: none; }

/* -----------------------------------------------------------------------------
   Footer
   ----------------------------------------------------------------------------- */
.site-footer {
    background: var(--surface-alt);
    border-top: 1px solid var(--line);
    padding: 3rem 0 1.75rem;
    margin-top: 4rem;
}
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: var(--brand-primary); }
.attribution {
    border-top: 1px solid var(--line);
    padding-top: 1.15rem;
    margin-top: 1.75rem;
    font-size: .875rem;
    color: var(--ink-muted);
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    justify-content: space-between;
    align-items: center;
}
.attribution .powered { font-weight: 600; }

/* -----------------------------------------------------------------------------
   Forms
   ----------------------------------------------------------------------------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--line);
    padding: .65rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(var(--brand-primary-rgb), .14);
}
.form-label { font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.form-text { font-size: .82rem; color: var(--ink-muted); }
.required::after { content: " *"; color: #d92d20; }

.attendee-block {
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    padding: 1.1rem;
    margin-bottom: 1rem;
    background: var(--surface);
}

.payment-method {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: .7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .85rem;
    transition: border-color .15s ease, background-color .15s ease;
}
.payment-method:hover { border-color: rgba(var(--brand-primary-rgb), .45); }
.payment-method.selected { border-color: var(--brand-primary); background: rgba(var(--brand-primary-rgb), .05); }
.payment-method__icon { width: 40px; text-align: center; font-size: 1.4rem; }

/* -----------------------------------------------------------------------------
   Empty states, alerts, misc
   ----------------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--ink-muted); }
.empty-state__icon { font-size: 3rem; opacity: .3; margin-bottom: .75rem; }

.alert { border: 0; border-radius: var(--radius-sm); border-left: 4px solid transparent; }
.alert-success { background: #ecfdf3; border-left-color: #12b76a; color: #027a48; }
.alert-danger  { background: #fef3f2; border-left-color: #f04438; color: #b42318; }
.alert-warning { background: #fffaeb; border-left-color: #f79009; color: #b54708; }
.alert-info    { background: #eff8ff; border-left-color: #2e90fa; color: #175cd3; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }

.fallback-note {
    font-size: .8rem;
    color: var(--ink-muted);
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
    padding: .45rem .7rem;
    display: inline-block;
}

.filter-bar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

/* -----------------------------------------------------------------------------
   Print - tickets and voucher sheets
   ----------------------------------------------------------------------------- */
@media print {
    .site-header, .site-footer, .no-print, .btn { display: none !important; }
    .ticket { box-shadow: none; border: 1px solid #000; page-break-inside: avoid; }
    body { background: #fff; }
}

/* -----------------------------------------------------------------------------
   Reduced motion
   ----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* -----------------------------------------------------------------------------
   Dark mode - respects the visitor's system preference
   ----------------------------------------------------------------------------- */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --ink: #f2f4f7;
        --ink-muted: #98a2b3;
        --ink-faint: #667085;
        --surface: #16181d;
        --surface-alt: #1c1f26;
        --surface-sunken: #22262e;
        --line: #2d323c;
    }
    :root:not([data-theme="light"]) .site-header { background: rgba(22, 24, 29, .92); }
    :root:not([data-theme="light"]) .ticket__qr { background: #fff; }
    :root:not([data-theme="light"]) .event-card__date { background: var(--surface-alt); }
}
