/* ============================================================
   PDS auth portal — vanilla, brand-aligned
   tokens copied from brandguide.pdesouza.fr
   ============================================================ */

:root {
  --primary:        #00FF41;
  --primary-dim:    #00CC33;
  --primary-glow:   rgba(0, 255, 65, 0.35);
  --primary-soft:   rgba(0, 255, 65, 0.08);

  --amber:          #FFD700;
  --red:            #FF4444;
  --orange:         #FF8800;

  --bg:             #000000;
  --bg-2:           #080D16;
  --bg-3:           #0F1A2A;
  --bg-card:        rgba(8, 13, 22, 0.92);

  --fg:             #D8E2EC;
  --fg-dim:         #8899AA;
  --fg-strong:      #FFFFFF;

  --border:         rgba(0, 255, 65, 0.18);
  --border-soft:    #1E3044;

  --shadow:         0 0 24px rgba(0, 255, 65, 0.06);
  --shadow-strong:  0 0 48px rgba(0, 255, 65, 0.18);

  --font-mono:      'JetBrains Mono', ui-monospace, monospace;
  --font-display:   'Space Grotesk', system-ui, sans-serif;

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --t-instant:    80ms;
  --t-quick:     160ms;
  --t-base:      300ms;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, p, form, label { margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dim); }

button { font: inherit; cursor: pointer; }
input { font: inherit; }

/* ---------- background scanline (subtle CRT vibe) ---------- */
body {
  background:
    radial-gradient(ellipse at top, rgba(0,255,65,0.06), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(0,212,255,0.04), transparent 60%),
    var(--bg);
  position: relative;
  overflow-x: hidden;
}
.scanline {
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(255,255,255,0.012) 3px,
    rgba(255,255,255,0.012) 4px
  );
  z-index: 1;
}

/* ---------- layout ---------- */
.shell {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-4);
}

/* ---------- brand header ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--fg-dim);
  padding: var(--s-3) 0;
}
.brand__mark {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 0 12px var(--primary-glow);
}
.brand__bracket { color: var(--primary-dim); opacity: 0.7; }
.brand__path { color: var(--fg-dim); }
.brand__cursor {
  color: var(--primary);
  animation: blink 1.2s steps(1) infinite;
  margin-left: auto;
  font-size: 0.7rem;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- card ---------- */
.card {
  align-self: center;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s-6) var(--s-5);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  position: relative;
  margin: var(--s-5) 0;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, var(--primary-glow), transparent 50%, var(--primary-soft));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
}

/* ---------- views (animated swap) ---------- */
.view {
  animation: enter var(--t-base) var(--ease);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.view[hidden] { display: none; }

.view__head { display: flex; flex-direction: column; gap: var(--s-1); }
.view__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}
.view__hint {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg-dim);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

/* ---------- form ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-4); }

.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
}
.field__input {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--fg-strong);
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--t-quick) var(--ease),
              box-shadow var(--t-quick) var(--ease),
              background var(--t-quick) var(--ease);
}
.field__input:hover { border-color: var(--border); }
.field__input:focus {
  border-color: var(--primary);
  background: rgba(0,255,65,0.03);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field__input::placeholder { color: var(--fg-dim); opacity: 0.5; }

.check {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.check small { color: var(--fg-dim); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg);
  transition: all var(--t-quick) var(--ease);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
  font-weight: 700;
}
.btn--primary:hover {
  background: var(--primary-dim);
  color: var(--bg);
  box-shadow: 0 0 24px var(--primary-glow);
}

.btn--ghost { background: transparent; color: var(--fg-dim); }
.btn--ghost:hover { color: var(--fg); border-color: var(--border-soft); }

.btn__arrow { transition: transform var(--t-quick) var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }

.btn[aria-busy="true"] {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.btn[aria-busy="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-color: var(--bg) transparent var(--bg) transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn--ghost[aria-busy="true"]::after {
  border-color: var(--fg) transparent var(--fg) transparent;
}

/* ---------- OTP cells ---------- */
.otp {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  justify-content: center;
  margin: var(--s-2) 0;
}
.otp__cell {
  width: 2.5rem;
  height: 3.25rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  outline: none;
  caret-color: var(--primary);
  transition: all var(--t-quick) var(--ease);
}
.otp__cell:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: rgba(0,255,65,0.05);
}
.otp__cell.is-filled {
  border-color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
}
.otp__sep { color: var(--fg-dim); font-size: 1.2rem; }

/* ---------- spinner (loading view) ---------- */
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--s-5) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- alert ---------- */
.alert {
  margin: 0 0 var(--s-4);
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: rgba(255, 68, 68, 0.08);
  color: var(--red);
  border: 1px solid rgba(255, 68, 68, 0.3);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-md);
  animation: shake 0.4s var(--ease);
}
.alert--ok {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--border);
  border-left-color: var(--primary);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* ---------- footer ---------- */
.foot {
  text-align: center;
  padding: var(--s-4) 0;
  border-top: 1px solid var(--border-soft);
}
.foot__link {
  color: inherit;
  text-decoration: none;
}
.foot__link:hover {
  color: var(--accent);
}

/* ---------- typography utils ---------- */
.mono   { font-family: var(--font-mono); }
.muted  { color: var(--fg-dim); }
.small  { font-size: 0.8125rem; }

.actions { display: flex; flex-direction: column; gap: var(--s-3); }

/* ---------- responsive ---------- */
@media (max-width: 420px) {
  .otp__cell { width: 2.1rem; height: 2.8rem; font-size: 1.25rem; }
  .view__title { font-size: 1.5rem; }
  .card { padding: var(--s-5) var(--s-4); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
