/* ═══════════════════════════════════════════════════════════════════
   TWOFA.CSS  —  extends auth.css
   Adds: back link, badge, OTP inputs, timers, error state
═══════════════════════════════════════════════════════════════════ */

/* ── Back link ───────────────────────────────────────────────────── */
.auth-panel__back {
  margin-bottom: var(--sp-6);
}

.auth-panel__back a {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  gap: var(--sp-1);
  transition: color var(--t-fast);
}

.auth-panel__back a:hover { color: var(--c-text); }

/* ── Method badge ────────────────────────────────────────────────── */
.auth-panel__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--c-teal-light);
  border: 1px solid rgba(46,204,204,.25);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-teal);
  margin-bottom: var(--sp-6);
}

/* ── Subtitle strong ─────────────────────────────────────────────── */
.auth-panel__sub strong {
  color: var(--c-text);
  font-weight: 600;
}

/* ── OTP input wrap ──────────────────────────────────────────────── */
.otp-wrap {
  margin-bottom: var(--sp-5);
}

/* Six digit boxes + separator */
.otp-fields {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.otp-digit {
  width: 52px;
  height: 60px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  caret-color: var(--c-teal);
  -moz-appearance: textfield;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.otp-digit::-webkit-outer-spin-button,
.otp-digit::-webkit-inner-spin-button { -webkit-appearance: none; }

.otp-digit:focus {
  outline: none;
  border-color: var(--c-teal);
  box-shadow: 0 0 0 3px var(--c-teal-light);
  transform: translateY(-2px);
}

.otp-digit:not(:placeholder-shown) {
  background: var(--c-surface-2);
  border-color: var(--c-teal);
}

.otp-sep {
  font-size: 1.25rem;
  color: var(--c-muted);
  font-weight: 300;
  padding: 0 var(--sp-1);
  flex-shrink: 0;
}

/* Error state — shake + red borders */
.otp-error .otp-digit {
  border-color: var(--c-orange);
  animation: otp-shake 0.35s var(--ease-out);
}

.otp-error .otp-digit:focus {
  box-shadow: 0 0 0 3px var(--c-orange-light);
}

@keyframes otp-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-4px); }
  40%     { transform: translateX(4px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}

/* ── Email 2FA: linear countdown bar ────────────────────────────── */
.otp-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.otp-timer__bar {
  width: 100%;
  height: 4px;
  background: var(--c-surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
  border: 1px solid var(--c-border);
}

.otp-timer__fill {
  height: 100%;
  width: 97%;
  background: linear-gradient(90deg, var(--c-teal), #10b981);
  border-radius: var(--r-full);
  transition: width 1s linear, background 0.5s;
}

.otp-timer__label {
  font-size: 0.8125rem;
  color: var(--c-muted);
  font-family: var(--font-mono);
}

/* ── Authenticator: TOTP circular ring ───────────────────────────── */
.otp-totp-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.totp-ring {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.totp-ring__track {
  stroke: var(--c-surface-2);
}

.totp-ring__fill {
  stroke: var(--c-teal);
  transition: stroke-dasharray 1s linear, stroke 0.3s;
}

.totp-ring__label {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.totp-ring__label #totp-secs {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1;
  min-width: 2ch;
  text-align: right;
}

.totp-ring__label span:last-child {
  font-size: 0.875rem;
  color: var(--c-muted);
  font-weight: 500;
}

/* ── Error message row ───────────────────────────────────────────── */
.otp-error-msg {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-orange-light);
  border: 1px solid rgba(235,84,6,.25);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--c-orange);
  font-weight: 500;
}

.otp-error .otp-error-msg { display: flex; }

/* ── Verify button spacing ───────────────────────────────────────── */
.auth-panel .btn--teal.btn--full {
  margin-top: 0;
  margin-bottom: var(--sp-6);
  padding-block: 0.875rem;
  font-size: 1rem;
}

/* ── Resend / alt method link as a button ────────────────────────── */
.form-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--c-teal);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--t-fast);
}
.form-link-btn-disabled {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--c-border);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--t-fast);
}

.form-link-btn:hover {
  color: var(--c-teal-dark);
  text-decoration: underline;
}
.form-link-btn-disabled:hover {
  text-decoration: none;
  cursor: default;
}

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .otp-digit { width: 44px; height: 54px; font-size: 1.25rem; }
  .otp-fields { gap: 6px; }
}

@media (max-width: 380px) {
  .otp-digit { width: 38px; height: 50px; font-size: 1.1rem; }
  .otp-sep   { display: none; }
}
