/* login.css — page-specific styles for login.html.
   Shared components live in styles.css (loaded before this file). */

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

/* ── Dark theme (default) ── */
:root {
  --bg:               #0f1117;
  --surface:          #151920;
  --border:           #1e2531;
  --border-hi:        #2d3748;
  --text:             #e2e8f0;
  --muted:            #64748b;
  --accent:           #3b82f6;
  --accent-hi:        #60a5fa;
  --accent-bg:        #1e3a5f22;
  --error:            #f87171;
  --success:          #4ade80;
  --input-bg:         #0f1117;
  --card-shadow:      0 24px 64px #00000060;
  --toast-error-bg:   #2d0f0f;
  --toast-error-bd:   #7f1d1d;
  --toast-ok-bg:      #0f2d1a;
  --toast-ok-bd:      #14532d;
  --toast-info-bg:    #0d1b2e;
  --toast-info-bd:    #1e3a5f;
  --toast-info-text:  #93c5fd;
  --chip-bg:          #0d1b2e;
  --chip-bd:          #1e3a5f;
  --chip-text:        #93c5fd;
  --success-icon-bg:  #0f2d1a;
  --success-icon-bd:  #14532d;
}

/* ── Light theme (system preference) ── */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    --bg:               #f1f5f9;
    --surface:          #ffffff;
    --border:           #e2e8f0;
    --border-hi:        #cbd5e1;
    --text:             #1e293b;
    --muted:            #64748b;
    --accent:           #3b82f6;
    --accent-hi:        #2563eb;
    --accent-bg:        #eff6ff;
    --error:            #dc2626;
    --success:          #16a34a;
    --input-bg:         #f8fafc;
    --card-shadow:      0 24px 64px #00000018;
    --toast-error-bg:   #fef2f2;
    --toast-error-bd:   #fecaca;
    --toast-ok-bg:      #f0fdf4;
    --toast-ok-bd:      #bbf7d0;
    --toast-info-bg:    #eff6ff;
    --toast-info-bd:    #bfdbfe;
    --toast-info-text:  #3b82f6;
    --chip-bg:          #eff6ff;
    --chip-bd:          #bfdbfe;
    --chip-text:        #3b82f6;
    --success-icon-bg:  #f0fdf4;
    --success-icon-bd:  #bbf7d0;
  }
}

/* ── Light theme (explicit override) ── */
html[data-theme="light"] {
  --bg:               #f1f5f9;
  --surface:          #ffffff;
  --border:           #e2e8f0;
  --border-hi:        #cbd5e1;
  --text:             #1e293b;
  --muted:            #64748b;
  --accent:           #3b82f6;
  --accent-hi:        #2563eb;
  --accent-bg:        #eff6ff;
  --error:            #dc2626;
  --success:          #16a34a;
  --input-bg:         #f8fafc;
  --card-shadow:      0 24px 64px #00000018;
  --toast-error-bg:   #fef2f2;
  --toast-error-bd:   #fecaca;
  --toast-ok-bg:      #f0fdf4;
  --toast-ok-bd:      #bbf7d0;
  --toast-info-bg:    #eff6ff;
  --toast-info-bd:    #bfdbfe;
  --toast-info-text:  #3b82f6;
  --chip-bg:          #eff6ff;
  --chip-bd:          #bfdbfe;
  --chip-text:        #3b82f6;
  --success-icon-bg:  #f0fdf4;
  --success-icon-bd:  #bbf7d0;
}

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;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}

body::before {
  content: '';
  position: fixed;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, #3b82f618 0%, transparent 70%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px; left: 30%;
  width: 400px; height: 400px;
  background: radial-gradient(ellipse, #a855f710 0%, transparent 70%);
  pointer-events: none;
}

/* ── Split layout ──
   Mobile: single centred card (current look, art hidden).
   ≥768px: 50/50 split — form left, branded panel right. */
.login-layout {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: center;
}
.login-form-col { width: 100%; }
.login-art { display: none; }

@media (min-width: 768px) {
  body { padding: 0; }
  .login-layout {
    max-width: none;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .login-form-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
  }
  /* In split mode the brand lives in the right panel, not above the form. */
  .card .logo { display: none; }
  .login-art {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 56px;
    position: relative;
    overflow: hidden;
    background:
      radial-gradient(ellipse at 30% 25%, #3b82f655 0%, transparent 55%),
      radial-gradient(ellipse at 70% 80%, #a855f744 0%, transparent 55%),
      linear-gradient(135deg, #0d1b2e, #1a1030);
  }
  .art-strip {
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #3b82f6, #a855f7, #14b8a6);
  }
  .art-logo {
    width: min(78%, 440px);
    height: auto;
    filter: brightness(0) invert(1);   /* black wordmark → white */
  }
  .art-tagline {
    color: rgba(255,255,255,0.72);
    font-size: 0.95rem;
    line-height: 1.55;
    text-align: center;
    max-width: 400px;
    letter-spacing: 0.01em;
  }
}

/* ── Card ── */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  position: relative;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.brand-strip {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #a855f7, #14b8a6);
}

/* ── Theme switcher — shared component (styles.css); login-only overrides ── */
.theme-switcher { position: absolute; top: 16px; right: 16px; z-index: 2; }
.theme-switcher-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 9px; cursor: pointer; line-height: 1; color: var(--muted);
  font-family: inherit; transition: border-color 0.15s, background 0.15s;
}
.theme-switcher-btn:hover { border-color: var(--border-hi); background: var(--border); }

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
}

.logo-icon img {
  width: 44px; height: 44px;
  object-fit: contain;
  display: block;
}

.logo-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Steps ── */
.step {
  display: none;
  flex-direction: column;
  gap: 0;
  animation: fadeUp 0.22s ease both;
}

.step.active { display: flex; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Heading ── */
.heading { margin-bottom: 28px; }

.heading h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.heading p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.heading p strong {
  color: var(--accent-hi);
  font-weight: 500;
}

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

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

.field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.01em;
}

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

.input-wrap .icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  height: 46px;
  background: var(--input-bg);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.875rem;
  padding: 0 14px 0 40px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.2s;
  font-family: inherit;
}

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

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #3b82f620;
}

/* ── OTP boxes ── */
.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 4px 0;
}

.otp-box {
  width: 52px;
  height: 58px;
  background: var(--input-bg);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.2s;
  font-family: 'Courier New', monospace;
  letter-spacing: 0;
}

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

.otp-box.filled {
  border-color: var(--border-hi);
}

/* ── Toast ── */
.toast {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  animation: fadeUp 0.2s ease;
}

.toast.error   { background: var(--toast-error-bg); border: 1px solid var(--toast-error-bd); color: var(--error);           display: flex; }
.toast.success { background: var(--toast-ok-bg);    border: 1px solid var(--toast-ok-bd);    color: var(--success);         display: flex; }
.toast.info    { background: var(--toast-info-bg);  border: 1px solid var(--toast-info-bd);  color: var(--toast-info-text); display: flex; }

/* ── Button ── */
.btn-submit {
  width: 100%;
  height: 46px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
  letter-spacing: 0.01em;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-submit:hover {
  background: var(--accent-hi);
  box-shadow: 0 8px 20px #3b82f640;
}

.btn-submit:active { transform: scale(0.98); }

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid #ffffff40;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .spinner  { display: block; }

/* ── Back link ── */
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
}

.back-link button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: color 0.15s;
}

.back-link button:hover { color: var(--accent-hi); }

/* ── Resend row ── */
.resend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: -4px;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: color 0.15s;
}

.resend-btn:hover { color: var(--accent-hi); }
.resend-btn:disabled { color: var(--muted); cursor: default; }

/* ── Success screen ── */
.success-icon {
  width: 56px; height: 56px;
  background: var(--success-icon-bg);
  border: 1px solid var(--success-icon-bd);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 24px;
}

/* ── Email chip ── */
.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-bd);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--chip-text);
  margin-top: 8px;
}
