/* ═══════════════════════════════════════
   Revolutions Club Admin — Design System
   ═══════════════════════════════════════ */

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

:root {
  --bg-primary: #0c0e14;
  --bg-secondary: #111420;
  --bg-card: #171b2d;
  --bg-card-hover: #1e2340;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #8892a4;
  --text-muted: #505a6e;
  --border: #1e2236;
  --border-light: #2a2f47;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

/* ── Loading Screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 1000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── App Shell ── */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(to bottom, var(--bg-primary) 85%, transparent);
}

.header-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.header-info {
  flex: 1;
  min-width: 0;
}

.header-club {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ── Section ── */
.section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--card-accent, var(--accent));
  opacity: 0.8;
}

.stat-card:active {
  transform: scale(0.98);
}

.stat-card--accent { --card-accent: var(--accent); }
.stat-card--success { --card-accent: var(--success); }
.stat-card--warning { --card-accent: var(--warning); }
.stat-card--danger { --card-accent: var(--danger); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1.2rem;
  opacity: 0.4;
}

/* ── Age Group Bars ── */
.age-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.age-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.age-bar-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 80px;
  text-align: right;
}

.age-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.age-bar-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-sm);
  min-width: 2px;
  transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.age-bar-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ── Alert List ── */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.alert-card:active {
  background: var(--bg-card-hover);
}

.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.alert-icon--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-icon--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.alert-info {
  flex: 1;
  min-width: 0;
}

.alert-name {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.alert-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  text-decoration: none;
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.alert-action:hover {
  background: var(--success);
  color: white;
}

/* ── Fixture List ── */
.fixture-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fixture-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: all var(--transition);
}

.fixture-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.fixture-date {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-light);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: 100px;
}

.fixture-age {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.fixture-teams {
  font-size: 0.875rem;
  font-weight: 600;
}

.fixture-teams .vs {
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 4px;
}

.fixture-teams .highlight {
  color: var(--accent-light);
}

/* ── Registration List ── */
.reg-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reg-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-light);
  flex-shrink: 0;
}

.reg-info {
  flex: 1;
  min-width: 0;
}

.reg-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.reg-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.reg-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 100px;
}

.reg-badge--new {
  background: var(--success-bg);
  color: var(--success);
}

.reg-badge--existing {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ── Empty States ── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── Error State ── */
.error-banner {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin: 24px 0;
}

.error-banner-text {
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── Utility: fade-in animation ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.4s ease-out both;
}

.fade-in-delay-1 { animation-delay: 0.05s; }
.fade-in-delay-2 { animation-delay: 0.1s; }
.fade-in-delay-3 { animation-delay: 0.15s; }
.fade-in-delay-4 { animation-delay: 0.2s; }
.fade-in-delay-5 { animation-delay: 0.25s; }

/* ── Coach 3-column grid ── */
.stats-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Compliance Summary Chips ── */
.compliance-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.compliance-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.compliance-chip--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.compliance-chip--warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ── Historical (de-emphasised) ── */
.historical-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.historical-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
}

.historical-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Responsive ── */
@media (min-width: 520px) {
  .app { max-width: 520px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .app {
    max-width: 640px;
    padding: 0 24px 48px;
  }
}
