/**
 * =====================================================================
 * Face Shape Detector Lab (faceshapedetectorlab.com)
 * Biometric Tools, Responsive Camera Viewfinder (Anti-Stretch) CSS
 * Developer: Alok Dey (https://alokdey.xyz)
 * =====================================================================
 */

/* Responsive Camera Stage Card */
.biometric-stage-card {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto 2.5rem auto;
  border-radius: 24px;
  overflow: hidden;
  background: #060911;
  border: 1px solid rgba(0, 182, 122, 0.3);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Responsive Viewfinder Container - Resolves Mobile Stretching */
.viewfinder-wrapper {
  position: relative;
  width: 100%;
  min-height: 380px;
  max-height: 520px;
  aspect-ratio: 16/9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Fix Video Element Proportions Across All Screen Sizes */
#webcam-video, #uploaded-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Prevents squishing/stretching */
  object-position: center;
  transform: scaleX(-1);
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transform: scaleX(-1);
}

/* Laser Scan Animation (Trust Emerald) */
.laser-scan-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, #00b67a 50%, transparent 100%);
  box-shadow: 0 0 15px #00b67a, 0 0 30px #73e6b9;
  opacity: 0;
  z-index: 15;
}

.scanning-active .laser-scan-line {
  opacity: 1;
  animation: tpLaserScan 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes tpLaserScan {
  0% { top: 0%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Viewfinder Framing Guide */
.viewfinder-guide {
  position: absolute;
  width: 250px;
  height: 330px;
  border: 2px dashed rgba(0, 182, 122, 0.4);
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  pointer-events: none;
  z-index: 10;
  transition: all 0.3s ease;
}

.face-detected .viewfinder-guide {
  border-color: #00b67a;
  border-style: solid;
  box-shadow: 0 0 25px rgba(0, 182, 122, 0.35);
}

/* Results Dashboard & Score Cards */
.results-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.metric-card {
  background: #121927;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 182, 122, 0.3);
}

.skin-tone-swatch-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.tone-swatch-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

.probability-bar-item {
  margin-bottom: 1rem;
}

.probability-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: #00b67a;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.privacy-shield-ribbon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #73e6b9;
  background: rgba(0, 182, 122, 0.08);
  border: 1px solid rgba(0, 182, 122, 0.25);
  padding: 0.65rem 1.35rem;
  border-radius: 9999px;
  margin: 1.75rem auto 0 auto;
  width: fit-content;
  text-align: center;
}

/* Mobile Specific Optimizations */
@media (max-width: 768px) {
  .viewfinder-wrapper {
    min-height: 420px;
    aspect-ratio: 3/4; /* Natural smartphone portrait ratio */
  }
  .viewfinder-guide {
    width: 210px;
    height: 280px;
  }
}