/* ============================================================
   auth.css — Login & Registration screens
   White card · Dark background · Mobile-first
   ============================================================ */

/* ── BASE / TOKENS ─────────────────────────────────────────── */
:root {
  --auth-bg:           #0d1117;
  --auth-card:         #ffffff;
  --auth-card-border:  #e2e8f0;
  --auth-surface:      #f8fafc;
  --auth-surface-2:    #f1f5f9;

  --auth-accent:       #1d9e75;
  --auth-accent-hover: #18b580;
  --auth-accent-lt:    rgba(29,158,117,0.10);
  --auth-accent-border:rgba(29,158,117,0.30);

  --auth-text-1:       #0f172a;
  --auth-text-2:       #475569;
  --auth-text-3:       #6b7280;
  --auth-input-placeholder: #6b7280;

  --auth-error:        #dc2626;
  --auth-error-lt:     rgba(220,38,38,0.08);
  --auth-error-border: rgba(220,38,38,0.25);
  --auth-success:      #16a34a;
  --auth-success-lt:   rgba(22,163,74,0.08);
  --auth-warn:         #d97706;

  --auth-border:       #e2e8f0;
  --auth-border-focus: #1d9e75;
  --auth-input-bg:     #f8fafc;

  --auth-radius:       10px;
  --auth-radius-lg:    18px;
  --auth-font:         'DM Sans', sans-serif;
  --auth-mono:         'DM Mono', monospace;

  /* Password strength colours */
  --pw-weak:   #ef4444;
  --pw-fair:   #f59e0b;
  --pw-good:   #3b82f6;
  --pw-strong: #16a34a;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  background: var(--auth-bg);
  font-family: var(--auth-font);
  -webkit-font-smoothing: antialiased;
}

/* ── SCREEN WRAPPER ────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg);
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}

/* subtle grid texture on dark bg */
.auth-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(29,158,117,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29,158,117,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* glow orb */
.auth-screen::after {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(29,158,117,0.10) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ── CARD ───────────────────────────────────────────────────── */
.auth-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--auth-card);
  border: 1px solid var(--auth-card-border);
  border-radius: var(--auth-radius-lg);
  padding: 36px 28px 32px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.07),
    0 20px 60px rgba(0,0,0,0.35),
    0 1px 0 rgba(255,255,255,0.08) inset;
}

/* ── LOGO / HEADER ─────────────────────────────────────────── */
.auth-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  gap: 10px;
}

.auth-logo {
  width: 52px;
  height: 52px;
  background: var(--auth-accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 16px rgba(29,158,117,0.35);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--auth-text-1);
  letter-spacing: -0.4px;
}

.auth-sub {
  font-size: 13px;
  color: var(--auth-text-3);
  text-align: center;
  line-height: 1.4;
}

/* ── STEP INDICATOR ─────────────────────────────────────────── */
.auth-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.auth-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--auth-border);
  background: var(--auth-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--auth-text-3);
  transition: all 0.25s;
}

.auth-step.active .auth-step-dot {
  border-color: var(--auth-accent);
  background: var(--auth-accent-lt);
  color: var(--auth-accent);
}

.auth-step.done .auth-step-dot {
  border-color: var(--auth-success);
  background: var(--auth-success-lt);
  color: var(--auth-success);
}

.auth-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--auth-text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-step.active .auth-step-label { color: var(--auth-accent); }
.auth-step.done  .auth-step-label  { color: var(--auth-success); }

.auth-step-line {
  width: 52px;
  height: 2px;
  background: var(--auth-border);
  margin-bottom: 18px;
  transition: background 0.3s;
  flex-shrink: 0;
}

.auth-step-line.done { background: var(--auth-success); }

/* ── DIVIDER ────────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  color: var(--auth-text-3);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

/* ── FORM FIELDS ────────────────────────────────────────────── */
.auth-field {
  margin-bottom: 16px;
}

.auth-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text-1);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius);
  font-size: 15px;
  font-family: var(--auth-font);
  color: var(--auth-text-1);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.auth-input::placeholder { color: #6b7280; }

.auth-input:focus {
  border-color: var(--auth-border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}

.auth-input.error {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 3px var(--auth-error-lt);
}

.auth-input.success {
  border-color: var(--auth-success);
}

/* password wrapper */
.auth-pw-wrap {
  position: relative;
}

.auth-pw-wrap .auth-input {
  padding-right: 48px;
}

.auth-pw-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 46px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--auth-text-3);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  border-radius: 0 var(--auth-radius) var(--auth-radius) 0;
}

.auth-pw-toggle:hover {
  color: var(--auth-text-1);
  background: var(--auth-surface-2);
}

/* ── FIELD HINT ─────────────────────────────────────────────── */
.auth-field-hint {
  font-size: 12px;
  color: var(--auth-text-3);
  margin-top: 5px;
  line-height: 1.4;
}

/* ── PASSWORD REQUIREMENTS BOX ──────────────────────────────── */
.pw-requirements-box {
  margin-top: 10px;
  padding: 13px 15px;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: var(--auth-radius);
  transition: background 0.4s, border-color 0.4s;
}

.pw-requirements-box.all-met {
  background: #f0fdf4;
  border-color: #16a34a;
  border-left-color: #16a34a;
}

.pw-req-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #92400e;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pw-req-title::before {
  content: '⚠';
  font-size: 13px;
}

.pw-requirements-box.all-met .pw-req-title {
  color: #15803d;
}

.pw-requirements-box.all-met .pw-req-title::before {
  content: '✓';
}

.pw-strength-wrap {
  margin-bottom: 10px;
}

.pw-strength-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 5px;
}

.pw-bar-seg {
  height: 4px;
  border-radius: 2px;
  background: var(--auth-border);
  transition: background 0.3s;
}

.pw-bar-seg.weak   { background: var(--pw-weak);   }
.pw-bar-seg.fair   { background: var(--pw-fair);   }
.pw-bar-seg.good   { background: var(--pw-good);   }
.pw-bar-seg.strong { background: var(--pw-strong); }

.pw-strength-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--auth-text-3);
}

.pw-reqs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
}

.pw-req {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #78350f;
  transition: color 0.3s;
}

.pw-req .req-icon {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  flex-shrink: 0;
  transition: all 0.25s;
}

.pw-req.met {
  color: #15803d;
  font-weight: 600;
}

.pw-req.met .req-icon {
  border-color: #16a34a;
  background: #dcfce7;
  color: #15803d;
}

.pw-req.unmet .req-icon {
  border-color: var(--auth-error);
  background: var(--auth-error-lt);
  color: var(--auth-error);
}

/* ── USERNAME OPTIONS ───────────────────────────────────────── */
.username-section-inline {
  margin-top: 0;
  border: 1.5px solid var(--auth-accent);
  border-top: none;
  border-radius: 0 0 var(--auth-radius) var(--auth-radius);
  background: #f0fdf9;
  padding: 12px 14px 14px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Make the Full Name input look connected when username section is showing */
.auth-field.username-open .auth-input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: var(--auth-accent);
}

.username-options-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--auth-accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.username-options-label::before {
  content: '👤';
  font-size: 13px;
}

.username-option-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.username-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius);
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}

.username-option:hover {
  border-color: var(--auth-accent);
  background: var(--auth-accent-lt);
}

.username-option.selected {
  border-color: var(--auth-accent);
  background: var(--auth-accent-lt);
}

.username-option input[type="radio"] {
  accent-color: var(--auth-accent);
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  cursor: pointer;
}

.username-option-value {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--auth-mono);
  color: var(--auth-text-1);
  flex: 1;
}

.username-option.selected .username-option-value {
  color: var(--auth-accent);
}

.username-option-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--auth-surface-2);
  color: var(--auth-text-2);
  border: 1px solid var(--auth-border);
}

.username-option.selected .username-option-badge {
  background: var(--auth-accent);
  color: #fff;
  border-color: var(--auth-accent);
}

/* ── OTP / VERIFICATION CODE ───────────────────────────────── */
.otp-wrap {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 10px 0;
}

.otp-input {
  width: 46px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--auth-mono);
  color: var(--auth-text-1);
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius);
  outline: none;
  caret-color: var(--auth-accent);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.otp-input:focus {
  border-color: var(--auth-border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}

.otp-input.filled {
  border-color: var(--auth-accent);
  background: var(--auth-accent-lt);
  color: var(--auth-accent);
}

.otp-input.error {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 3px var(--auth-error-lt);
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}

/* ── SPAM NOTICE ────────────────────────────────────────────── */
.auth-spam-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  background: #fffbeb;
  border: 1px solid rgba(217,119,6,0.3);
  border-radius: var(--auth-radius);
  margin-top: 14px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}

.auth-spam-notice .notice-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── RESEND EMAIL BUTTON ─────────────────────────────────────── */
.resend-email-wrap {
  margin-top: 14px;
  text-align: center;
}

.resend-email-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius);
  background: var(--auth-surface);
  color: var(--auth-text-2);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--auth-font);
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}

.resend-email-btn:hover:not(:disabled) {
  border-color: var(--auth-accent);
  color: var(--auth-accent);
  background: var(--auth-accent-lt);
}

.resend-email-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.resend-timer {
  font-size: 12px;
  color: var(--auth-text-3);
  margin-top: 6px;
  text-align: center;
}

/* ── OTP HINT ───────────────────────────────────────────────── */
.otp-hint {
  text-align: center;
  font-size: 13px;
  color: var(--auth-text-2);
  margin-top: 8px;
  line-height: 1.5;
}

/* ── EMAIL BADGE ────────────────────────────────────────────── */
.auth-email-badge {
  display: inline-block;
  background: var(--auth-accent-lt);
  border: 1px solid var(--auth-accent-border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-accent);
  font-family: var(--auth-mono);
  word-break: break-all;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.auth-btn {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--auth-accent);
  color: #fff;
  border: none;
  border-radius: var(--auth-radius);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--auth-font);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(29,158,117,0.3);
  text-decoration: none;
}

.auth-btn:hover {
  background: var(--auth-accent-hover);
  box-shadow: 0 4px 16px rgba(29,158,117,0.35);
}

.auth-btn:active { transform: translateY(1px); }

.auth-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-btn.loading {
  pointer-events: none;
}

.auth-btn.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── ALERT ──────────────────────────────────────────────────── */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--auth-radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.25s, max-height 0.25s;
}

.auth-alert.visible {
  opacity: 1;
  max-height: 120px;
}

.auth-alert.error {
  background: var(--auth-error-lt);
  border: 1px solid var(--auth-error-border);
  color: var(--auth-error);
}

.auth-alert.success {
  background: var(--auth-success-lt);
  border: 1px solid rgba(22,163,74,0.25);
  color: var(--auth-success);
}

.auth-alert.info {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.25);
  color: #2563eb;
}

/* ── LINKS & FOOTER ─────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 15px;
  color: var(--auth-text-2);
  line-height: 1.6;
}

.auth-footer a {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover { text-decoration: underline; }

.auth-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: -8px;
  margin-bottom: 20px;
  font-size: 13px;
}

.auth-links a:first-child {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 500;
  text-align: left;
}

.auth-links a:last-child {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 500;
  text-align: right;
}

.auth-links a:hover { text-decoration: underline; }

/* ── CONFIRM PASSWORD MATCH MSG ─────────────────────────────── */
.confirm-match-msg {
  font-size: 12px;
  margin-top: 5px;
  font-weight: 500;
}

/* ── DONE STATE ─────────────────────────────────────────────── */
.auth-done-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--auth-success-lt);
  border: 2px solid var(--auth-success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px;
  color: var(--auth-success);
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (min-width: 480px) {
  .auth-box {
    padding: 40px 36px 36px;
  }

  .otp-input {
    width: 54px;
    height: 62px;
    font-size: 26px;
  }
}

@media (max-width: 400px) {
  .otp-wrap { gap: 5px; }
  .otp-input {
    width: 40px;
    height: 50px;
    font-size: 20px;
    border-radius: 7px;
  }
  .pw-reqs { grid-template-columns: 1fr; }
}