/* Encounter Station — a tablet mounted at an exhibit, read at arm's length by
   someone holding a guest's phone in the other hand.
   Direction: flat operations console. Tinted neutrals, one blue accent for
   "where am I", semantic green/red only for the verdict, amber only when the
   station needs something from the operator. Every control is a 48px target.
   Layered on top of style.css, which supplies .btn/.form-group/.container. */

/* ---------------------------------------------------------------- header */

/* style.css shrinks any .validation-page header h1 to 12px with !important
   (it was written for the admission validator's chrome-free layout). The
   station's title and the identity chip are the page's top-level hierarchy,
   so they are restated here at a higher specificity. */
.validation-page .station-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin: 0 0 20px !important;
    padding-bottom: 14px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.has-staff-menu .validation-page .station-header {
    padding-left: 48px !important;
}

.validation-page .station-header h1 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: clamp(1.35rem, 4vw, 1.7rem) !important;
    font-weight: 800 !important;
    line-height: 1.1;
    color: #1a2432;
    text-align: left;
    letter-spacing: -0.01em;
}

.station-eyebrow {
    margin: 0 0 2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #718096;
}

/* Identity chip: who the board will name when a scan closes a dispatch.
   Unset is a standing prompt, not an error — amber, never red, because a
   receipt that needs no name still scans fine. */
.station-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 999px;
    background: #f7fafc;
    font-size: 0.95rem;
    color: #2d3748;
}

.station-identity.is-unset {
    border-color: #d69e2e;
    background: #fffbeb;
    color: #744210;
}

/* None of the three parts of the chip is elastic. Left to the flex defaults
   the label and the button hold their min-content while the name (min-width 0,
   because it clips) absorbs the whole deficit — "Sam Trujillo" rendered as
   "Sa…" beside a button padded out with the space it gave up. The chip is
   content-sized and the header wraps it on a narrow tablet. */
.station-identity-label {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #718096;
}

.station-identity.is-unset .station-identity-label {
    color: #975a16;
    letter-spacing: 0.02em;
    text-transform: none;
    font-size: 0.9rem;
}

/* A long name still has to stop somewhere: clipped at 14ch with the full
   value on the title attribute. */
.station-identity-name {
    flex: 0 0 auto;
    max-width: 14ch;
    overflow: hidden;
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #1a2432;
}

/* An outline button, not a second filled pill inside the chip: the chip is
   already the emphasis, and a filled control inside it reads as a nested
   capsule. Still a 48px target.
   width is stated because a <button> flex item left at `auto` resolves to the
   chip's content box in Chromium (measured: 289px for a 87px label) and spills
   out of the pill; fit-content is the label width, capped by the space. */
.validation-page.container .station-identity-btn {
    flex: 0 0 auto;
    width: fit-content;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid #cbd5e0;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    color: #2b6cb0;
    border-radius: 999px;
    box-shadow: none;
}

.validation-page.container .station-identity.is-unset .station-identity-btn {
    border-color: #d69e2e;
    background: #fff;
    color: #975a16;
}

/* ------------------------------------------------- "validating at" banner */

#station-current-exhibit {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    background: #2b6cb0;
    color: #fff;
}

#station-current-exhibit .station-current-exhibit-label {
    display: block;
    margin-bottom: 2px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
}

#station-current-exhibit-name {
    display: block;
    font-size: clamp(1.2rem, 4.5vw, 1.6rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

/* The exhibit's own animal, big enough to check from a step away — the one
   glance that catches a tablet left on yesterday's station. */
.station-current-exhibit-icon {
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    object-fit: cover;
}

.station-current-exhibit-icon.hidden { display: none; }

#station-current-exhibit.unset {
    background: #fff5f5;
    border: 2px dashed #e53e3e;
    color: #742a2a;
}

#station-current-exhibit.unset .station-current-exhibit-label { opacity: 1; color: #9b2c2c; }

/* --------------------------------------------------------- exhibit picker */

.station-setup {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
}

.station-setup label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #2d3748;
}

.station-select-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icon beside the <select>, not inside it: the select stays a plain native
   control (which is what the station JS and its tests drive). */
.station-select-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    border: 1px solid #cbd5e0;
    background: #fff;
    object-fit: cover;
}

.station-select-icon.hidden { display: none; }

.station-setup select {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 10px;
    background: #fff;
    font-size: 1.05rem;
    color: #2d3748;
}

#station-encounter-hint {
    margin: 10px 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #c53030;
}

/* ---------------------------------------------------------- scanner card */

.station-scanner {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

/* style.css frames #qr-reader with a 3px accent border for the admission
   validator, where a wrapper hides it until the camera is live. The station
   has no such wrapper, so an empty reader (no camera, permission refused, or
   before the first frame) collapses to a stray coloured bar above the status
   line. html5-qrcode fills this element when it renders, so :empty is the
   whole condition and it needs no state class of its own.

   NOT display:none: html5-qrcode sizes its <video> from this element's
   clientWidth BEFORE appending it (RenderedCameraImpl reads
   parentElement.clientWidth while the node is still empty). A node out of
   layout reports 0 and the video is created 0px wide — only rescued today by
   the `#qr-reader video { width: 100% !important }` rule in style.css. So the
   empty reader is kept in flow with a real width and no height instead. */
#qr-reader {
    max-width: 400px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
}

#qr-reader:empty {
    visibility: hidden;
    height: 0;
    border-width: 0;
}

#scanner-status {
    margin: 12px 0 0;
    text-align: center;
    font-size: 0.92rem;
    color: #718096;
}

.station-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* Rescanning is a recovery, not the main event — the camera is. Outlined and
   48px so it sits below the exhibit banner and the reader in weight. */
.validation-page.container .station-actions .btn {
    flex: 1 1 0;
    min-height: 48px;
    border: 1px solid #cbd5e0;
    background: #fff;
    font-weight: 700;
    color: #2d3748;
    box-shadow: none;
}

/* Manual entry is the fallback, so it starts folded away and the camera owns
   the screen. Kept inside a real <details> so it needs no JS of its own. */
.station-manual {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
}

.station-manual > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    color: #2b6cb0;
    cursor: pointer;
    list-style: none;
}

.station-manual > summary::-webkit-details-marker { display: none; }

.station-manual > summary::after {
    content: '\25be';
    margin-left: 12px;
    font-size: 0.9rem;
    transition: transform 120ms ease-out;
}

.station-manual[open] > summary {
    border-bottom: 1px solid #e2e8f0;
    border-radius: 10px 10px 0 0;
}

.station-manual[open] > summary::after { transform: rotate(180deg); }

#station-form {
    padding: 16px;
}

#station-form .form-group { margin-bottom: 14px; }

/* Unvalidating is an exception a manager walks over for, so it sits under a
   rule at the foot of the page instead of as a third full-width peer of
   "scan" and "type a code". Quiet, but still a 48px target. */
.station-manager-row {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.validation-page.container .station-manager-row .btn {
    width: auto;
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid transparent;
    background: none;
    font-size: 0.92rem;
    font-weight: 700;
    color: #718096;
    box-shadow: none;
}

.validation-page.container .station-manager-row .btn:hover,
.validation-page.container .station-manager-row .btn:focus-visible {
    border-color: #cbd5e0;
    background: #f7fafc;
    color: #2d3748;
}

/* Manager mode is armed: the way out has to be as obvious as the way in.
   The class lands on the page container itself (encounter_station.js), so
   this has to out-specify the quiet .validation-page.container rule above. */
.validation-page.container.station-manager-active .station-manager-row .btn {
    border-color: #d69e2e;
    background: #fffbeb;
    color: #975a16;
}

/* The submit button is the one control manager mode and a missing exhibit
   must lock out; the manager toggle itself must always stay clickable. */
.station-manager-active #station-form button[type="submit"] {
    opacity: 0.5;
    pointer-events: none;
}

.station-no-encounter #station-form button[type="submit"] {
    opacity: 0.5;
    cursor: not-allowed;
}

#station-manager-banner {
    display: none;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #f6e05e;
    border-radius: 10px;
    background: #fffbeb;
    font-size: 0.95rem;
    color: #744210;
}

#station-manager-banner.active { display: block; }

/* ------------------------------------------------------- inline results */

#station-result { margin-top: 20px; }

#station-result:empty { display: none; }

.validation-result {
    padding: 18px;
    border-radius: 12px;
    font-size: 1.05rem;
    color: #2d3748;
}

.validation-result p { margin: 8px 0; }

.validation-result p:first-child { margin-top: 0; }

.validation-result p:last-child { margin-bottom: 0; }

.validation-result.valid { border: 2px solid #38a169; background: #f0fff4; }

.validation-result.invalid { border: 2px solid #e53e3e; background: #fff5f5; }

.station-note { font-size: 0.88rem; color: #718096; }

.station-note-inline { font-size: 0.88rem; color: #718096; }

.station-summary-list { margin: 8px 0; padding-left: 18px; }

.validation-page.container .station-block-btn { width: 100%; margin-top: 12px; }

.station-redemption-pick-list {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.station-redemption-pick-list li { margin-bottom: 8px; }

.station-redemption-pick-list label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 48px;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 10px;
    background: #fff;
    font-weight: normal;
    cursor: pointer;
}

.station-redemption-pick-list label:hover { background: #f7fafc; }

.station-redemption-pick-list input { margin-top: 3px; }

.station-reverse-panel {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #f6e05e;
    border-radius: 10px;
    background: #fffbeb;
}

.station-reverse-panel p { margin: 0 0 10px; font-size: 0.9rem; color: #744210; }

/* ---------------------------------------------------------------- modals */

.station-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.station-modal.hidden { display: none; }

.station-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 36, 50, 0.55);
}

.station-modal .modal-panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 24px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 44px rgba(26, 36, 50, 0.28);
}

.station-modal h2 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1a2432;
}

.station-modal-summary {
    margin: 0 0 16px;
    font-size: 0.92rem;
    color: #718096;
}

.station-modal label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #4a5568;
}

.station-modal input,
.station-modal textarea {
    width: 100%;
    min-height: 48px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    color: #2d3748;
}

.station-modal input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin: 3px 0 0;
}

.station-modal .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.station-modal .modal-actions .btn { flex: 1 1 0; min-height: 52px; }

.station-modal-error {
    margin: 6px 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #c53030;
}

.station-modal input[aria-invalid="true"] { border-color: #c53030; }

.station-field-hint {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #718096;
}

#station-staff-name-field { margin-top: 4px; }

#station-staff-name-field > label { margin-top: 12px; }

#reverse-refund-panel {
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

#reverse-refund-panel label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-weight: 700;
    cursor: pointer;
}

#reverse-refund-note {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: #718096;
}

#reverse-refund-unavailable {
    margin: 0 0 14px;
    font-size: 0.85rem;
    color: #744210;
}

/* -------------------------------------------------------- outcome overlay */

#station-outcome {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #f7fafc;
}

#station-outcome.hidden { display: none; }

.station-outcome-panel {
    width: 100%;
    max-width: 430px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px 22px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 36px rgba(26, 36, 50, 0.14);
}

.station-outcome-panel.approved { border: 4px solid #38a169; background: #c6f6d5; }

.station-outcome-panel.denied { border: 4px solid #e53e3e; background: #fed7d7; }

/* The exhibit the verdict belongs to, above the verdict itself. */
.station-outcome-exhibit-icon {
    display: block;
    width: 84px;
    height: 84px;
    margin: 0 auto 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
    object-fit: cover;
}

.station-outcome-exhibit-icon.hidden { display: none; }

/* The verdict glyph sits between the exhibit photo and the word, so it has to
   read as part of the word rather than as a second picture: same colour as
   the title, tucked under it. */
.station-outcome-icon {
    margin-bottom: 2px;
    font-size: 2.25rem;
    line-height: 1;
    color: #4a5568;
}

.station-outcome-panel.approved .station-outcome-icon { color: #276749; }

.station-outcome-panel.denied .station-outcome-icon { color: #9b2c2c; }

.station-outcome-title {
    margin: 0 0 6px;
    font-size: clamp(1.4rem, 5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.station-outcome-panel.approved .station-outcome-title { color: #22543d; }

.station-outcome-panel.denied .station-outcome-title { color: #742a2a; }

.station-outcome-subtitle {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3748;
}

/* How many walked in, as the one number staff re-read while counting heads. */
.station-outcome-count {
    margin: 0 0 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #22543d;
}

.station-outcome-count.hidden { display: none; }

.station-outcome-count strong {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: -2px;
}

/* All-Access: this exhibit was not bought, the pass covers it, and the scan
   just put a served row on the dispatch board under someone's name. */
.station-outcome-chip {
    display: inline-block;
    margin: 0 0 14px;
    padding: 8px 14px;
    border: 1px solid #2b6cb0;
    border-radius: 999px;
    background: #ebf8ff;
    font-size: 0.92rem;
    font-weight: 700;
    color: #21507f;
}

.station-outcome-chip.hidden { display: none; }

.station-outcome-details {
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 10px;
    background: #fff;
    text-align: left;
    font-size: 0.95rem;
    color: #4a5568;
}

.station-outcome-details p { margin: 6px 0; }

.station-outcome-details p:first-child { margin-top: 0; }

.station-outcome-details ul { margin: 8px 0; padding-left: 18px; }

.station-outcome-action { width: 100%; margin-top: 4px; min-height: 60px; }

.station-outcome-panel .station-reverse-panel {
    margin-top: 14px;
    margin-bottom: 0;
    text-align: left;
}

@media (prefers-reduced-motion: reduce) {
    .station-manual > summary::after { transition: none; }
}
