@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --bg: #05050a;
  --surface: #0c0d16;
  --surface-2: #12141f;
  --border: #1a1d2e;
  --border-bright: #252840;
  --primary: #6366f1;
  --primary-dim: rgba(99,102,241,0.15);
  --primary-glow: rgba(99,102,241,0.4);
  --success: #10b981;
  --success-dim: rgba(16,185,129,0.15);
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --radius: 16px;
  --radius-sm: 10px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-image:
    radial-gradient(ellipse at 15% 40%, rgba(99,102,241,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 10%, rgba(139,92,246,0.05) 0%, transparent 50%);
  overflow-x: hidden;
}

/* ── LOGO / HEADER ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(5,5,10,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-primary { background: var(--primary-dim); color: var(--primary); border: 1px solid rgba(99,102,241,0.3); }
.badge-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-muted   { background: rgba(255,255,255,0.04); color: var(--text-muted); border: 1px solid var(--border); }

/* ── CARD ── */
.card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  position: relative;
  margin-top: 80px;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(99,102,241,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.card-wide { max-width: 640px; }
.card-xl   { max-width: 760px; }

/* ── STEP PROGRESS ── */
.step-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
}

.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-bright);
  transition: all 0.3s;
}
.step-dot.active  { background: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }
.step-dot.done    { background: var(--success); }

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── TYPOGRAPHY ── */
.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
}

h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ── FORM ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

input[type="text"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

input.code-input {
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 18px;
}

textarea { resize: vertical; min-height: 90px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 24px rgba(99,102,241,0.35);
}
.btn-primary:hover:not(:disabled) {
  background: #818cf8;
  box-shadow: 0 4px 32px rgba(99,102,241,0.5);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-bright);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 24px rgba(16,185,129,0.3);
}
.btn-success:hover { background: #059669; }

.btn-sm { padding: 9px 16px; font-size: 12px; width: auto; }
.btn-icon { width: auto; padding: 10px; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── STATUS BOX ── */
.status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}
.status-box.info    { background: var(--primary-dim);  border: 1px solid rgba(99,102,241,0.3);  color: #a5b4fc; }
.status-box.success { background: var(--success-dim);  border: 1px solid rgba(16,185,129,0.3);  color: #6ee7b7; }
.status-box.warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.status-box.danger  { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }

/* ── FACE ID ANIMATION ── */
.face-id-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
}

.face-id-frame {
  position: relative;
  width: 180px;
  height: 220px;
}

.face-oval {
  position: absolute;
  inset: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--primary-glow), inset 0 0 20px var(--primary-dim);
  animation: faceOvalPulse 2s ease-in-out infinite;
}

@keyframes faceOvalPulse {
  0%,100% { box-shadow: 0 0 20px var(--primary-glow), inset 0 0 20px var(--primary-dim); }
  50%     { box-shadow: 0 0 40px var(--primary-glow), inset 0 0 30px var(--primary-dim); }
}

.face-id-frame .corner {
  position: absolute;
  width: 24px; height: 24px;
  border-color: var(--primary);
  border-style: solid;
}
.corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.face-scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 40%, rgba(163,163,255,0.8) 50%, var(--primary) 60%, transparent 100%);
  filter: blur(1px);
  border-radius: 2px;
  animation: scanLine 2.4s ease-in-out infinite;
}

@keyframes scanLine {
  0%   { top: 8%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

.face-dots {
  position: absolute;
  inset: 20px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 0;
  pointer-events: none;
}

.face-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  margin: auto;
  animation: dotAppear 2.4s ease-in-out infinite;
}

.face-dot:nth-child(odd)  { animation-delay: calc(var(--i, 0) * 0.05s); }
.face-dot:nth-child(even) { animation-delay: calc(var(--i, 0) * 0.05s + 0.1s); }

@keyframes dotAppear {
  0%, 20%  { opacity: 0; }
  50%, 70% { opacity: 0.7; }
  100%     { opacity: 0; }
}

.face-id-frame.success .face-oval {
  border-color: var(--success);
  box-shadow: 0 0 30px rgba(16,185,129,0.5), inset 0 0 20px rgba(16,185,129,0.1);
  animation: none;
}
.face-id-frame.success .face-scan-line { display: none; }
.face-id-frame.success .face-dots { display: none; }
.face-id-frame.success .checkmark { display: flex; }

.checkmark {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  animation: checkIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes checkIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.face-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
  min-height: 20px;
  letter-spacing: 0.04em;
}

/* ── FINGERPRINT ── */
.fingerprint-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  gap: 20px;
}

.fingerprint-zone {
  position: relative;
  width: 160px;
  height: 160px;
  cursor: pointer;
  user-select: none;
}

.fp-svg { width: 100%; height: 100%; }
.fp-svg .fp-arc { stroke: var(--border-bright); fill: none; stroke-width: 1.5; transition: stroke 0.3s; }
.fp-svg.scanning .fp-arc { stroke: var(--primary); animation: fpGlow 0.6s ease-in-out infinite alternate; }
.fp-svg.done .fp-arc { stroke: var(--success); }

@keyframes fpGlow {
  from { opacity: 0.4; }
  to   { opacity: 1; }
}

.fp-scan-line {
  position: absolute;
  left: 10px; right: 10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  top: 0;
  display: none;
  border-radius: 2px;
}
.fp-svg.scanning ~ .fp-scan-line {
  display: block;
  animation: fpScan 1.2s ease-in-out infinite;
}

@keyframes fpScan {
  0%   { top: 10px; opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: 150px; opacity: 0; }
}

.fp-ring {
  position: absolute;
  inset: -10px;
  border: 1px solid var(--primary-dim);
  border-radius: 50%;
  display: none;
  animation: fpRingPulse 1.2s ease-out infinite;
}
.fp-svg.scanning ~ .fp-scan-line ~ .fp-ring { display: block; }

@keyframes fpRingPulse {
  from { transform: scale(0.9); opacity: 0.8; }
  to   { transform: scale(1.15); opacity: 0; }
}

/* ── SIGNATURE ── */
.sig-canvas-wrap {
  position: relative;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  cursor: crosshair;
}

.sig-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 200px;
  touch-action: none;
}

.sig-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  transition: opacity 0.2s;
}

.sig-baseline {
  position: absolute;
  bottom: 40px;
  left: 20px; right: 20px;
  height: 1px;
  background: var(--border);
}

.sig-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* ── RADIO / SCALE ── */
.radio-group, .scale-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}
.radio-option:hover { border-color: var(--primary); background: var(--primary-dim); }
.radio-option input[type="radio"] { accent-color: var(--primary); }
.radio-option input:checked ~ span { color: var(--primary); font-weight: 500; }
.radio-option:has(input:checked) { border-color: var(--primary); background: var(--primary-dim); }

.scale-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.scale-row span:first-child { width: 160px; color: var(--text-dim); flex-shrink: 0; }
.scale-btns { display: flex; gap: 4px; }
.scale-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.scale-btn:hover  { border-color: var(--primary); color: var(--primary); }
.scale-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── CHECKBOX ── */
.check-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}
.check-option:hover { border-color: var(--primary); }
.check-option input[type="checkbox"] { accent-color: var(--primary); margin-top: 2px; flex-shrink: 0; width: 15px; height: 15px; }
.check-option:has(input:checked) { border-color: var(--success); background: var(--success-dim); color: var(--text); }

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 16px;
}
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-header span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── PROGRESS BAR ── */
.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── PARTICIPANT TAG ── */
.participant-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}

/* ── STEP COMPLETE STATE ── */
.complete-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--success-dim);
  border: 2px solid rgba(16,185,129,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ── ADMIN TABLE ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  font-family: 'Space Grotesk', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.15s;
}
.code-chip:hover { border-color: var(--primary); color: var(--primary); }
.code-chip.used  { opacity: 0.4; cursor: default; text-decoration: line-through; }

/* ── ANIMATIONS ── */
.fade-in {
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── MOBILE ── */
@media (max-width: 520px) {
  .card { padding: 28px 20px; }
  .scale-row span:first-child { width: 120px; }
}
