/* ============================================================
   FACE VERIFICATION OVERLAY — Design System Alignment
   ============================================================ */

/* ── Overlay root ──────────────────────────────────────────── */
#faceVerificationOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#faceVerificationOverlay.fv-active {
  opacity: 1;
}

/* ── Backdrop ──────────────────────────────────────────────── */
.fv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: background 0.4s ease;
}

body.dark-theme .fv-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

/* ── Container ─────────────────────────────────────────────── */
.fv-container {
  position: relative;
  z-index: 1;
  width: 95%;
  max-width: 800px;
  max-height: 95vh;
  overflow-y: auto;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  color: #333;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
  scrollbar-width: none;
}

.fv-container::-webkit-scrollbar {
  display: none;
}

body.dark-theme .fv-container {
  background: #1e1e2e;
  color: #f8f9fa;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid #2d2d44;
}

#faceVerificationOverlay.fv-active .fv-container {
  transform: translateY(0) scale(1);
}

/* ── Header ────────────────────────────────────────────────── */
.fv-header {
  text-align: center;
  padding: 30px 30px 25px;
  position: relative;
  background: #4361ee;
  color: white;
  border-bottom: none;
}

body.dark-theme .fv-header {
  background: #1e1e2e;
  border-bottom: 1px solid #333;
}

.fv-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 15px;
  font-size: 26px;
  color: white;
  backdrop-filter: blur(4px);
}

body.dark-theme .fv-header-icon {
  background: rgba(100, 181, 246, 0.1);
  color: #64b5f6;
}

.fv-title {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
  color: white;
}

body.dark-theme .fv-title {
  color: #f8f9fa;
}

.fv-subtitle {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  max-width: 500px;
  margin: 0 auto;
}

body.dark-theme .fv-subtitle {
  color: #a0aab2;
}

/* ── Body ──────────────────────────────────────────────────── */
.fv-body {
  padding: 30px;
}

/* ── Comparison panels ────────────────── */
.fv-comparison {
  display: flex;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 25px;
}

.fv-panel {
  flex: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  transition: background 0.4s ease, border-color 0.4s ease;
}

body.dark-theme .fv-panel {
  background: #252538;
  border-color: #333;
}

.fv-panel-label {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #495057;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

body.dark-theme .fv-panel-label {
  color: #aaa;
  background: rgba(0, 0, 0, 0.2);
}

.fv-panel-label i {
  color: #4361ee;
  font-size: 14px;
}

body.dark-theme .fv-panel-label i {
  color: #64b5f6;
}

.fv-img-wrapper, .fv-video-wrapper {
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  position: relative; /* Required: anchors .fv-face-guide absolute positioning */
}

.fv-img-wrapper img, .fv-video-wrapper video {
  max-width: 100%;
  max-height: 250px;
  border-radius: 10px;
  object-fit: cover;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-theme .fv-img-wrapper img, 
body.dark-theme .fv-video-wrapper video {
  border-color: #2d2d44;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fv-video-wrapper video {
  transform: scaleX(-1);
}

/* Face guide */
.fv-face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 180px;
  border: 3px dashed rgba(67, 97, 238, 0.4);
  border-radius: 50%;
  pointer-events: none;
  animation: fv-guide-pulse 2s ease-in-out infinite;
}

@keyframes fv-guide-pulse {
  0%, 100% { border-color: rgba(67, 97, 238, 0.3); transform: translate(-50%, -50%) scale(1); }
  50%      { border-color: rgba(67, 97, 238, 0.7); transform: translate(-50%, -50%) scale(1.05); }
}

/* VS divider */
.fv-vs {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fv-vs-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #4361ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
  z-index: 2;
}

body.dark-theme .fv-vs-circle {
  background: #64b5f6;
  box-shadow: 0 4px 12px rgba(100, 181, 246, 0.3);
  color: #1e1e2e;
}

/* ── Status bar ────────────────────────────────────────────── */
.fv-status {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 20px;
  border-radius: 10px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  margin-bottom: 20px;
  transition: all 0.4s ease;
}

body.dark-theme .fv-status {
  background: rgba(255, 255, 255, 0.03);
  border-color: #333;
}

.fv-status-loading { border-left: 4px solid #4361ee; }
.fv-status-success { border-left: 4px solid #28a745; background: rgba(40, 167, 69, 0.05); }
.fv-status-error   { border-left: 4px solid #dc3545; background: rgba(220, 53, 69, 0.05); }
.fv-status-info    { border-left: 4px solid #17a2b8; background: rgba(23, 162, 184, 0.05); }

.fv-status-text {
  font-size: 15px;
  font-weight: 500;
  color: #495057;
}

body.dark-theme .fv-status-text {
  color: #e0e0e0;
}

/* ── Result area ───────────────────────────────────────────── */
.fv-result {
  text-align: center;
  padding: 25px;
  border-radius: 12px;
  background: #f8f9fa;
  margin-top: 10px;
}

body.dark-theme .fv-result {
  background: rgba(255, 255, 255, 0.02);
}

.fv-result-success .fv-success-icon { color: #28a745; font-size: 60px; margin-bottom: 15px; }
.fv-result-fail .fv-fail-icon { color: #dc3545; font-size: 60px; margin-bottom: 15px; }

.fv-result h3 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: #333;
}

body.dark-theme .fv-result h3 { color: white; }

.fv-result p {
  margin: 5px 0;
  font-size: 15px;
  color: #6c757d;
}

body.dark-theme .fv-result p { color: #a0aab2; }

/* Progress bar */
.fv-progress-bar {
  width: 100%;
  max-width: 300px;
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  margin: 20px auto;
  overflow: hidden;
}

body.dark-theme .fv-progress-bar { background: #333; }

.fv-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #34d058);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fv-progress-fail { background: linear-gradient(90deg, #dc3545, #ff6b6b); }

/* ── Footer / buttons ──────────────────────────────────────── */
.fv-footer {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 20px 30px 30px;
  background: #f8f9fa;
}

body.dark-theme .fv-footer {
  background: #1e1e2e;
  border-top: 1px solid #333;
}

.fv-btn {
  padding: 12px 25px;
  min-width: 140px;
  justify-content: center;
}

/* Override standard button widths for this overlay */
#faceVerificationOverlay .submit-btn,
#faceVerificationOverlay .cancel-btn,
#faceVerificationOverlay .admin-btn {
  width: auto;
  margin: 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .fv-comparison {
    flex-direction: column;
    gap: 15px;
  }

  .fv-vs { padding: 5px 0; }
  .fv-vs-circle { width: 36px; height: 36px; font-size: 14px; }
  
  .fv-container { border-radius: 0; width: 100%; height: 100vh; max-height: 100vh; }
  
  .fv-header { padding: 25px 20px; }
  .fv-title { font-size: 22px; }
  .fv-body { padding: 20px; }
  
  .fv-footer {
    padding: 20px;
    position: sticky;
    bottom: 0;
    flex-direction: column-reverse;
  }

  #faceVerificationOverlay .submit-btn,
  #faceVerificationOverlay .cancel-btn,
  #faceVerificationOverlay .admin-btn {
    width: 100%;
  }

  .fv-img-wrapper, .fv-video-wrapper { min-height: 180px; }
}

/* ── Spinner ───────────────────────────────────────────────── */
.fv-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(67, 97, 238, 0.1);
  border-top-color: #4361ee;
  border-radius: 50%;
  animation: fv-spin 0.8s linear infinite;
}

body.dark-theme .fv-spinner {
  border-color: rgba(100, 181, 246, 0.1);
  border-top-color: #64b5f6;
}

@keyframes fv-spin { to { transform: rotate(360deg); } }
