/* ═══════════════════════════════════════════════════════════════
   KrazyTrader — Professional Auth Styles
   Modern, clean design inspired by Stripe/Linear/Vercel
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg: #030712;
  --bg-soft: #0a0f1a;
  --surface: rgba(17, 24, 39, 0.7);
  --surface-hover: rgba(31, 41, 55, 0.8);
  --border: rgba(75, 85, 99, 0.4);
  --border-focus: rgba(99, 102, 241, 0.6);
  --muted: #9ca3af;
  --text: #f3f4f6;
  --title: #ffffff;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-text: #ffffff;
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.3);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.3);
  --glow-1: rgba(99, 102, 241, 0.15);
  --glow-2: rgba(168, 85, 247, 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────────
   Page Layout
   ───────────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: var(--glow-1);
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
}

.bg-glow-2 {
  width: 400px;
  height: 400px;
  background: var(--glow-2);
  bottom: -100px;
  right: -100px;
}

.auth-wrapper {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────────────
   Logo & Header
   ───────────────────────────────────────────────────────────────── */

.auth-logo {
  width: 200px;
  height: 200px;
  margin: 0 auto 32px;
  border-radius: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
}

.auth-logo img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--title);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 32px;
}

/* ─────────────────────────────────────────────────────────────────
   Alerts
   ───────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #fcd34d;
}

.alert-warning .alert-icon {
  color: var(--warning);
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: #fca5a5;
}

.alert-error .alert-icon {
  color: var(--error);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #6ee7b7;
}

.alert-success .alert-icon {
  color: var(--success);
}

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-text {
  font-size: 13px;
  opacity: 0.9;
}

/* ─────────────────────────────────────────────────────────────────
   Card
   ───────────────────────────────────────────────────────────────── */

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4);
}

/* ─────────────────────────────────────────────────────────────────
   Form Elements
   ───────────────────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.forgot-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.forgot-link:hover {
  color: var(--primary-hover);
}

.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input::placeholder {
  color: #6b7280;
}

.form-field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Password Toggle */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.password-toggle:hover {
  color: var(--text);
}

.eye-icon {
  width: 20px;
  height: 20px;
}

/* Checkbox */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-checkbox label {
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-text);
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: rgba(75, 85, 99, 0.6);
}

.btn-secondary svg {
  width: 18px;
  height: 18px;
}

.btn-ghost {
  width: 100%;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* Spinner */
.btn-spinner {
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}

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

.btn-text {
  display: inline;
}

/* ─────────────────────────────────────────────────────────────────
   Divider
   ───────────────────────────────────────────────────────────────── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

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

/* ─────────────────────────────────────────────────────────────────
   MFA Step
   ───────────────────────────────────────────────────────────────── */

.mfa-header {
  text-align: center;
  margin-bottom: 28px;
}

.mfa-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.mfa-icon svg {
  width: 28px;
  height: 28px;
}

.mfa-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--title);
  margin-bottom: 6px;
}

.mfa-header p {
  font-size: 14px;
  color: var(--muted);
}

/* OTP Inputs */
.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.otp-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--title);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.otp-inputs input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.otp-inputs input.filled {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

/* ─────────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────────── */

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  font-size: 13px;
  color: #6b7280;
}

.auth-footer svg {
  opacity: 0.7;
}

/* ─────────────────────────────────────────────────────────────────
   Success Content (for reset page)
   ───────────────────────────────────────────────────────────────── */

.success-content {
  text-align: center;
  padding: 16px 0;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--success);
}

.success-content h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--title);
  margin-bottom: 12px;
}

.success-content p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Field hint text */
.field-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ─────────────────────────────────────────────────────────────────
   Utilities
   ───────────────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────
   MFA Setup (QR Code Enrollment)
   ───────────────────────────────────────────────────────────────── */

.mfa-setup-content {
  text-align: center;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  margin: 20px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.qr-container img {
  max-width: 180px;
  height: auto;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.qr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.qr-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.mfa-instructions {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.mfa-instructions strong {
  color: var(--text);
  font-weight: 500;
}

.secret-key-container {
  margin-top: 16px;
  padding: 12px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.secret-key-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.secret-key-value {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--primary);
  word-break: break-all;
  user-select: all;
  cursor: text;
}

/* Secondary button style for skip */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 12px;
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--border-focus);
  background: var(--surface-hover);
}

/* Button row for MFA setup */
.mfa-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

@media (max-width: 480px) {
  .auth-page {
    padding: 24px 16px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .auth-title {
    font-size: 24px;
  }

  .otp-inputs input {
    width: 42px;
    height: 50px;
    font-size: 20px;
  }

  .qr-container img {
    max-width: 150px;
  }

