/* ══════════════════════════════════════════════════
   VELENTRA VMS — GATE ACCESS / CHECK-IN CSS
   ══════════════════════════════════════════════════ */

/* ── PAGE HEADER ─────────────────────────────────── */
.ci-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.ci-page-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ci-gate-icon {
  font-size: 26px;
  opacity: .8;
  flex-shrink: 0;
}
.ci-page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
}
.ci-page-clock {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'DM Mono', monospace;
}

/* ── LIVE BADGE ──────────────────────────────────── */
.ci-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--c-green);
  background: color-mix(in srgb, var(--c-green) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-green) 28%, transparent);
  padding: 5px 13px;
  border-radius: var(--radius-full);
}
.ci-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c-green);
  flex-shrink: 0;
  animation: ci-pulse 2s ease-in-out infinite;
}
@keyframes ci-pulse {
  0%,100% { opacity: 1;  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-green) 30%, transparent); }
  50%      { opacity: .7; box-shadow: 0 0 0 5px color-mix(in srgb, var(--c-green) 12%, transparent); }
}

/* ── CARD SECTION HEAD ───────────────────────────── */
.ci-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ci-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ci-dot--green { background: var(--c-green); }
.ci-dot--amber { background: var(--c-amber); }
.ci-dot--blue  { background: var(--c-blue);  }
.ci-dot--red   { background: var(--c-red);   }

.ci-card-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  flex: 1;
}

/* ── STATUS PILL ─────────────────────────────────── */
.ci-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}
.ci-status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.ci-status--inactive {
  color: var(--text-dim);
  background: var(--surface2);
}
.ci-status--active {
  color: var(--c-green);
  background: color-mix(in srgb, var(--c-green) 10%, transparent);
  border-color: color-mix(in srgb, var(--c-green) 28%, transparent);
}

/* ── DETECT TAGS (QR · Face — always-on indicators) ─ */
.ci-detect-tags {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.ci-detect-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  transition: background .2s, color .2s, border-color .2s;
}
.ci-detect-tag--active {
  background: color-mix(in srgb, var(--c-green) 12%, transparent);
  color: var(--c-green);
  border-color: color-mix(in srgb, var(--c-green) 30%, transparent);
}

/* ── SCANNER LAYOUT ──────────────────────────────── */
.ci-scanner-card {
  display: flex;
  flex-direction: column;
}
.ci-scanner-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.ci-video-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 220px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ci-video-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ── SCAN FRAME OVERLAY ──────────────────────────── */
.ci-scan-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ci-scan-corner {
  position: absolute;
  width: 22px; height: 22px;
  border-color: #00ff88;
  border-style: solid;
  border-width: 0;
}
.ci-scan-corner.tl { top: 15%; left: 18%; border-top-width: 3px; border-left-width: 3px; }
.ci-scan-corner.tr { top: 15%; right: 18%; border-top-width: 3px; border-right-width: 3px; }
.ci-scan-corner.bl { bottom: 15%; left: 18%; border-bottom-width: 3px; border-left-width: 3px; }
.ci-scan-corner.br { bottom: 15%; right: 18%; border-bottom-width: 3px; border-right-width: 3px; }
.ci-scan-line {
  position: absolute;
  left: 18%; right: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff88, transparent);
  animation: ci-scan 2s linear infinite;
}
@keyframes ci-scan {
  0%   { top: 15%; }
  100% { top: 82%; }
}

/* ── CAMERA OFFLINE / ERROR ──────────────────────── */
.ci-cam-offline,
.ci-cam-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ci-cam-offline {
  background: #0c0c0c;
  color: rgba(255,255,255,.4);
}
.ci-cam-error {
  background: #130000;
  color: #ff6b6b;
  font-size: 12px;
  font-weight: 500;
  padding: 16px;
  text-align: center;
}
.ci-cam-offline-icon { font-size: 30px; opacity: .35; }
.ci-cam-offline-text { font-size: 12.5px; font-weight: 600; }
.ci-cam-offline-sub  { font-size: 11px; opacity: .55; }

/* ── FACE FRAME OVERLAY ──────────────────────────── */
.ci-face-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ci-face-oval {
  width: 44%;
  aspect-ratio: 3/4;
  border: 3px solid #4f9cf0;
  border-radius: 50%;
  /* soft vignette without blocking the QR corners */
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.22);
  animation: ci-face-pulse 2.4s ease-in-out infinite;
}
@keyframes ci-face-pulse {
  0%,100% { border-color: #4f9cf0; box-shadow: 0 0 0 9999px rgba(0,0,0,0.35), 0 0 0 3px rgba(79,156,240,0.35); }
  50%      { border-color: #00ff88; box-shadow: 0 0 0 9999px rgba(0,0,0,0.35), 0 0 0 6px rgba(0,255,136,0.25); }
}
.ci-face-label {
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.4);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  letter-spacing: .04em;
}
#ci-face-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* face progress bar */
.ci-face-progress-wrap {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
#ci-face-progress {
  height: 100%;
  width: 0%;
  background: #4f9cf0;
  border-radius: 2px;
  transition: width .1s linear;
}

/* ── SCAN HINT ───────────────────────────────────── */
.ci-scan-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  padding: 2px 0;
}

/* ── FACE RESULT BADGE ───────────────────────────── */
.ci-face-badge {
  background: color-mix(in srgb, #4f9cf0 14%, transparent) !important;
  color: #4f9cf0 !important;
  border-color: color-mix(in srgb, #4f9cf0 30%, transparent) !important;
}

/* ── MANUAL ROW ──────────────────────────────────── */
.ci-manual-row {
  display: flex;
  gap: 8px;
}
.ci-manual-input { flex: 1; }
.ci-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 18px;
  height: 38px;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.ci-scan-btn:hover { opacity: .82; }

/* ── MAIN GRID ───────────────────────────────────── */
.ci-main-grid {
  display: grid;
  grid-template-columns: 1fr 1.75fr;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.ci-right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── LIVE STATUS BODY ────────────────────────────── */
.ci-live-body {
  padding: 12px 14px;
  min-height: 90px;
}
.ci-idle-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 16px;
  gap: 5px;
  text-align: center;
}
.ci-idle-icon  { font-size: 28px; opacity: .3; }
.ci-idle-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ci-idle-sub   { font-size: 12px; color: var(--text-muted); }

/* ── SCAN RESULT ─────────────────────────────────── */
.ci-result-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.ci-result--ok     { background: color-mix(in srgb, var(--c-green) 8%,  transparent); border-color: color-mix(in srgb, var(--c-green) 30%, transparent); }
.ci-result--warn   { background: color-mix(in srgb, var(--c-amber) 8%,  transparent); border-color: color-mix(in srgb, var(--c-amber) 30%, transparent); }
.ci-result--danger { background: color-mix(in srgb, var(--c-red)   8%,  transparent); border-color: color-mix(in srgb, var(--c-red)   30%, transparent); }

.ci-result-av {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.ci-result-info    { flex: 1; min-width: 0; }
.ci-result-name    { font-size: 13.5px; font-weight: 600; }
.ci-result-meta    { font-size: 11.5px; color: var(--text-muted); }
.ci-result-pass    { font-size: 11px; color: var(--text-dim); font-family: 'DM Mono', monospace; margin-top: 2px; }
.ci-result-badge {
  font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-full);
  background: var(--surface2); border: 1px solid var(--border);
  white-space: nowrap; flex-shrink: 0;
}
.ci-result--ok   .ci-result-badge { background: color-mix(in srgb, var(--c-green) 14%, transparent); color: var(--c-green); border-color: color-mix(in srgb, var(--c-green) 28%, transparent); }
.ci-result--warn .ci-result-badge { background: color-mix(in srgb, var(--c-amber) 14%, transparent); color: var(--c-amber); border-color: color-mix(in srgb, var(--c-amber) 28%, transparent); }
.ci-result--danger .ci-result-badge { background: color-mix(in srgb, var(--c-red) 14%, transparent); color: var(--c-red); border-color: color-mix(in srgb, var(--c-red) 28%, transparent); }

.ci-result-actions {
  display: flex;
  gap: 8px;
}
.ci-result-actions .vms-btn { flex: 1; justify-content: center; }

/* ── TOAST ───────────────────────────────────────── */
.ci-toast {
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; text-align: center;
}
.ci-toast--ok     { background: color-mix(in srgb, var(--c-green) 12%, transparent); color: var(--c-green); }
.ci-toast--warn   { background: color-mix(in srgb, var(--c-amber) 12%, transparent); color: var(--c-amber); }
.ci-toast--danger { background: color-mix(in srgb, var(--c-red)   12%, transparent); color: var(--c-red); }

/* ── PENDING BODY ────────────────────────────────── */
.ci-empty-row {
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
}
.ci-pending-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.ci-pending-row:last-child { border-bottom: none; }
.ci-pending-av {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.ci-pending-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ci-pending-info  { flex: 1; min-width: 0; }
.ci-pending-name  { font-size: 13px; font-weight: 600; }
.ci-pending-meta  { font-size: 11.5px; color: var(--text-muted); }

.ci-mini-btn {
  padding: 4px 12px;
  background: color-mix(in srgb, var(--c-green) 12%, transparent);
  color: var(--c-green);
  border: 1px solid color-mix(in srgb, var(--c-green) 30%, transparent);
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.ci-mini-btn:hover { background: color-mix(in srgb, var(--c-green) 20%, transparent); }

/* ── ICON / COLLAPSE BUTTONS ─────────────────────── */
.ci-icon-btn {
  width: 24px; height: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.ci-icon-btn:hover { background: var(--hover-bg); color: var(--text); }

/* ── TODAY STATS GRID ────────────────────────────── */
.ci-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}
.ci-stat {
  background: var(--surface);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 5px;
}
.ci-stat-lbl {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim);
}
.ci-stat-val {
  font-size: 28px; font-weight: 800;
  line-height: 1; letter-spacing: -.02em;
  color: var(--text);
}

/* ── UPCOMING SECTION ────────────────────────────── */
.ci-section-card { margin-bottom: 14px; }

.ci-empty-full {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 36px 20px; gap: 6px; text-align: center;
}
.ci-empty-icon-lg    { font-size: 30px; opacity: .28; }
.ci-empty-lg-title   { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ci-empty-lg-sub     { font-size: 12px; color: var(--text-muted); }

.ci-upcoming-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.ci-upcoming-row:last-child { border-bottom: none; }

/* ── BOTTOM GRID ─────────────────────────────────── */
.ci-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.ci-checkout-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── LEGACY CLASSES (Quick Checkout checkboxes) ──── */
.checkin-check {
  font-size: 12px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
}

/* ── DEMO QR SECTION ─────────────────────────────── */
.ci-demo-qr-card { margin-bottom: 14px; }
.ci-demo-qr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
}
.ci-demo-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.ci-qr-canvas {
  background: #fff;
  border-radius: 6px;
  padding: 5px;
  line-height: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.ci-qr-canvas img,
.ci-qr-canvas canvas { display: block; border-radius: 3px; }
.ci-demo-qr-id {
  font-size: 10.5px;
  font-family: 'DM Mono', monospace;
  color: var(--text-dim);
}
.ci-demo-qr-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.ci-demo-qr-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.ci-demo-qr-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  transition: background .2s, color .2s;
}
.ci-demo-badge--green {
  background: color-mix(in srgb, var(--c-green) 14%, transparent);
  color: var(--c-green);
  border-color: color-mix(in srgb, var(--c-green) 28%, transparent);
}
.ci-demo-badge--amber {
  background: color-mix(in srgb, var(--c-amber) 14%, transparent);
  color: var(--c-amber);
  border-color: color-mix(in srgb, var(--c-amber) 28%, transparent);
}
.ci-demo-badge--gray {
  background: var(--surface2);
  color: var(--text-dim);
  border-color: var(--border);
}

/* ── DARK MODE ───────────────────────────────────── */
[data-theme="dark"] .ci-stats-grid { background: var(--border); }
[data-theme="dark"] .ci-stat       { background: var(--surface); }

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

/* ── TABLET (≤ 991px) ────────────────────────────── */
@media (max-width: 991px) {
  /* Stack main grid: scanner on top, right col below */
  .ci-main-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  /* Scanner reverts to aspect-ratio when full width */
  .ci-scanner-card {
    display: block;
  }
  .ci-scanner-body {
    flex: unset;
  }
  .ci-video-wrap {
    flex: unset;
    aspect-ratio: 16/7;
    min-height: unset;
  }

  /* Right col flows naturally */
  .ci-right-col { gap: 12px; }

  /* Bottom grid stays 2 col on tablet */
  .ci-bottom-grid { grid-template-columns: 1fr 1fr; }

  /* Upcoming row tighter */
  .ci-upcoming-row { padding: 10px 14px; }
}

/* ── LARGE MOBILE (≤ 767px) ──────────────────────── */
@media (max-width: 767px) {
  .ci-main-grid,
  .ci-bottom-grid { grid-template-columns: 1fr; }

  /* Shorter video on phone */
  .ci-video-wrap { aspect-ratio: 4/3; }

  /* Card head: allow wrap so status pill doesn't overflow */
  .ci-card-head { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .ci-card-label { flex: 1; min-width: 80px; }

  /* Manual scan row full width */
  .ci-manual-row { gap: 6px; }
  .ci-manual-input { font-size: 13px; }
  .ci-scan-btn { padding: 0 14px; font-size: 12px; }

  /* Pending rows */
  .ci-pending-row { padding: 10px 12px; }
  .ci-pending-name { font-size: 12.5px; }
  .ci-pending-meta { font-size: 11px; }

  /* Upcoming rows */
  .ci-upcoming-row { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }

  /* Stats: 2-col grid already, just tighten */
  .ci-stat { padding: 12px 14px; }
  .ci-stat-val { font-size: 24px; }

  /* Checkout checks 2-col */
  .ci-checkout-checks { grid-template-columns: 1fr 1fr; }

  /* Section card */
  .ci-section-card { margin-bottom: 12px; }
}

/* ── SMALL MOBILE (≤ 575px) ──────────────────────── */
@media (max-width: 575px) {
  /* Slimmer video on small phones */
  .ci-video-wrap { aspect-ratio: 1/1; }

  /* Card heads tighter */
  .ci-card-head { padding: 9px 11px; gap: 5px; }
  .ci-status-pill { font-size: 9.5px; padding: 2px 7px; }
  .ci-action-btn  { padding: 4px 10px; font-size: 10.5px; }

  /* Result card */
  .ci-result-card { gap: 9px; padding: 9px 10px; }
  .ci-result-name { font-size: 13px; }
  .ci-result-meta { font-size: 11px; }

  /* Checkout checks single col */
  .ci-checkout-checks { grid-template-columns: 1fr; }

  /* Idle state compact */
  .ci-idle-state { padding: 14px 12px; }
  .ci-idle-icon  { font-size: 22px; }
  .ci-idle-title { font-size: 13px; }
  .ci-idle-sub   { font-size: 11.5px; }

  /* Empty full compact */
  .ci-empty-full { padding: 24px 14px; }

  /* Live body tighter */
  .ci-live-body { padding: 10px 12px; }

  /* Stats */
  .ci-stat-val { font-size: 22px; }
  .ci-stat-lbl { font-size: 9px; }
}

/* ── EXTRA SMALL (≤ 400px) ───────────────────────── */
@media (max-width: 400px) {
  .ci-video-wrap { aspect-ratio: 4/5; }
  .ci-result-actions { flex-direction: column; gap: 6px; }
  .ci-result-actions .vms-btn { width: 100%; }
  .ci-manual-row { flex-direction: column; }
  .ci-scan-btn { width: 100%; justify-content: center; height: 38px; }
}
