/* ─── Two-Factor Authentication — Premium UI ─── */

.tf2-wrap {
  width: 100%;
  max-width: 420px;
}

.tf2-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tf2-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tf2-status-badge--on {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.tf2-status-badge--off {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.tf2-desc {
  font-size: 12px;
  color: var(--text3, #94a3b8);
  line-height: 1.5;
  margin: 8px 0 14px;
}

.tf2-card {
  margin-top: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(79, 159, 255, 0.16);
  background: linear-gradient(160deg, rgba(8, 102, 255, 0.08) 0%, rgba(12, 18, 36, 0.6) 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.tf2-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tf2-step {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3, #64748b);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.tf2-step.is-active {
  color: #93c5fd;
  background: rgba(8, 102, 255, 0.15);
  border-color: rgba(8, 102, 255, 0.35);
}

.tf2-step.is-done {
  color: #34d399;
}

.tf2-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tf2-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text3, #94a3b8);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.tf2-tab.is-active {
  background: rgba(8, 102, 255, 0.25);
  color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(8, 102, 255, 0.2);
}

.tf2-tab-pane {
  display: none;
}

.tf2-tab-pane.is-active {
  display: block;
}

.tf2-qr-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.tf2-qr-box {
  padding: 14px;
  background: #fff;
  border-radius: 12px;
  min-width: 200px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tf2-qr-img {
  display: block;
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  line-height: 0;
}

.tf2-qr-hint {
  font-size: 11px;
  color: var(--text3, #94a3b8);
  text-align: center;
  max-width: 240px;
  line-height: 1.45;
}

.tf2-manual {
  padding: 4px 0;
}

.tf2-manual-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3, #94a3b8);
  margin-bottom: 8px;
}

.tf2-key-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.tf2-key-value {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(79, 159, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #93c5fd;
  word-break: break-all;
  user-select: all;
}

.tf2-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(8, 102, 255, 0.35);
  background: rgba(8, 102, 255, 0.15);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.tf2-copy-btn:hover {
  background: rgba(8, 102, 255, 0.28);
}

.tf2-copy-btn.is-copied {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.tf2-verify-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tf2-verify-label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text2, #cbd5e1);
}

.tf2-otp-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.tf2-otp-cell {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border-radius: 10px;
  border: 2px solid rgba(79, 159, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: #f1f5f9;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tf2-otp-cell:focus {
  border-color: #0866ff;
  box-shadow: 0 0 0 3px rgba(8, 102, 255, 0.25);
}

.tf2-otp-row.is-error .tf2-otp-cell {
  border-color: #ef4444;
  animation: tf2-shake 0.4s ease;
}

.tf2-otp-row.is-success .tf2-otp-cell {
  border-color: #10b981;
}

@keyframes tf2-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.tf2-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.tf2-alert.is-visible {
  display: flex;
}

.tf2-alert--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.tf2-alert--error i {
  color: #ef4444;
  margin-top: 1px;
}

.tf2-alert--success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.tf2-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.tf2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.tf2-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tf2-btn--primary {
  background: linear-gradient(135deg, #0866ff 0%, #0554d4 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(8, 102, 255, 0.35);
}

.tf2-btn--primary:not(:disabled):hover {
  transform: translateY(-1px);
}

.tf2-btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text2, #cbd5e1);
}

.tf2-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--text3, #94a3b8);
  font-size: 13px;
}

.tf2-loading i {
  color: #0866ff;
}

/* Theme-aware inputs (disable panel) */
.tf2-input {
  width: 100%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(79, 159, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text2, #cbd5e1);
  font-family: inherit;
  font-size: 13px;
}

.tf2-input::placeholder {
  color: var(--text3, #94a3b8);
}

.tf2-input:focus {
  outline: none;
  border-color: #0866ff;
  box-shadow: 0 0 0 3px rgba(8, 102, 255, 0.25);
}

/* Settings row layout */
.pp-security-row--2fa {
  flex-direction: column;
  align-items: stretch !important;
}

.pp-security-row--2fa > div:first-child {
  margin-bottom: 4px;
}

#pp2faMount {
  width: 100%;
}

/* Login 2FA — user auth pages are always light */
body.auth-page .auth-2fa {
  margin-top: 16px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(160deg, #f8fafc 0%, #eff6ff 55%, #ffffff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Admin login — dark card */
body.admin-pro .login-2fa {
  margin-top: 16px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid rgba(79, 159, 255, 0.18);
  background: linear-gradient(160deg, rgba(8, 102, 255, 0.06) 0%, rgba(8, 12, 28, 0.5) 100%);
}

body.admin-pro .login-2fa .tf2-otp-cell {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(79, 159, 255, 0.2);
  color: #f1f5f9;
}

.auth-2fa[hidden],
.login-2fa[style*="display: none"] {
  display: none !important;
}

body.auth-page .auth-2fa-title,
.auth-2fa-title,
.login-2fa-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.auth-page .auth-2fa-title {
  color: #0f172a;
}

.auth-2fa-title i,
.login-2fa-title i {
  color: #0866ff;
}

body.auth-page .auth-2fa-sub,
.auth-2fa-sub,
.login-2fa-sub {
  font-size: 13px;
  margin: 0 0 16px;
  line-height: 1.45;
}

body.auth-page .auth-2fa-sub {
  color: #64748b;
}

body.admin-pro .login-2fa-sub,
.login-2fa-sub {
  color: var(--auth-muted, #94a3b8);
}

body.auth-page .auth-2fa .tf2-otp-row,
.auth-2fa .tf2-otp-row,
.login-2fa .tf2-otp-row {
  margin-bottom: 14px;
}

body.auth-page .auth-2fa .tf2-otp-cell {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.auth-page .auth-2fa .tf2-otp-cell:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

body.auth-page .auth-2fa .tf2-alert--error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

body.auth-page .auth-2fa .tf2-alert--success {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.auth-2fa .tf2-alert,
.login-2fa .tf2-alert {
  margin-bottom: 14px;
}

body.auth-page .auth-2fa-back {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

body.auth-page .auth-2fa-back:hover {
  color: #2563eb;
}

.auth-2fa-back {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: none;
  border: none;
  color: var(--auth-muted, #94a3b8);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.auth-2fa-back:hover {
  color: #93c5fd;
}

@media (max-width: 480px) {
  .tf2-otp-cell {
    width: 40px;
    height: 48px;
    font-size: 20px;
  }
  .tf2-key-row {
    flex-direction: column;
  }
}

/* ─── Light mode overrides (keep UI clean + readable) ─── */
html[data-theme='light'] .tf2-card,
body.light .tf2-card {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--fbc-brand, #0866ff) 8%, #ffffff) 0%,
    #ffffff 65%
  );
  border-color: var(--fbc-border, rgba(15, 23, 42, 0.08));
  box-shadow: var(--fbc-shadow-sm, 0 1px 3px rgba(15, 23, 42, 0.06));
}

html[data-theme='light'] .tf2-tabs,
body.light .tf2-tabs {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme='light'] .tf2-tab,
body.light .tf2-tab {
  color: var(--fbc-text-subtle, #64748b);
}

html[data-theme='light'] .tf2-tab.is-active,
body.light .tf2-tab.is-active {
  background: color-mix(in srgb, var(--fbc-brand, #0866ff) 12%, #ffffff);
  color: var(--fbc-text, #0f172a);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--fbc-brand, #0866ff) 18%, transparent);
}

html[data-theme='light'] .tf2-desc,
html[data-theme='light'] .tf2-qr-hint,
html[data-theme='light'] .tf2-manual-label,
body.light .tf2-desc,
body.light .tf2-qr-hint,
body.light .tf2-manual-label {
  color: var(--fbc-text-muted, #475569);
}

html[data-theme='light'] .tf2-verify-label,
body.light .tf2-verify-label {
  color: var(--fbc-text, #0f172a);
}

html[data-theme='light'] .tf2-key-value,
body.light .tf2-key-value {
  background: var(--fbc-input-bg, #ffffff);
  border-color: var(--fbc-input-border, rgba(15, 23, 42, 0.14));
  color: var(--fbc-text, #0f172a);
}

html[data-theme='light'] .tf2-otp-cell,
body.light .tf2-otp-cell {
  background: var(--fbc-input-bg, #ffffff);
  border-color: var(--fbc-input-border, rgba(15, 23, 42, 0.14));
  color: var(--fbc-text, #0f172a);
}

html[data-theme='light'] .tf2-btn--ghost,
body.light .tf2-btn--ghost {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.1);
  color: var(--fbc-text, #0f172a);
}

html[data-theme='light'] .tf2-input,
body.light .tf2-input {
  background: var(--fbc-input-bg, #ffffff);
  border-color: var(--fbc-input-border, rgba(15, 23, 42, 0.14));
  color: var(--fbc-input-text, #0f172a);
}

html[data-theme='light'] .tf2-alert--error,
body.light .tf2-alert--error {
  color: #7f1d1d;
}

html[data-theme='light'] .tf2-alert--success,
body.light .tf2-alert--success {
  color: #065f46;
}
