/* ================================================================
   JustiFi HyperRecursor — Phase 1 Stylesheet
   Design: Industrial-precision dark theme, sharp green accents
   Fonts: Syne (display) + DM Sans (body) + JetBrains Mono (code)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand */
  --green:        #22c55e;
  --green-dark:   #16a34a;
  --green-light:  #4ade80;
  --green-dim:    rgba(34,197,94,.12);
  --green-glow:   rgba(34,197,94,.25);

  /* Dark theme (default) */
  --bg:           #080d08;
  --bg2:          #0c130c;
  --surface:      #111a11;
  --surface2:     #172017;
  --surface3:     #1d2b1d;
  --border:       #1e2e1e;
  --border2:      #243624;
  --text:         #e8f0e8;
  --text2:        #9db89d;
  --text3:        #5a7a5a;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #3b82f6;

  --radius:       12px;
  --radius-sm:    7px;
  --radius-xs:    4px;
  --shadow:       0 4px 32px rgba(0,0,0,.5);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.3);

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --transition:   .18s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:       #f2f5f2;
  --bg2:      #ebeeeb;
  --surface:  #ffffff;
  --surface2: #f7faf7;
  --surface3: #eef3ee;
  --border:   #d4e0d4;
  --border2:  #c8d8c8;
  --text:     #141e14;
  --text2:    #3d5c3d;
  --text3:    #7a957a;
  --shadow:   0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:0 2px 8px rgba(0,0,0,.05);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--green-light); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: var(--surface); }
::-webkit-scrollbar-thumb    { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dark); }

/* ================================================================
   AUTH PAGES
   ================================================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Left: brand panel */
.auth-brand {
  position: relative;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 56px 48px;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

/* Decorative grid lines */
.auth-brand::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .4;
  pointer-events: none;
}

/* Radial green glow */
.auth-brand::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,197,94,.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
}

.auth-brand-inner {
  position: relative; z-index: 1;
  max-width: 380px; text-align: center;
}

.brand-logo-mark {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(140deg, var(--green-dark), var(--green));
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin: 0 auto 24px;
  box-shadow: 0 0 40px var(--green-glow), 0 0 80px rgba(34,197,94,.1);
  position: relative;
}

.brand-logo-mark::after {
  content: '';
  position: absolute; inset: -1px;
  border-radius: 18px;
  border: 1px solid rgba(34,197,94,.4);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
  line-height: 1.1;
  margin-bottom: 12px;
}
.brand-title em { font-style: normal; color: var(--green); }

.brand-sub {
  font-size: 14px;
  color: var(--text3);
  line-height: 1.7;
  margin-bottom: 40px;
}

.brand-features {
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
}

.brand-feat {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.brand-feat:hover { border-color: var(--green); }

.brand-feat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-feat-text {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.brand-version {
  position: absolute;
  bottom: 24px;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
}

/* Right: form panel */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card-header {
  margin-bottom: 32px;
}

.auth-card-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  margin-bottom: 6px;
}

.auth-card-header p {
  font-size: 13.5px;
  color: var(--text3);
}

/* Security badge */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,.2);
  border-radius: 20px;
  padding: 4px 12px;
  letter-spacing: .04em;
  margin-bottom: 24px;
}

/* ── Form Controls ─────────────────────────────────────────── */
.field { margin-bottom: 18px; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 7px;
  letter-spacing: .03em;
}

.field-label .req { color: var(--danger); margin-left: 2px; }

.field-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.field-input::placeholder { color: var(--text3); }
.field-input[type="password"] { letter-spacing: .1em; }

.field-input.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

.pw-wrap { position: relative; }
.pw-wrap .field-input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text3); font-size: 16px;
  padding: 4px;
  transition: color var(--transition);
}
.pw-toggle:hover { color: var(--text2); }

/* OTP input */
.otp-field {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 10px;
  padding: 12px 16px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}
.btn-primary:hover {
  background: var(--green-light);
  border-color: var(--green-light);
  box-shadow: 0 0 20px var(--green-glow);
  color: #000;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border2);
  color: var(--text2);
}
.btn-ghost:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
  text-decoration: none;
}

.btn-danger-ghost {
  background: transparent;
  border-color: rgba(239,68,68,.3);
  color: var(--danger);
}
.btn-danger-ghost:hover {
  background: rgba(239,68,68,.08);
  text-decoration: none;
}

.btn-full { width: 100%; }
.btn-lg   { padding: 12px 24px; font-size: 15px; }
.btn-sm   { padding: 7px 14px; font-size: 12.5px; }

.btn:disabled,
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert-error   { background: rgba(239,68,68,.08);  border-color: var(--danger);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.08);  border-color: var(--green);   color: #86efac; }
.alert-warning { background: rgba(245,158,11,.08); border-color: var(--warning); color: #fde68a; }
.alert-info    { background: rgba(59,130,246,.08); border-color: var(--info);    color: #93c5fd; }

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

/* ── Divider ───────────────────────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0;
  font-size: 12px; color: var(--text3);
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── QR Code block ─────────────────────────────────────────── */
.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin-bottom: 22px;
}

.qr-block img {
  border-radius: 10px;
  border: 3px solid var(--border2);
  background: #fff;
  padding: 8px;
}

.secret-key {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--green);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xs);
  padding: 8px 14px;
  cursor: pointer;
  text-align: center;
  width: 100%;
  user-select: all;
  transition: border-color var(--transition);
}
.secret-key:hover { border-color: var(--green); }

/* ── Step indicator ────────────────────────────────────────── */
.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.step {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 13px; color: var(--text2);
}
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,.3);
  color: var(--green);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

/* ── Backup codes ──────────────────────────────────────────── */
.backup-codes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
}
.backup-code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-align: center;
  padding: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--green-light);
}

/* ── Auth footer links ─────────────────────────────────────── */
.auth-footer-links {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text3);
}
.auth-footer-links a {
  color: var(--green);
  text-decoration: none;
}
.auth-footer-links a:hover { text-decoration: underline; }

/* ── Misc helpers ──────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-green  { color: var(--green); }
.text-danger { color: var(--danger); }
.text-muted  { color: var(--text3); }
.text-sm     { font-size: 12.5px; }
.text-xs     { font-size: 11.5px; }
.font-mono   { font-family: var(--font-mono); }
.font-display{ font-family: var(--font-display); }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.mb-0        { margin-bottom: 0 !important; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.w-full      { width: 100%; }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(0,0,0,.15);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp .45s ease both; }
.fade-up-1 { animation-delay: .05s; }
.fade-up-2 { animation-delay: .1s; }
.fade-up-3 { animation-delay: .15s; }
.fade-up-4 { animation-delay: .2s; }
.fade-up-5 { animation-delay: .25s; }

/* ── Error pages ───────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.error-code {
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 800;
  color: var(--border2);
  line-height: 1;
  margin-bottom: 16px;
}
.error-msg  { font-size: 18px; color: var(--text2); margin-bottom: 24px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

@media (max-width: 480px) {
  .auth-form-panel { padding: 24px 16px; }
  .auth-card { max-width: 100%; }
  .backup-codes-grid { grid-template-columns: 1fr; }
}
