/* ============================================================ */
/* ICE LOGIX: ALIPAY-STYLE FULLSCREEN PASSPORT & ID SCANNER     */
/* ============================================================ */

.kyc-scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.kyc-scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.kyc-scanner-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.kyc-scanner-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  pointer-events: auto;
  z-index: 10;
}

.kyc-scanner-footer {
  padding: 16px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: linear-gradient(0deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0) 100%);
  pointer-events: auto;
  z-index: 10;
}

/* Step thumbnail preview in footer */
.kyc-thumb-preview {
  position: relative;
  width: 46px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid #10b981;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
  animation: kycCardPopIn 0.3s ease;
  flex-shrink: 0;
}
.kyc-thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.kyc-thumb-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #10b981;
  color: #000;
  font-size: 8px;
  font-weight: 900;
  padding: 0 4px;
  border-top-left-radius: 4px;
}

.kyc-scanner-frame-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
}

.kyc-scanner-viewfinder {
  position: relative;
  width: calc(100vw - 44px);
  max-width: 380px;
  aspect-ratio: 1.42;
  border-radius: 20px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(34, 211, 238, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  box-sizing: border-box;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), aspect-ratio 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.kyc-scanner-viewfinder.id-card-mode {
  aspect-ratio: 1.58;
}

/* Вертикальный режим видоискателя для 1 страницы паспорта РБ (стр. 25–28 со штампом прописки) */
.kyc-scanner-viewfinder.is-portrait {
  width: min(calc(100vw - 64px), 320px);
  max-width: 320px;
  max-height: 58vh;
  aspect-ratio: 0.74; /* Пропорции 1 страницы паспорта РБ 88x125 мм */
  padding: 16px 12px;
}

/* Кнопка смены ориентации рамки */
.kyc-orientation-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(34, 211, 238, 0.45);
  color: #22d3ee;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(34, 211, 238, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 15;
}
.kyc-orientation-toggle-btn:hover {
  border-color: #38bdf8;
  color: #fff;
  background: rgba(14, 116, 144, 0.6);
}
.kyc-orientation-toggle-btn:active {
  transform: scale(0.94);
  background: rgba(34, 211, 238, 0.3);
}

/* Neon corner guides */
.kyc-scanner-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: #22d3ee;
  border-style: solid;
  pointer-events: none;
  filter: drop-shadow(0 0 6px #22d3ee);
}
.kyc-scanner-corner.tl { top: -1px; left: -1px; border-width: 3.5px 0 0 3.5px; border-top-left-radius: 20px; }
.kyc-scanner-corner.tr { top: -1px; right: -1px; border-width: 3.5px 3.5px 0 0; border-top-right-radius: 20px; }
.kyc-scanner-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 3.5px 3.5px; border-bottom-left-radius: 20px; }
.kyc-scanner-corner.br { bottom: -1px; right: -1px; border-width: 0 3.5px 3.5px 0; border-bottom-right-radius: 20px; }

/* Laser scanner beam */
@keyframes kycScannerLaserMotion {
  0% { top: 4%; opacity: 0.9; }
  50% { top: 96%; opacity: 1; }
  100% { top: 4%; opacity: 0.9; }
}

.kyc-scanner-laser {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, #22d3ee, #38bdf8, #22d3ee, transparent);
  box-shadow: 0 0 14px #22d3ee, 0 0 24px rgba(34, 211, 238, 0.6);
  animation: kycScannerLaserMotion 2.4s infinite ease-in-out;
  pointer-events: none;
  z-index: 5;
}

/* Target guide boxes inside frame */
.kyc-target-box-mrz {
  border: 1px dashed rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.09);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  font-size: 11px;
  font-family: monospace;
  letter-spacing: 0.5px;
  pointer-events: none;
  user-select: none;
}

.kyc-target-box-name {
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  pointer-events: none;
  user-select: none;
}

/* Shutter flash animation */
@keyframes kycShutterFlashAnim {
  0% { opacity: 0; }
  50% { opacity: 0.9; }
  100% { opacity: 0; }
}

.kyc-shutter-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  pointer-events: none;
  z-index: 100000;
  animation: kycShutterFlashAnim 0.28s ease-out forwards;
}

/* Big circular camera shutter button */
.kyc-shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 4px solid #fff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.kyc-shutter-btn:active {
  transform: scale(0.92);
  border-color: #22d3ee;
}

.kyc-shutter-btn-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transition: background 0.15s ease;
}

.kyc-shutter-btn:active .kyc-shutter-btn-inner {
  background: #22d3ee;
}

/* Pulse badge for scanning status */
@keyframes kycPulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(34, 211, 238, 0.3); }
  50% { box-shadow: 0 0 20px rgba(34, 211, 238, 0.7); }
}

.kyc-scanner-badge-active {
  animation: kycPulseGlow 1.8s infinite ease-in-out;
}

/* ============================================================ */
/* ALIPAY LIVE DETECTOR, PROGRESS & IN-SCANNER RETRY CARD        */
/* ============================================================ */

/* Viewfinder locked & stable state (emerald glow) */
.kyc-scanner-viewfinder.is-locked {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), 0 0 28px rgba(16, 185, 129, 0.55);
}
.kyc-scanner-viewfinder.is-locked .kyc-scanner-corner {
  border-color: #10b981 !important;
  filter: drop-shadow(0 0 8px #10b981) !important;
}
.kyc-scanner-viewfinder.is-locked .kyc-scanner-laser {
  background: linear-gradient(90deg, transparent, #10b981, #34d399, #10b981, transparent) !important;
  box-shadow: 0 0 16px #10b981, 0 0 28px rgba(16, 185, 129, 0.7) !important;
  animation-duration: 1.2s !important;
}

/* Live dynamic guide pill */
.kyc-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  pointer-events: none;
  user-select: none;
}

.kyc-live-pill.is-locked {
  background: rgba(6, 78, 59, 0.95);
  border-color: rgba(52, 211, 153, 0.8);
  color: #a7f3d0;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
  transform: scale(1.03);
}

.kyc-live-pill.is-warning {
  background: rgba(120, 53, 15, 0.95);
  border-color: rgba(251, 191, 36, 0.8);
  color: #fef08a;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

/* Progress bar inside viewfinder for auto-capture */
.kyc-auto-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 5px;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
  box-shadow: 0 0 12px #10b981;
  transition: width 0.08s ease-out;
  z-index: 10;
}

/* In-scanner smart retry card (no native blocking alert modal) */
.kyc-retry-card {
  position: absolute;
  inset: 16px;
  margin: auto;
  max-width: 340px;
  height: max-content;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: 24px;
  padding: 22px;
  text-align: center;
  z-index: 60;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(244, 63, 94, 0.2);
  animation: kycCardPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* In-scanner step transition card (pause between step 1 and step 2) */
.kyc-step-transition-card {
  position: absolute;
  inset: 16px;
  margin: auto;
  max-width: 340px;
  height: max-content;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  z-index: 60;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.85), 0 0 35px rgba(34, 211, 238, 0.25);
  animation: kycCardPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes kycCardPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}


