/* ==========================================================================
   GATE PASS — Pass + Scan styling
   Flagship feature: camera-first, full-screen, instant ACCESS GRANTED/DENIED.
   ========================================================================== */

/* ---- QR view (resident's pass) ---- */
.qr-view {
  align-items: center;
  text-align: center;
  gap: 16px;
}
.qr-view canvas {
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: white;
  padding: 12px;
  box-shadow: var(--shadow-md);
}
.qr-view__hint {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- Connection pill removed (v30): noisy green ONLINE badge — global
   #offline-bar in index.html surfaces connectivity now. ---- */

/* ============================================================
   SCAN SCREEN — Camera-first, large stage
   ============================================================ */
.scan {
  max-width: 760px;
  margin-inline: auto;
}

.scan__stage {
  position: relative;
  aspect-ratio: 1;
  max-width: 480px;
  width: 100%;
  margin-inline: auto;
  background: #0a0a0a;                 /* explicit near-black, mono-system */
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--gray-200);   /* hairline on the OUTSIDE matches system */
}
.scan__stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Corner reticle */
.scan__reticle {
  position: absolute;
  inset: 18%;
  border-radius: var(--radius-md);
  --c: rgba(255,255,255,0.92);         /* explicit white — visible on near-black stage */
  --t: 3px;
  --s: 28px;
  background:
    linear-gradient(var(--c),var(--c)) top left / var(--s) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) top left / var(--t) var(--s) no-repeat,
    linear-gradient(var(--c),var(--c)) top right / var(--s) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) top right / var(--t) var(--s) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom left / var(--s) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom left / var(--t) var(--s) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom right / var(--s) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom right / var(--t) var(--s) no-repeat;
  pointer-events: none;
}

/* Scan line */
.scan__stage::after {
  content: "";
  position: absolute;
  left: 18%; right: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);
  top: 18%;
  animation: scan-line 2.4s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(255,255,255,0.55);
}
@keyframes scan-line {
  0%   { top: 18%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 82%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .scan__stage::after { display: none; } }

/* Big start-camera overlay button. Sits centered on the dark video frame
   so a security guard can hit it without scrolling. Auto-hides once the
   camera stream is running. */
.scan__start-overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 60%;
  max-width: 240px;
  height: 60%;
  max-height: 240px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--text-primary);
  border: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transition: transform 120ms ease-out, background 120ms ease-out;
}
.scan__start-overlay:hover { background: #fff; transform: scale(1.02); }
.scan__start-overlay:active { transform: scale(0.98); }

/* Tiny floating "X" stop button — only shown while streaming. Sits top-right
   of the video frame so it doesn't block the reticle or scan line. */
.scan__stop-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.scan__stop-overlay:hover { background: rgba(0,0,0,0.75); }

/* Dashboard address line (resident) — moved out of the welcome subtitle
   in sprint 2; smaller, single-line, neutral. */
.dash-address-line {
  margin-top: 4px;
  font-size: 13px;
}

.scan__manual summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  padding: 8px 0;
  user-select: none;
}
.scan__manual summary:hover { color: var(--text-primary); }

/* ============================================================
   VERIFICATION RESULT — Massive ACCESS GRANTED / DENIED
   The most critical UI surface — readable from a distance.
   ============================================================ */
/* The most critical UI surface — readable from a distance, but quiet enough
   that the GREEN check / RED X icon does the talking. Card stays neutral. */
.result {
  margin-top: 20px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: fade-in var(--duration-base) var(--ease-out);
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
}

.result--pending {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: var(--weight-medium);
}

.result--allow,
.result--deny {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 32px 24px 24px;
  position: relative;
}
.result--allow { box-shadow: inset 0 3px 0 #16a34a; background: var(--color-success-bg); }
.result--deny  { box-shadow: inset 0 3px 0 #dc2626; background: var(--color-danger-bg); }
.result--allow .result__decision { color: #15803d; }
.result--deny  .result__decision { color: #b91c1c; }

.result__icon {
  width: 96px; height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result__icon svg { width: 96px; height: 96px; }
.result--allow .result__icon { color: #16a34a; }
.result--deny  .result__icon { color: #dc2626; }

/* Subtle entry animation — the icon "pops" so it reads instantly */
@keyframes result-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.result__icon svg { animation: result-pop 240ms var(--ease-spring) both; }
@media (prefers-reduced-motion: reduce) {
  .result__icon svg { animation: none; }
}

.result__decision {
  font-size: 28px;
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
}

.result__visitor {
  font-size: 16px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.result__reason {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 36ch;
  line-height: 1.5;
}

.result__tags {
  display: flex;
  gap: 6px;
}
.result__tag {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-muted);
  border: 1px solid var(--surface-border);
}

.result__action {
  margin-top: 8px;
  min-width: 160px;
}

/* ---- Alert list items ---- */
.list-item--alert { border-left: 3px solid var(--color-warning); }

/* ============================================================
   PASS DISPLAY (resident "Show pass" modal)
   ============================================================ */
.pass-display { align-items: center; text-align: center; gap: 20px; }

.pass-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface-sunken);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  text-align: left;
}
.pass-meta > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.pass-meta__label {
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--text-2xs);
}
.pass-meta__value {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.pass-qr canvas {
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: white;
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

/* Pass code "ticket" block — sits below the QR. Was navy + gold; now a
   bordered light surface so it matches the system and the code remains
   the clear focal point (large mono numerals). */
.pass-code {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  text-align: center;
}
.pass-code__label {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pass-code__value {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  color: var(--text-primary);
  user-select: all;
}

.pass-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* Inline pass code in tables */
.pass-code-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  padding: 2px 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

/* Single-entry note in issue modal */
.pass-type-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-sunken);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.pass-type-note svg { color: var(--text-secondary); flex-shrink: 0; margin-top: 1px; }
.pass-type-note strong { display: block; color: var(--text-primary); margin-bottom: 2px; }
.pass-type-note > div > div { color: var(--text-secondary); font-size: 12px; }

/* ============================================================
   SCAN — Tabs, manual entry, search
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-sunken);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  width: 100%;
}
.tab-btn {
  flex: 1;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.tab-btn:hover { color: var(--text-primary); background: var(--surface-raised); }
.tab-btn[aria-selected="true"] {
  background: var(--surface-raised);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

/* Manual code input — big, monospace */
.field__input--code {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  height: 56px;
  padding: 0 16px;
  text-align: center;
}

/* Larger search input */
.search-input--lg {
  max-width: 100%;
  height: 44px;
  padding: 0 16px;
  font-size: 15px;
}
.search-input--lg input { font-size: 15px; }

/* Result visitor name — superseded by the rule earlier in this file
   (v32: neutral card). Kept empty stub to avoid stale-cache surprises. */

/* Static "point the camera" instruction under the scanner */
.scan__instruction {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Camera hint (permission/HTTPS errors) */
.scan__camera-hint {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #92400e;
  text-align: center;
}
