/* ==============================================
   LOGIN PAGE — Light Purple Theme
   ============================================== */

:root {
  --accent:       #6c48f5;
  --accent-light: #8b6fff;
  --accent-glow:  rgba(108, 72, 245, .14);
  --bg:           #f4f6fb;
  --card:         #ffffff;
  --border:       #e4e8f5;
  --text:         #1a1d2e;
  --text-sub:     #4b5275;
  --text-muted:   #9aa0bc;
  --danger:       #e05252;
  --success:      #3ab07a;
  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 8px 48px rgba(100, 110, 180, .14);
  --transition:   .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── Background blobs ── */
.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .45;
}

.blob-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(108,72,245,.18), transparent 70%);
  top: -140px;
  left: -140px;
}

.blob-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(139,111,255,.14), transparent 70%);
  bottom: -100px;
  right: -100px;
}

/* ── Wrapper ── */
.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Card ── */
.login-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Brand ── */
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-logo {
  width: 50px;
  height: 50px;
  background: var(--accent-glow);
  border: 1.5px solid rgba(108,72,245,.2);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.login-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.login-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Alert ── */
.login-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.4;
}

.login-alert.error {
  background: rgba(224,82,82,.09);
  border: 1px solid rgba(224,82,82,.3);
  color: var(--danger);
}

.login-alert.success {
  background: rgba(58,176,122,.09);
  border: 1px solid rgba(58,176,122,.3);
  color: var(--success);
}

/* ── Google button ── */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-google:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fafaff;
}

.btn-google:active { transform: scale(.98); }

/* ── Divider ── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: .78rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Form ── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-sub);
}

.forgot-link {
  background: none;
  border: none;
  font-size: .78rem;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  transition: opacity var(--transition);
}
.forgot-link:hover { opacity: .75; text-decoration: underline; }

/* Input */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 10px 40px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

.form-input.error-input { border-color: var(--danger); }

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.toggle-password:hover { color: var(--accent); }

/* Sign In button */
.btn-signin {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 16px rgba(108,72,245,.35);
  transition: all var(--transition);
  margin-top: 4px;
}

.btn-signin:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(108,72,245,.4);
}

.btn-signin:active { transform: translateY(0); }

.btn-signin:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

/* Button spinner */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.login-footer {
  font-size: .75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 460px) {
  .login-card { padding: 28px 20px; }
}

/* ══════════════════════════════════════════════════════════════
   2FA VERIFICATION STYLES
   ══════════════════════════════════════════════════════════════ */

/* Header */
.twofa-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.twofa-icon-wrap {
  width: 44px;
  height: 44px;
  background: var(--accent-glow);
  border: 1.5px solid rgba(108,72,245,.22);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.twofa-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.015em;
}

.twofa-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Method selector tabs */
.method-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.method-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  background: none;
  border: none;
  border-radius: 7px;
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.method-tab:hover {
  background: rgba(108,72,245,.07);
  color: var(--accent);
}

.method-tab.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(100,110,180,.12);
}

/* Push waiting screen */
.twofa-push {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
  text-align: center;
}

.push-phone-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-glow);
  border: 1.5px solid rgba(108,72,245,.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 4px;
}

.push-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.push-sub {
  font-size: .8rem;
  color: var(--text-sub);
  line-height: 1.5;
  max-width: 260px;
}

/* Push spinner (ring animation) */
.push-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--accent-glow);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 4px 0;
}

.push-status {
  font-size: .8rem;
  color: var(--text-muted);
  min-height: 20px;
}

/* Resend / secondary action link */
.btn-resend {
  background: none;
  border: none;
  font-family: inherit;
  font-size: .8rem;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  transition: opacity var(--transition);
}
.btn-resend:hover { opacity: .7; }

/* TOTP / Email OTP form */
.twofa-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.twofa-label {
  font-size: .82rem;
  color: var(--text-sub);
  line-height: 1.5;
}

/* OTP digit input */
.otp-wrap {
  display: flex;
  justify-content: center;
}

.otp-input {
  width: 100%;
  max-width: 220px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 10px;
  text-align: center;
  font-family: 'Courier New', monospace;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.otp-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 6px;
  font-weight: 400;
  font-size: 1.1rem;
}

.otp-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

/* Recovery link */
.recovery-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: .74rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.recovery-link:hover { color: var(--accent); }

/* Recovery identity form */
.recovery-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recovery-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recovery-fields .form-input {
  padding: 9px 12px;
  font-size: .83rem;
}

/* Back-to-login link */
.back-link {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  font-family: inherit;
  font-size: .8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0 0;
  transition: color var(--transition);
}
.back-link:hover { color: var(--accent); }
