/* =================================================================
   KYC LIVENESS DETECTION UI — Dark Camera Style
   ================================================================= */

/* ----------------------------------------------------------------
   Container
   ---------------------------------------------------------------- */
.kyc-liveness-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0;
  background: #0d0d14;
  border-radius: 16px;
  overflow: hidden;
  min-height: 480px;
}

/* ----------------------------------------------------------------
   Header
   ---------------------------------------------------------------- */
.kyc-liveness-header {
  text-align: center;
  padding: 24px 24px 0;
  color: #fff;
}
.kyc-liveness-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}
.kyc-liveness-header p {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin: 0;
}

/* ----------------------------------------------------------------
   Camera Area
   ---------------------------------------------------------------- */
.kyc-camera-area {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 3/4;
  background: #111118;
  border-radius: 12px;
  overflow: hidden;
}

#kyc-live-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror effect */
  border-radius: 12px;
}

#kyc-live-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: scaleX(-1);
  border-radius: 12px;
  pointer-events: none;
}

/* ----------------------------------------------------------------
   Oval SVG Guide
   ---------------------------------------------------------------- */
.kyc-oval-wrap {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.kyc-oval-svg {
  width: 75%;
  height: 85%;
  overflow: visible;
}

.kyc-oval-bg {
  fill: rgba(0,0,0,0.4);
}

.kyc-oval-track {
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 3;
}

.kyc-oval-progress {
  fill: none;
  stroke: #6366f1;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

/* States */
.kyc-liveness-wrap.state-detecting .kyc-oval-progress {
  stroke: #6366f1;
  animation: kycOvalPulse 2s infinite;
}
.kyc-liveness-wrap.state-challenge .kyc-oval-progress {
  stroke: #f59e0b;
}
.kyc-liveness-wrap.state-success .kyc-oval-progress {
  stroke: #10b981;
  stroke-dashoffset: 0;
  animation: none;
}
.kyc-liveness-wrap.state-done .kyc-oval-progress {
  stroke: #10b981;
  stroke-dashoffset: 0;
}

@keyframes kycOvalPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ----------------------------------------------------------------
   Overlay dim (outside oval)
   ---------------------------------------------------------------- */
.kyc-oval-mask {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ----------------------------------------------------------------
   Instruction Card (inside camera area)
   ---------------------------------------------------------------- */
.kyc-live-instruction {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 40px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transition: all 0.3s ease;
  z-index: 5;
}

.kyc-live-instr-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.3s ease;
}

.kyc-live-instr-text {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.1px;
}

/* Animate icon bounce on challenge change */
@keyframes kycIconBounce {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.kyc-live-instruction.anim-new .kyc-live-instr-icon {
  animation: kycIconBounce 0.4s ease forwards;
}

/* ----------------------------------------------------------------
   Challenge Progress Dots
   ---------------------------------------------------------------- */
.kyc-challenge-dots {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 4px;
}

.kyc-challenge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.25);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kyc-challenge-dot.active {
  background: #f59e0b;
  border-color: #f59e0b;
  transform: scale(1.3);
  box-shadow: 0 0 10px rgba(245,158,11,0.6);
}

.kyc-challenge-dot.done {
  background: #10b981;
  border-color: #10b981;
  transform: scale(1);
  box-shadow: 0 0 8px rgba(16,185,129,0.5);
}

/* ----------------------------------------------------------------
   Loading / Status Overlay
   ---------------------------------------------------------------- */
.kyc-live-status {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  z-index: 20;
  border-radius: 12px;
  gap: 16px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  text-align: center;
  padding: 24px;
  box-sizing: border-box;
}

.kyc-live-status.hidden {
  display: none !important;
}

.kyc-live-status-icon {
  font-size: 44px;
  line-height: 1;
}

.kyc-live-status-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.kyc-live-status-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin: 0;
  max-width: 260px;
  line-height: 1.5;
}

/* Loading spinner */
.kyc-live-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99,102,241,0.3);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: kycSpin 0.8s linear infinite;
}

@keyframes kycSpin {
  to { transform: rotate(360deg); }
}

/* ----------------------------------------------------------------
   Success Flash
   ---------------------------------------------------------------- */
.kyc-success-flash {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #10b981;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  border-radius: 12px;
  animation: none;
}

.kyc-success-flash.fire {
  animation: kycSuccessFlash 0.5s ease-out forwards;
}

@keyframes kycSuccessFlash {
  0%   { opacity: 0.7; }
  100% { opacity: 0; }
}

/* ----------------------------------------------------------------
   Camera Denied State
   ---------------------------------------------------------------- */
.kyc-cam-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background: #0d0d14;
  border-radius: 16px;
  gap: 16px;
  color: #fff;
  width: 100%;
}

.kyc-cam-denied-icon {
  font-size: 48px;
}

.kyc-cam-denied h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: #ef4444;
}

.kyc-cam-denied p {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin: 0;
  line-height: 1.6;
}

.kyc-cam-retry-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}
.kyc-cam-retry-btn:hover {
  box-shadow: 0 8px 20px rgba(99,102,241,0.45);
  transform: translateY(-1px);
}

/* ----------------------------------------------------------------
   Step 5 panel override (dark background)
   ---------------------------------------------------------------- */
.kyc-step-panel[data-panel="5"] {
  background: #0d0d14;
  padding: 20px !important;
}

.kyc-step-panel[data-panel="5"] .kyc-step-panel-header h2 {
  color: #fff;
}
.kyc-step-panel[data-panel="5"] .kyc-step-panel-header p {
  color: rgba(255,255,255,0.55);
}

/* ----------------------------------------------------------------
   Done checkmark
   ---------------------------------------------------------------- */
@keyframes kycCheckPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}

.kyc-check-anim {
  display: inline-block;
  animation: kycCheckPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
