/* =============================================================================
   MFA(2차 인증) 전용 듀얼테마 UI 스타일시트
   - OTP 6자리 입력기, 안면 인식 스캐너, MFA 설정 토글
   - InfraLink Modern UI 디자인 표준 준수
   ============================================================================= */

/* ─── MFA 인증 오버레이 모달 ─── */
.mfa-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mfaFadeIn 0.3s ease;
}

@keyframes mfaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mfa-modal {
  background: var(--bg-card-solid, #1a1e2e);
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.12));
  border-radius: 20px;
  width: 92%;
  max-width: 440px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(56, 189, 248, 0.08);
  overflow: hidden;
  animation: mfaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mfaSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="light"] .mfa-modal {
  background: #ffffff !important;
  border-color: rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12) !important;
}

/* ─── 모달 헤더 ─── */
.mfa-header {
  padding: 28px 28px 0;
  text-align: center;
}

.mfa-header .mfa-shield {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.3);
}

.mfa-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main, #f8fafc);
  margin: 0 0 6px;
}

.mfa-header p {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  line-height: 1.5;
}

[data-theme="light"] .mfa-header h2 { color: #0f172a !important; }
[data-theme="light"] .mfa-header p { color: #64748b !important; }

/* ─── 탭 전환 바 ─── */
.mfa-tabs {
  display: flex;
  gap: 0;
  margin: 20px 28px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.12));
}

.mfa-tab {
  flex: 1;
  padding: 10px 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  background: var(--bg-secondary, rgba(30, 41, 59, 0.5));
  color: var(--text-muted, #94a3b8);
  border: none;
  transition: all 0.2s ease;
}

.mfa-tab.active {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8) !important;
  color: #ffffff !important;
}

.mfa-tab:not(.active):hover {
  background: var(--bg-card-hover, rgba(56, 189, 248, 0.08));
  color: var(--text-main, #f8fafc);
}

[data-theme="light"] .mfa-tab:not(.active) {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

/* ─── OTP 입력기 ─── */
.mfa-panel { padding: 24px 28px 28px; }

.otp-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 16px;
}

.otp-input-group input {
  width: 46px;
  height: 56px;
  border-radius: 12px;
  border: 2px solid var(--border-color, rgba(148, 163, 184, 0.2));
  background: var(--bg-secondary, rgba(15, 23, 42, 0.6));
  color: var(--text-main, #f8fafc);
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.otp-input-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.otp-input-group input.filled {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

[data-theme="light"] .otp-input-group input {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .otp-input-group input:focus {
  border-color: #0ea5e9 !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

/* OTP 타이머 및 힌트 */
.otp-timer {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 8px;
}

.otp-timer.expired { color: #ef4444; }

.otp-dev-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  background: rgba(56, 189, 248, 0.06);
  border: 1px dashed rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 16px;
}

.otp-dev-hint code {
  font-size: 1rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 4px;
}

/* ─── 안면 인식 스캐너 ─── */
.face-scanner-container {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 16px auto;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.15), inset 0 0 20px rgba(56, 189, 248, 0.05);
}

.face-scanner-container video,
.face-scanner-container canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* 홀로그램 스캔 빔 애니메이션 */
.face-scan-beam {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.face-scan-beam::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #38bdf8, #0ea5e9, #38bdf8, transparent);
  box-shadow: 0 0 20px #38bdf8, 0 0 40px rgba(56, 189, 248, 0.3);
  animation: scanBeam 2.5s ease-in-out infinite;
}

@keyframes scanBeam {
  0%, 100% { top: 0; opacity: 0.4; }
  50% { top: calc(100% - 3px); opacity: 1; }
}

/* 안면 인식 가이드 오버레이 */
.face-guide-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(56, 189, 248, 0.3);
  pointer-events: none;
}

.face-guide-overlay::after {
  content: '';
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  border: 1.5px solid rgba(16, 185, 129, 0.4);
}

/* 스캐너 상태 텍스트 */
.face-status {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 8px;
}

.face-status.scanning {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.face-status.success {
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.face-status.error {
  color: #ef4444;
  background: rgba(239, 68, 94, 0.08);
}

/* 시뮬레이션 모드 안면 아바타 */
.face-sim-avatar {
  width: 100%;
  /* [디자인 통일성 개선] 칙칙한 검정 차콜 대신 Cosmic Deep Navy 적용 */
  background: linear-gradient(135deg, #101744 0%, #171f69 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  border-radius: 50%;
  position: relative;
}

.face-sim-avatar::after {
  content: '';
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.15);
  animation: simPulse 2s ease-in-out infinite;
}

@keyframes simPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ─── MFA 공통 버튼 ─── */
.mfa-btn {
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 0.9rem;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mfa-btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.3);
}

.mfa-btn-primary:hover {
  box-shadow: 0 6px 24px rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

.mfa-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.mfa-btn-secondary {
  background: transparent;
  color: var(--text-muted, #94a3b8);
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.12));
  margin-top: 8px;
}

.mfa-btn-secondary:hover {
  color: var(--text-main, #f8fafc);
  border-color: var(--text-muted, #94a3b8);
}

.mfa-btn-resend {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
  display: block;
  margin: 0 auto 12px;
}

.mfa-btn-resend:disabled {
  color: var(--text-muted, #94a3b8);
  cursor: not-allowed;
  text-decoration: none;
}

/* ─── 마이페이지 MFA 보안 설정 ─── */
.mfa-settings-card {
  background: var(--bg-card-solid, #1a1e2e);
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.12));
  border-radius: 16px;
  padding: 24px;
  margin-top: 20px;
}

[data-theme="light"] .mfa-settings-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.mfa-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mfa-settings-head h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main, #f8fafc);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

[data-theme="light"] .mfa-settings-head h3 { color: #0f172a !important; }

/* 토글 스위치 */
.mfa-toggle {
  position: relative;
  width: 52px;
  height: 28px;
}

.mfa-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mfa-toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background: rgba(148, 163, 184, 0.2);
  cursor: pointer;
  transition: background 0.3s ease;
}

.mfa-toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #94a3b8;
  transition: transform 0.3s ease, background 0.3s ease;
}

.mfa-toggle input:checked + .mfa-toggle-slider {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
}

.mfa-toggle input:checked + .mfa-toggle-slider::before {
  transform: translateX(24px);
  background: #ffffff;
}

/* 수단 체크박스 */
.mfa-method-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mfa-method-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-secondary, rgba(15, 23, 42, 0.4));
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.08));
  transition: all 0.2s ease;
}

.mfa-method-item:hover {
  border-color: rgba(56, 189, 248, 0.2);
}

.mfa-method-item.selected {
  border: 2px solid var(--infralink-turquoise, #3cc2d2) !important;
  background: rgba(60, 194, 210, 0.08) !important;
  box-shadow: 0 0 16px rgba(60, 194, 210, 0.15) !important;
}

[data-theme="light"] .mfa-method-item {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .mfa-method-item.selected {
  border-color: #007a8c !important;
  background: #f0fdfa !important;
}


.mfa-method-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.mfa-method-icon.otp {
  background: rgba(139, 92, 246, 0.12);
}

.mfa-method-icon.face {
  background: rgba(14, 165, 233, 0.12);
}

.mfa-method-icon.totp {
  background: rgba(16, 185, 129, 0.15);
}

.mfa-method-info {
  flex: 1;
}

.mfa-method-info b {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
}

.mfa-method-info small {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

[data-theme="light"] .mfa-method-info b { color: #0f172a !important; }

.mfa-method-action button {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.08);
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mfa-method-action button:hover {
  background: rgba(56, 189, 248, 0.15);
}

/* ─── 진행 바 ─── */
.mfa-progress {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.1);
  margin-bottom: 16px;
  overflow: hidden;
}

.mfa-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border-radius: 2px;
  transition: width 1s linear;
}

/* ─── 매치 스코어 링 ─── */
.match-score-ring {
  width: 120px;
  height: 120px;
  margin: 16px auto;
  position: relative;
}

.match-score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.match-score-ring circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.match-score-ring .ring-bg {
  stroke: rgba(148, 163, 184, 0.1);
}

.match-score-ring .ring-fill {
  stroke: #10b981;
  stroke-dasharray: 339.292;
  transition: stroke-dashoffset 1.5s ease;
}

.match-score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.match-score-value b {
  font-size: 1.6rem;
  font-weight: 900;
  color: #10b981;
}

.match-score-value small {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
}
