/* ==== 15b. QR tag scanner ---------------------------------------
   Rendered by components/qr_scanner.rs, driven by static/qr-scanner.js
   (+ static/jsqr.min.js). Opens the device camera and reads a QR care
   tag; the decoded payload opens the linked case. Same card language
   as `.video`.
   ====================================================================== */

.qr-scanner {
  padding: 1.25rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-lg);
  background: var(--ta-surface);
}

.qr-scanner>h2 {
  margin: 0 0 0.25rem;
}

.qr-intro {
  margin: 0 0 1rem;
  color: var(--ta-muted);
  font-size: 0.92rem;
}

.qr-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 30rem;
  aspect-ratio: 4 / 3;
  border-radius: var(--ta-r);
  background: #000;
}

.qr-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Aim reticle: a dimmed surround with a centred accent frame. */
.qr-overlay::before {
  content: "";
  position: absolute;
  inset: 16%;
  border: 2px solid var(--ta-accent);
  border-radius: var(--ta-r-sm);
  box-shadow: 0 0 0 100vmax rgba(5, 8, 12, 0.35);
  pointer-events: none;
}

.qr-overlay::after {
  content: "Scanning…";
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: rgba(5, 8, 12, 0.6);
  color: #fff;
  font-family: var(--ta-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.qr-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.qr-controls .btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease,
    color 0.12s ease;
}

.qr-controls .btn:hover {
  border-color: var(--ta-accent);
  color: var(--ta-accent);
}

.qr-controls .btn.primary {
  background: var(--ta-accent);
  border-color: var(--ta-accent);
  color: #fff;
}

.qr-controls .btn.primary:hover {
  background: var(--ta-accent-hover);
  border-color: var(--ta-accent-hover);
  color: #fff;
}

.qr-status {
  margin: 0.75rem 0 0;
  color: var(--ta-muted);
  font-family: var(--ta-mono);
  font-size: 0.8rem;
}

.qr-result {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface-2);
  font-size: 0.9rem;
}

/* ======================================================================
   PARITY B06 — QR code block, QR-scan viewfinder, live embeds.
   Ported from old blocks/qr.tsx, qr-scan.tsx, embed-controls.tsx and
   embed-session.tsx (renderers: components/qr.rs, qr_scan.rs,
   embed_controls.rs, embed_session.rs). The `.qr-scanner` care-tag block
   above is untouched.
   ====================================================================== */

/* Shared Panel face — the old `Panel` in blocks/_shared.tsx: a glass card
   that owns its own box. The header rule must reach the pane edges, so the
   card is padding-free and the radius sits on the card step (old
   `rounded-xl` = the reference's --radius-xl), matching the house gauge /
   kpi-row grammar (flex column, clipping pane must not shrink). */
.qr-block,
.embed-controls,
.embed-session {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--ta-r-xl);
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.qr-block-head,
.embed-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--ta-border);
}

.qr-block-title,
.embed-controls-title {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.014em;
}

/* ---- QR code (old blocks/qr.tsx) -------------------------------------
   The code centres in whatever height the row gives the panel instead of
   clumping under the header (flex-1 + justify-center). */
.qr-block-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
}

.qr-block-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

/* The code's own white card — always white, never themed, so a scanned
   code keeps maximum contrast against the surrounding surface. */
.qr-block-card {
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.75rem;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.1), var(--ta-shadow-sm);
}

.qr-matrix {
  display: block;
  width: 11rem;
  height: auto;
}

.qr-block-value {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ta-mono);
  font-size: 0.75rem;
  color: var(--ta-muted);
}

/* ---- QR-scan viewfinder (old blocks/qr-scan.tsx) ---------------------
   The viewfinder IS the block: no frame, no heading — a dark box with the
   hint line at the foot. The reference claims `h-full` of its screen; in a
   stacked page `min-h-[24rem]` is what keeps it tall. */
.qr-scan {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 24rem;
  overflow: hidden;
  border-radius: var(--ta-r-xl);
  background: #0a0a0a;
  margin-bottom: 1.5rem;
}

.qr-scan-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem 1.5rem;
  text-align: center;
  background: linear-gradient(to top, rgb(0 0 0 / 0.7), transparent);
  pointer-events: none;
}

.qr-scan-msg {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: rgb(255 255 255 / 0.8);
}

/* ---- Live embeds (old blocks/embed-controls.tsx, embed-session.tsx) --
   The 16:9 sandboxed frame. `aspect-ratio` gives the box its height; the
   iframe fills it. */
.embed-controls-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.embed-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.embed-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  max-width: 100%;
}

.embed-empty-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
}

/* The terse centred empty state (old `Empty` → EmptyState compact): a
   description-only line inside a panel. Shared by qr/embed/region/pdf. */
.empty-compact {
  margin: 0 auto;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  padding: 2rem 1.5rem;
}

.empty-compact p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--ta-muted);
}