/* =============================================================================
   QRQ Public CSS — Check-in & Display pages
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --qrq-c1: #0ea5e9;
    --qrq-c2: #22c55e;
    --qrq-bg: #0f172a;
    --qrq-surface: #1e293b;
    --qrq-text: #f1f5f9;
    --qrq-muted: #a1b1c5;
    --qrq-radius: 16px;
    --qrq-shadow: 0 8px 32px rgba(0,0,0,.45);
    --qrq-transition: .25s ease;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--qrq-bg);
    color: var(--qrq-text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ---- Check-in page ---- */

.qrq-checkin-wrap {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Dark overlay ensures white text is readable on any brand color gradient */
    background-image: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.15));
    background: linear-gradient(135deg, var(--q-color1, var(--qrq-c1)) 0%, var(--q-color2, var(--qrq-c2)) 100%);
}

.qrq-checkin-card {
    background: rgba(255,255,255,.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--qrq-radius);
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--qrq-shadow);
}

.qrq-checkin-card__title {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.qrq-checkin-card__subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,.8);
    margin-bottom: 36px;
}

.qrq-checkin-closed {
    font-size: 1.1rem;
    color: rgba(255,255,255,.9);
    background: rgba(0,0,0,.25);
    border-radius: 10px;
    padding: 16px 24px;
    margin: 16px 0;
}

.qrq-ticket-result {
    margin-top: 24px;
    display: none;
}
.qrq-ticket-result.visible { display: block; }

.qrq-ticket-number {
    font-size: clamp(4rem, 15vw, 8rem);
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 0 4px 16px rgba(0,0,0,.4);
}

.qrq-ticket-label {
    font-size: 1rem;
    color: rgba(255,255,255,.8);
    margin-top: 8px;
}

/* ---- Shared button ---- */

.qrq-btn-checkin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    color: #0f172a;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 16px 36px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: transform var(--qrq-transition), box-shadow var(--qrq-transition);
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    width: 100%;
    max-width: 300px;
}
.qrq-btn-checkin:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.qrq-btn-checkin:active { transform: translateY(0); }
.qrq-btn-checkin:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.qrq-btn-checkin:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.qrq-error-msg {
    margin-top: 16px;
    color: #fca5a5;
    font-size: .9rem;
    min-height: 20px;
}

/* ---- Display screen ---- */

.qrq-display-wrap {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    background:
        linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.15)),
        linear-gradient(135deg, var(--q-color1, var(--qrq-c1)) 0%, var(--q-color2, var(--qrq-c2)) 100%);
    overflow: hidden;
}

.qrq-display-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.qrq-display-label {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 600;
    color: rgba(255,255,255,.85);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.qrq-display-number {
    font-size: clamp(8rem, 28vw, 22rem);
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 0 8px 48px rgba(0,0,0,.5);
    transition: transform .15s ease;
    will-change: transform;
}
.qrq-display-number.pulse { animation: qrq-pulse .5s ease; }

@keyframes qrq-pulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.08); }
    60%  { transform: scale(.98); }
    100% { transform: scale(1); }
}

.qrq-display-phrase {
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    color: rgba(255,255,255,.9);
    margin-top: 20px;
    min-height: 2.4em;
    line-height: 1.4;
}

.qrq-display-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(0,0,0,.2);
}

.qrq-display-queue-name {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,.8);
}

.qrq-sound-toggle {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .9rem;
    transition: background var(--qrq-transition);
}
.qrq-sound-toggle:hover { background: rgba(255,255,255,.25); }

/* Kiosk overlay */
.qrq-kiosk-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 9999;
    color: #fff;
    text-align: center;
}
.qrq-kiosk-overlay h2 { font-size: 2rem; }
.qrq-kiosk-overlay p { font-size: 1.1rem; color: rgba(255,255,255,.75); }
.qrq-kiosk-overlay__btn {
    padding: 16px 48px;
    background: #fff;
    color: #0f172a;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
}

/* Reconnect overlay */
.qrq-reconnect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 8888;
    color: #fff;
    text-align: center;
}
.qrq-reconnect-overlay.visible { display: flex; }
.qrq-reconnect-spinner {
    width: 48px; height: 48px;
    border: 5px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: qrq-spin 1s linear infinite;
}
@keyframes qrq-spin { to { transform: rotate(360deg); } }
.qrq-reconnect-overlay p { font-size: 1.1rem; color: rgba(255,255,255,.8); }

/* ---- Multi-window display grid ---- */

.qrq-display-grid {
    display: grid;
    gap: 8px;
    flex: 1;
    padding: 20px;
    align-content: center;
    width: 100%;
}
/* Responsive grid columns based on window count (set by JS via grid-template-columns) */
.qrq-display-grid { grid-template-columns: repeat(2, 1fr); }
.qrq-display-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.qrq-display-grid[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

.qrq-display-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    min-height: 180px;
}

.qrq-display-cell__label {
    font-size: clamp(.9rem, 2vw, 1.3rem);
    font-weight: 600;
    color: rgba(255,255,255,.7);
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.qrq-display-cell__number {
    font-size: clamp(3rem, 12vw, 10rem);
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 0 4px 24px rgba(0,0,0,.4);
    transition: transform .15s ease;
    will-change: transform;
}
.qrq-display-cell__number.pulse { animation: qrq-pulse .5s ease; }

/* Scale down font for many windows */
.qrq-display-grid[data-cols="3"] .qrq-display-cell__number,
.qrq-display-grid[data-cols="4"] .qrq-display-cell__number {
    font-size: clamp(2rem, 8vw, 6rem);
}

/* Responsive */
@media (max-width: 600px) {
    .qrq-checkin-card { padding: 32px 20px; }
    .qrq-display-footer { flex-direction: column; gap: 10px; }
    .qrq-display-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 1px; padding: 8px; }
    .qrq-display-cell { padding: 16px 8px; min-height: 120px; }
    .qrq-display-cell__number { font-size: clamp(2rem, 10vw, 4rem); }
}

/* ---- Check-in form fields ---- */
.qrq-checkin-reasons { margin-bottom: 24px; }
.qrq-checkin-reasons__label {
    font-size: .95rem;
    color: rgba(255,255,255,.85);
    margin-bottom: 10px;
    text-align: left;
}

.qrq-reason-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,.1);
    border: 2px solid rgba(255,255,255,.15);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .25s ease, background .25s ease;
}
.qrq-reason-card:has(:checked) {
    border-color: #fff;
    background: rgba(255,255,255,.2);
}
.qrq-reason-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.qrq-reason-card:has(:focus-visible) {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.qrq-reason-card__text {
    font-size: 1rem;
    color: #fff;
    font-weight: 500;
}

.qrq-checkin-field { margin-bottom: 16px; text-align: left; }
.qrq-checkin-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color .25s ease;
}
.qrq-checkin-input:focus { border-color: rgba(255,255,255,.6); }
.qrq-checkin-input:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.qrq-checkin-input::placeholder { color: rgba(255,255,255,.4); }
.qrq-checkin-input.error { border-color: #f87171; }

.qrq-checkin-thanks {
    font-size: 1.1rem;
    color: rgba(255,255,255,.9);
    font-weight: 600;
    margin-top: 8px;
}

.qrq-checkin-guidance {
    font-size: .9rem;
    color: rgba(255,255,255,.7);
    margin-top: 16px;
    line-height: 1.5;
    max-width: 280px;
    text-align: center;
}

/* ---- Display page closed state ---- */

.qrq-display-closed-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.5);
    color: rgba(255,255,255,.9);
    text-align: center;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .03em;
    z-index: 10;
}

.qrq-display-closed-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 20;
}

.qrq-display-closed-overlay__text {
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 32px rgba(0,0,0,.4);
    line-height: 1.1;
}

.qrq-display-closed-overlay__sub {
    font-size: clamp(1rem, 3vw, 2rem);
    color: rgba(255,255,255,.7);
    font-weight: 500;
}

/* ---- Weekly hours on closed check-in page ---- */

.qrq-checkin-hours {
    margin-top: 20px;
    text-align: left;
}

.qrq-checkin-hours summary {
    cursor: pointer;
    color: rgba(255,255,255,.8);
    font-size: .95rem;
    font-weight: 600;
    text-align: center;
    padding: 8px;
}

.qrq-checkin-hours summary:hover { color: #fff; }

.qrq-checkin-hours__list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.qrq-checkin-hours__list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
    font-size: .9rem;
    color: rgba(255,255,255,.85);
}

.qrq-checkin-hours__list li:last-child { border-bottom: none; }

.qrq-checkin-hours__day { font-weight: 500; }
.qrq-checkin-hours__time { color: rgba(255,255,255,.7); }

/* ---- Ticket status page ---- */

.qrq-status-badge-wrap {
    margin: 16px 0 20px;
}

.qrq-status-pill {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.qrq-status-pill--waiting {
    background: rgba(255,255,255,.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,.3);
}

.qrq-status-pill--called {
    background: #22c55e;
    color: #fff;
    animation: qrq-called-pulse 1.5s ease infinite;
}

@keyframes qrq-called-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
    50% { box-shadow: 0 0 0 12px rgba(34,197,94,0); }
}

.qrq-status-pill--served {
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.6);
}

.qrq-status-pill--noshow,
.qrq-status-pill--skipped {
    background: rgba(239,68,68,.2);
    color: #fca5a5;
}

.qrq-position-info {
    margin: 16px 0;
    text-align: left;
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.qrq-position-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.qrq-position-row:last-child { border-bottom: none; }

.qrq-position-label {
    color: rgba(255,255,255,.7);
    font-size: .9rem;
}

.qrq-position-value {
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
}

.qrq-called-msg {
    margin: 24px 0;
    padding: 20px 24px;
    background: rgba(34,197,94,.2);
    border: 2px solid rgba(34,197,94,.5);
    border-radius: 12px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    animation: qrq-called-pulse 1.5s ease infinite;
}

.qrq-terminal-msg {
    margin: 24px 0;
    padding: 16px 24px;
    background: rgba(255,255,255,.08);
    border-radius: 10px;
    color: rgba(255,255,255,.7);
    font-size: 1rem;
    text-align: center;
}

.qrq-poll-status {
    font-size: .8rem;
    color: rgba(255,255,255,.4);
    margin-top: 12px;
    min-height: 1em;
}

/* ---- Skip link (accessibility) ---- */

.qrq-skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 999;
    background: #fff;
    color: #0f172a;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}
.qrq-skip-link:focus {
    left: 16px;
}

/* Fallback for browsers without :has() support (older Firefox, etc.) */
.qrq-reason-card.selected {
    border-color: #fff;
    background: rgba(255,255,255,.2);
}
.qrq-reason-radio:focus-visible + .qrq-reason-card__text {
    text-decoration: underline;
}

/* ---- Reduced motion (accessibility) ---- */

@media (prefers-reduced-motion: reduce) {
    .qrq-display-number.pulse,
    .qrq-display-cell__number.pulse { animation: none; }
    .qrq-btn-checkin:hover { transform: none; }
}

/* ---- Visually hidden (accessibility) ---- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 600px) {
    .qrq-reason-card { padding: 14px 16px; min-height: 44px; }
    .qrq-checkin-input { padding: 12px 14px; }
}
