/* afterSpark Auth — Global Stylesheet */
/* Brand: dark navy bg, orange CTA, teal secondary, purple tertiary */

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

:root {
  --bg:          #131720;
  --surface:     #1c2030;
  --border:      #262d3d;
  --border-focus:#3a4256;
  --orange:      #ff9933;
  --orange-dim:  rgba(255, 153, 51, 0.15);
  --teal:        #1faaaa;
  --teal-dim:    rgba(31, 170, 170, 0.15);
  --purple:      #8b5cf6;
  --purple-dim:  rgba(139, 92, 246, 0.15);
  --muted:       #8a95aa;
  --white:       #ffffff;
  --text:        #e4e8f0;
  --error:       #f87171;
  --success:     #34d399;
  --radius:      12px;
  --radius-sm:   8px;
  --transition:  0.2s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  display: inline-block;
}

.auth-logo-img {
  width: 200px;
  height: auto;
  display: block;
}

.auth-logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--white);
}

.auth-logo-text span {
  color: var(--orange);
}

.auth-card {
  width: 100%;
  max-width: 550px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 45px 50px;
  overflow: hidden;
}

@media (max-width: 480px) {
  .auth-card { padding: 35px 30px; }
}

/* ── Step indicator ───────────────────────────────────────── */

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-dot.active {
  border-color: var(--orange);
  background: var(--orange-dim);
  color: var(--orange);
}

.step-dot.done {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--bg);
}

/* All step dots use orange — no teal/purple overrides */

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 60px;
  margin: 0 6px;
  transition: background 0.3s ease;
}

.step-line.done { background: var(--orange); }

/* ── Step panels ──────────────────────────────────────────── */

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
  animation: fadeSlideIn 0.32s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}

.step-panel.slide-back.active {
  animation: fadeSlideBack 0.32s ease;
}

@keyframes fadeSlideBack {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Typography ───────────────────────────────────────────── */

.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--white);
  margin-bottom: 6px;
}

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

.auth-subtitle strong {
  color: var(--text);
  font-weight: 500;
}

/* ── Form elements ────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

label .optional {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="tel"]::placeholder,
input[type="url"]::placeholder {
  color: var(--muted);
}

input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.12);
}

input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

/* ── Browser autofill override ────────────────────────────── */
/* Chrome/Safari replace the input background with white/yellow when
   autofilling. This override forces our dark theme colours to persist. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  /* Large inset shadow paints over the browser's autofill background */
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset !important;
  /* Keep text colour correct */
  -webkit-text-fill-color: var(--white) !important;
  /* Prevent the brief white flash on focus transition */
  transition: background-color 9999s ease-in-out 0s;
  caret-color: var(--white);
}

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
  display: none;
}

.field-error.visible { display: block; }

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

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}

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

.btn-primary-glow {
  background: var(--orange);
  color: var(--bg);
  box-shadow: 0 0 20px rgba(255, 153, 51, 0.35), 0 2px 8px rgba(0,0,0,0.3);
}

.btn-primary-glow:hover:not(:disabled) {
  background: #ff8c1a;
  box-shadow: 0 0 28px rgba(255, 153, 51, 0.55), 0 2px 12px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

.btn-primary-glow:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 16px rgba(255, 153, 51, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-focus);
  background: rgba(255,255,255,0.04);
}

.btn-sso {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

.btn-sso:hover {
  border-color: var(--border-focus);
  background: rgba(255,255,255,0.03);
}

.btn-sso img,
.btn-sso svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── SSO section ──────────────────────────────────────────── */

.sso-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
}

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

/* ── Terms / checkbox ─────────────────────────────────────── */

.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 40px;
  margin-top: 16px;
}

.terms-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--orange);
  cursor: pointer;
  margin-top: 2px;
}

.terms-row label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 0;
  cursor: pointer;
  line-height: 1.5;
}

.terms-row a {
  color: var(--orange);
  text-decoration: none;
}

.terms-row a:hover { text-decoration: underline; }

/* ── Interest cards (Step 3) ──────────────────────────────── */

.interest-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.interest-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 18px;
  padding: 20px 22px;
  min-height: 90px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.22s ease;
  user-select: none;
  text-align: left;
}

.interest-card:hover {
  background: rgba(255,255,255,0.03);
}

.interest-card .card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 12px;
  transition: background 0.22s ease;
  margin-top: 2px;
}

.interest-card.api .card-icon { background: var(--teal-dim); }
.interest-card.tag .card-icon { background: var(--orange-dim); }
.interest-card.ext .card-icon { background: var(--purple-dim); }

.interest-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.interest-card .card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.22s ease;
}

.interest-card .card-sublabel {
  display: none;
}

.interest-card .card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* selected states */
.interest-card.api.selected {
  border-color: var(--teal);
  background: var(--teal-dim);
  box-shadow: 0 0 16px rgba(31, 170, 170, 0.2);
}

.interest-card.tag.selected {
  border-color: var(--orange);
  background: var(--orange-dim);
  box-shadow: 0 0 16px rgba(255, 153, 51, 0.2);
}

.interest-card.ext.selected {
  border-color: var(--purple);
  background: var(--purple-dim);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.2);
}

.interest-card.selected .card-label { color: var(--white); }

/* ── Inbox / verify screen ────────────────────────────────── */

.verify-screen {
  text-align: center;
  padding: 8px 0;
}

.verify-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orange-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.verify-email-address {
  font-weight: 600;
  color: var(--orange);
}

/* ── Success screen ───────────────────────────────────────── */

.success-screen {
  text-align: center;
  padding: 8px 0;
}

.success-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

/* ── Alert / message box ──────────────────────────────────── */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert.visible { display: block; }
.alert-error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: var(--error); }
.alert-success { background: rgba(52,211,153,0.1);  border: 1px solid rgba(52,211,153,0.25);  color: var(--success); }
.alert-info    { background: rgba(96,165,250,0.1);  border: 1px solid rgba(96,165,250,0.25);  color: #60a5fa; }

/* ── Links & footer ───────────────────────────────────────── */

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}

.auth-footer a {
  color: var(--orange);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

.btn-link {
  background: none;
  border: none;
  color: var(--orange);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.btn-link:hover { text-decoration: underline; }

/* ── Password toggle (show/hide eyeball) ─────────────────── */

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 40px;
}

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

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

/* ── SSO (hidden until enabled) ──────────────────────────── */

.sso-hidden { display: none !important; }

/* ── Spinner ──────────────────────────────────────────────── */

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}

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

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

/* ── Spacers ──────────────────────────────────────────────── */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted  { color: var(--muted); font-size: 13px; }
.text-center { text-align: center; }

/* ── Light theme ──────────────────────────────────────────── */
body[data-theme="light"] {
  --bg:          #f0f2f7;
  --surface:     #ffffff;
  --border:      #dde1ea;
  --border-focus:#b0b8cc;
  --text:        #1a1f36;
  --muted:       #6b7280;
  --white:       #1a1f36;
}

body[data-theme="light"] .auth-logo-img {
  filter: none;
}
