/* ── Face Capture Enrollment Panel (§14.2) ───────────────────────────────── */

.face-capture-viewport {
  position: relative;
  width: 100%;
  max-width: 760px;
  align-self: center;
}

.face-capture-viewport video,
.face-capture-viewport canvas {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.75rem;
  object-fit: cover;
  display: block;
}

.face-capture-viewport video {
  background: #000;
  /* Selfie view — people position themselves against a mirror image. The
     bounding box drawn on the overlay canvas is mirrored to match in JS. */
  transform: scaleX(-1);
}

/* The canvas is an overlay ON TOP of the video — any opaque background here
   blacks out the live preview while detection keeps running underneath. */
.face-capture-viewport canvas {
  position: absolute;
  inset: 0;
  height: 100%;
  background: transparent;
  pointer-events: none;
}

/* Oval positioning guide (same visual as the clock terminal): a face-shaped
   cutout with a dimmed surround. The border colour reports placement state. */
.face-capture-oval {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-radius: 0.75rem;
  overflow: hidden;
}

.face-capture-oval::after {
  content: '';
  display: block;
  width: 46%;
  aspect-ratio: 3 / 4;
  border: 3px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s ease;
}

.face-capture-viewport[data-guide='ok'] .face-capture-oval::after {
  border-color: rgba(34, 197, 94, 0.95);
}

.face-capture-viewport[data-guide='adjust'] .face-capture-oval::after {
  border-color: rgba(245, 158, 11, 0.95);
}

.face-capture-viewport[data-guide='none'] .face-capture-oval::after {
  border-color: rgba(239, 68, 68, 0.9);
}

/* Live placement hint chip (move closer / back / center / keep level). */
.face-capture-hint {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  white-space: nowrap;
  pointer-events: none;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Animated head-turn arrows: repeat a nudging slide toward the required
   direction until the pose registers. */
.face-capture-arrow {
  position: absolute;
  top: 50%;
  margin-top: -2.25rem;
  width: 4.5rem;
  height: 4.5rem;
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.face-capture-arrow--left {
  left: 4%;
  animation: face-arrow-nudge-left 1.1s ease-in-out infinite;
}

.face-capture-arrow--right {
  right: 4%;
  animation: face-arrow-nudge-right 1.1s ease-in-out infinite;
}

@keyframes face-arrow-nudge-left {
  0%, 100% { transform: translateX(0); opacity: 0.85; }
  50% { transform: translateX(-1.1rem); opacity: 1; }
}

@keyframes face-arrow-nudge-right {
  0%, 100% { transform: translateX(0); opacity: 0.85; }
  50% { transform: translateX(1.1rem); opacity: 1; }
}

/* Stage progress pips under the viewport. */
.face-capture-stages {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.face-capture-stage-pip {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}

.face-capture-stage-pip--done {
  background: #16a34a;
}

.face-capture-stage-pip--active {
  background: #6366f1;
  transform: scale(1.35);
}

.face-capture-bar {
  width: 100%;
  height: 0.375rem;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 9999px;
  overflow: hidden;
}

.face-capture-bar-fill {
  height: 100%;
  background: #6366f1;
  border-radius: 9999px;
  transition: width 0.25s ease;
  width: 0%;
}

.face-capture-countdown {
  width: 100%;
  height: 0.25rem;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 9999px;
  overflow: hidden;
}

.face-capture-countdown-fill {
  height: 100%;
  background: #f59e0b;
  border-radius: 9999px;
  width: 100%;
  transition: width linear;
}

.face-enroll-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

/* ── Face Clock Terminal Panel (§14.3) ───────────────────────────────────── */

.face-clock-viewport {
  position: relative;
  width: 100%;
  max-width: 560px;
  align-self: center;
}

.face-clock-viewport video,
.face-clock-viewport canvas {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.5rem;
  object-fit: cover;
  display: block;
}

.face-clock-viewport video {
  background: #000;
}

/* Same as the enrollment overlay: the canvas must stay transparent or it
   covers the live video with a black sheet. */
.face-clock-viewport canvas {
  position: absolute;
  inset: 0;
  height: 100%;
  background: transparent;
  pointer-events: none;
}

.face-oval-guide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.face-oval-guide::after {
  content: '';
  display: block;
  width: 52%;
  aspect-ratio: 3 / 4;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}

.face-clock-direction {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.face-clock-failed-card {
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
}

.dark .face-clock-failed-card {
  background: rgba(153, 27, 27, 0.2);
  color: #fca5a5;
  border-color: #7f1d1d;
}
