/* ===================================================
   Race Day — Design System
   Background: #0f1117  Card: #1a1d27  Border: #2a2d3a
   =================================================== */

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

:root {
  --bg:           #0f1117;
  --card-bg:      #1a1d27;
  --card-bg-alt:  #1e2130;
  --border:       #2a2d3a;
  --text:         #ffffff;
  --text-2:       #8b8fa8;
  --text-3:       #5a5e75;

  --green:        #10b981;
  --amber:        #f59e0b;
  --red:          #ef4444;
  --orange:       #f97316;
  --gray:         #6b7280;
  --teal:         #14b8a6;
  --blue:         #3b82f6;

  --status-waiting:  #6b7280;
  --status-running:  #10b981;
  --status-finished: #f59e0b;
  --status-dnf:      #ef4444;
  --status-lost:     #f97316;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  --radius:   8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Typography scale */
.t-xs   { font-size: 11px; }
.t-sm   { font-size: 13px; }
.t-base { font-size: 15px; }
.t-lg   { font-size: 17px; }
.t-xl   { font-size: 20px; }
.t-2xl  { font-size: 24px; }
.t-3xl  { font-size: 30px; }

.mono { font-family: var(--font-mono); }
.bold { font-weight: 600; }
.dim  { color: var(--text-2); }
.dimmer { color: var(--text-3); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-primary   { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #0d9488; }

.btn-secondary { background: var(--card-bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #252836; }

.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-ghost     { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--card-bg-alt); color: var(--text); }

.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 13px; }
.btn-lg { padding: 16px 28px; min-height: 52px; font-size: 17px; }
.btn-full { width: 100%; }

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-sm { padding: 14px 16px; }

/* Form elements */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 500; color: var(--text-2); letter-spacing: 0.02em; }
.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--card-bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
  outline: none;
}
.input:focus    { border-color: var(--teal); }
.input.error    { border-color: var(--red); }
.input::placeholder { color: var(--text-3); }

.error-msg {
  font-size: 12px;
  color: var(--red);
  display: none;
}
.error-msg.visible { display: block; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-waiting  { background: rgba(107,114,128,0.15); color: var(--status-waiting); }
.badge-running  { background: rgba(16,185,129,0.15);  color: var(--status-running); }
.badge-finished { background: rgba(245,158,11,0.15);  color: var(--status-finished); }
.badge-dnf      { background: rgba(239,68,68,0.15);   color: var(--status-dnf); }
.badge-lost     { background: rgba(249,115,22,0.15);  color: var(--status-lost); }

/* Pulse animation */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Avatar circle */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Utility */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
