/* ============================================
   AquaFlow Design System Tokens
   ============================================ */

:root {
  /* Colors — Brand */
  --navy: #003366;
  --navy-700: #04284f;
  --navy-900: #0a1933;
  --aqua: #0099cc;
  --aqua-50: #e6f4fa;
  --aqua-100: #cfe9f4;
  --teal: #007a8a;
  --mint: #00c9a7;
  --mint-50: #e6f9f5;
  --sky: #e6f4fa;

  /* Module accents */
  --c-swim-school: #0099cc;
  --c-competitive: #d4a017;
  --c-openwater: #1a7c6e;
  --c-recreation: #f97316;
  --c-club: #003366;
  --c-api: #6366f1;
  --c-parent: #7c3aed;
  --c-admin: #003366;

  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f7f9fb;
  --gray-100: #f2f4f6;
  --gray-200: #e6e9ee;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #4a5568;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #111827;

  /* Status */
  --amber: #f59e0b;
  --amber-50: #fef6e6;
  --red: #dc2626;
  --red-50: #fdecec;
  --gold: #d4a017;

  /* Shadows */
  --sh-2: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --sh-4: 0 2px 4px -1px rgba(16, 24, 40, 0.06), 0 4px 8px -2px rgba(16, 24, 40, 0.06);
  --sh-8: 0 4px 8px -2px rgba(16, 24, 40, 0.06), 0 8px 20px -4px rgba(16, 24, 40, 0.10);
  --sh-16: 0 8px 16px -4px rgba(16, 24, 40, 0.08), 0 24px 48px -8px rgba(16, 24, 40, 0.18);

  /* Radii */
  --r-btn: 8px;
  --r-card: 12px;
  --r-sheet: 20px;
  --r-pill: 999px;

  /* Spacing — 8px base */
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-2xl: 48px;
  --s-3xl: 64px;

  /* Type */
  --f-display: "Syne", system-ui, sans-serif;
  --f-body: "DM Sans", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 22px;
  color: var(--gray-900);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; padding: 0; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--aqua); text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }

/* Type utilities */
.t-display { font-family: var(--f-display); font-weight: 700; font-size: 48px; line-height: 1.05; letter-spacing: -1px; }
.t-h1 { font-family: var(--f-display); font-weight: 700; font-size: 30px; line-height: 1.15; letter-spacing: -0.5px; }
.t-h2 { font-family: var(--f-display); font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -0.2px; }
.t-h3 { font-family: var(--f-body); font-weight: 600; font-size: 18px; line-height: 1.3; }
.t-body-lg { font-family: var(--f-body); font-size: 16px; line-height: 24px; }
.t-body { font-family: var(--f-body); font-size: 14px; line-height: 22px; }
.t-caption { font-family: var(--f-body); font-size: 12px; line-height: 18px; color: var(--gray-600); }
.t-label { font-family: var(--f-body); font-weight: 600; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.t-mono-timer { font-family: var(--f-mono); font-weight: 700; font-size: 40px; letter-spacing: -1px; }
.t-mono-stat { font-family: var(--f-mono); font-weight: 600; font-size: 28px; letter-spacing: -0.5px; }
.t-mono-sm { font-family: var(--f-mono); font-weight: 500; font-size: 13px; }

/* App shell */
html, body, #root { height: 100%; }
#root { display: flex; flex-direction: column; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; border: 2px solid var(--gray-100); }
::-webkit-scrollbar-track { background: transparent; }

/* Focus */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: var(--r-btn);
  font-weight: 600; font-size: 14px;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-700); }
.btn-secondary { background: white; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-secondary:hover { background: var(--sky); }
.btn-ghost { background: transparent; color: var(--aqua); }
.btn-ghost:hover { background: var(--aqua-50); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { filter: brightness(0.95); }
.btn-mint { background: var(--mint); color: var(--navy-900); }
.btn-icon { width: 40px; height: 40px; padding: 0; background: var(--gray-100); border-radius: var(--r-btn); color: var(--gray-700); display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--gray-200); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* Card */
.card {
  background: white; border-radius: var(--r-card); box-shadow: var(--sh-4);
  padding: 20px;
}
.card-flat { background: white; border-radius: var(--r-card); border: 1px solid var(--gray-200); padding: 20px; }
.card-tinted { background: var(--sky); border-radius: var(--r-card); padding: 20px; }

/* Pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--gray-100); color: var(--gray-700);
  font-size: 12px; font-weight: 600;
}
.pill-aqua { background: var(--aqua-50); color: var(--teal); }
.pill-mint { background: var(--mint-50); color: #04866d; }
.pill-amber { background: var(--amber-50); color: #92590a; }
.pill-red { background: var(--red-50); color: var(--red); }
.pill-navy { background: var(--navy); color: white; }

/* Input */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--gray-700); letter-spacing: 0.2px; }
.input, .select, .textarea {
  height: 44px; padding: 0 14px;
  border: 1px solid var(--gray-300); border-radius: var(--r-btn);
  background: white; font-size: 14px; transition: border-color 120ms ease, background 120ms ease;
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 80px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--aqua); outline: none; background: var(--aqua-50); }
.input::placeholder { color: var(--gray-400); }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--navy), var(--aqua)); color: white; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

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

/* Helper layouts */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.muted { color: var(--gray-600); }

/* Animations */
@keyframes ripple {
  0% { transform: scale(0.3); opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(0, 153, 204, 0.5); }
  100% { box-shadow: 0 0 0 16px rgba(0, 153, 204, 0); }
}
@keyframes shimmer {
  0% { background-position: -800px 0; }
  100% { background-position: 800px 0; }
}
.shimmer {
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 280ms ease-out both; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes confetti {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(120vh) rotate(720deg); opacity: 0; }
}

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