
/* ---------- Check-in desk (check-in-ui.js): built for a phone held in one hand ---------- */
.checkin-view {
  max-width: 760px;
  margin: 0 auto;
}

.checkin-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}

.checkin-title {
  margin: 4px 0 12px;
  overflow-wrap: anywhere;
}

.checkin-card {
  margin: 0 0 14px;
  padding: 14px;
}

.checkin-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.checkin-stats {
  display: grid;
  gap: 6px;
}

.checkin-count {
  font-size: 1.5rem;
  color: var(--ink);
}

.checkin-remaining {
  color: var(--muted);
}

.checkin-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.checkin-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.3s ease;
}

.checkin-result {
  display: flex;
  align-items: center;
  gap: 14px;
  /* The same width as the cards below it (the cards are capped at 560px), so the banner does not stick out past them. */
  width: min(100%, 560px);
  margin: 0 0 14px;
  padding: 16px;
  border-left: 8px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-text);
}

.checkin-result[hidden] {
  display: none;
}

.checkin-result-ok {
  border-left-color: #1b8a52;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.checkin-result-warn {
  border-left-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.checkin-result-error {
  border-left-color: #c62828;
  background: var(--err-bg);
  color: var(--err-text);
}

.checkin-result-body {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.checkin-result-title {
  font-size: 1.2rem;
}

.checkin-result-name {
  font-size: 1.35rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.checkin-result-meta {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.checkin-camera {
  position: relative;
  margin: 0 0 10px;
  /* The dark area around the aiming square is a huge box-shadow; without this it would darken the whole page. */
  overflow: hidden;
  border-radius: var(--radius);
}

.checkin-video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 55vh;
  object-fit: cover;
  border-radius: var(--radius);
  background: #000;
}

.checkin-video[hidden],
.checkin-frame[hidden] {
  display: none;
}

/* A square the volunteer aims the code into. */
.checkin-frame {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(60%, 260px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.checkin-scan-button {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
}

.checkin-search-row {
  display: flex;
  gap: 8px;
}

.checkin-search-row .input:first-child {
  flex: 1;
  min-width: 0;
}

.checkin-filter {
  width: auto;
  flex: none;
}

.checkin-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.checkin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.checkin-row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.checkin-row-main strong {
  overflow-wrap: anywhere;
}

.checkin-row-meta {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.checkin-row-side {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex: none;
}

.checkin-row-side .button {
  min-height: 44px;
  min-width: 96px;
  /* Undo, Change bib and Check in share one width so the buttons line up from row to row (a longer label wraps). */
  width: 9.5rem;
}

.checkin-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.checkin-event-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.checkin-event {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.checkin-event:hover,
.checkin-event:focus-visible {
  border-color: var(--brand);
  background: var(--surface-hover);
}

.checkin-event span {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.9rem;
}

.checkin-event .icon {
  grid-column: 2;
  grid-row: 1 / span 2;
}

/* ---------- bib numbers ---------- */
.checkin-result-bib {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.checkin-result-actions {
  display: grid;
  gap: 6px;
  flex: none;
}

.checkin-prompt {
  border-left: 8px solid var(--brand);
}

.checkin-bib-form {
  display: grid;
  gap: 8px;
}

.checkin-prompt-name {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.checkin-bib-input {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-height: 60px;
  text-align: center;
}

.checkin-bib-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.checkin-bib-actions .button {
  min-height: 52px;
}

.checkin-switch-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 10px;
}

.checkin-switch-row .help {
  grid-column: 1 / -1;
  margin: 0;
}

.checkin-switch {
  width: 22px;
  height: 22px;
}

.checkin-switch-row label {
  font-weight: 600;
}

.checkin-bibs-summary {
  margin: 10px 0 0;
  font-weight: 600;
}

.checkin-bibs-export {
  display: grid;
  gap: 6px;
  justify-items: start;
  margin-top: 10px;
}

.checkin-bibs-export .help {
  margin: 0;
}

/* The column picker for the bib list: the registrations list's picker, in a box. The list of columns scrolls inside the box, so the
   Cancel and Download buttons are always in view, also on a phone. */
.dialog.dialog-bib-export {
  width: min(94vw, 680px);
}

.dialog.dialog-bib-export[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog-bib-export .dialog-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 24px 24px 12px;
}

.dialog-bib-export .dialog-actions {
  flex: none;
  padding: 12px 24px 20px;
}

.dialog-bib-export .columns-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.dialog-bib-export .columns-list {
  flex: 1 1 auto;
  min-height: 140px;
  overflow: auto;
  padding-right: 4px;
}

.dialog-bib-export .columns-group:first-child {
  margin-top: 4px;
}

@media (max-width: 520px) {
  .checkin-row {
    flex-direction: column;
    align-items: stretch;
  }

  .checkin-row-side {
    grid-auto-flow: column;
    justify-content: space-between;
    align-items: center;
  }

  /* Four items can share one row on a phone, so the buttons size to their labels again there. */
  .checkin-row-side .button {
    width: auto;
  }

  .checkin-search-row {
    flex-direction: column;
  }

  .checkin-filter {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkin-bar-fill {
    transition: none;
  }
}

/* The answer to a scan (the banner, or the bib box) stays on screen while the page is scrolled down to the camera, below the site
   header, so a volunteer always sees it without scrolling back up. */
.checkin-result:not([hidden]),
.checkin-prompt:not([hidden]) {
  position: sticky;
  top: 68px;
  z-index: 10;
  box-shadow: var(--shadow-card, 0 4px 14px rgba(0, 0, 0, 0.18));
}

/* A short green flash on the camera when a code has been read. */
.checkin-frame.checkin-frame-hit {
  border-color: #1b8a52;
  box-shadow: 0 0 0 6px rgba(27, 138, 82, 0.55);
  animation: checkin-hit 0.9s ease-out;
}

@keyframes checkin-hit {
  from {
    box-shadow: 0 0 0 14px rgba(27, 138, 82, 0.8);
  }
  to {
    box-shadow: 0 0 0 6px rgba(27, 138, 82, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkin-frame.checkin-frame-hit {
    animation: none;
  }
}

/* The bib import box reuses the column picker's box; its report scrolls with the rest of the body. */
.dialog-bib-import .dialog-body {
  overflow: auto;
  gap: 4px;
}

.dialog-bib-import h3 {
  margin: 16px 0 6px;
  font-size: 0.95rem;
}

.bib-import-total {
  margin: 14px 0 4px;
  font-weight: 600;
}

.bib-import-counts {
  margin: 0;
  padding-left: 20px;
}

.bib-import-count-error {
  color: var(--err-text);
}

.bib-import-count-keep {
  color: var(--warn-text);
}

.bib-import-scroll {
  max-height: 220px;
}

.registrations-table.bib-import-table {
  min-width: 0;
}
