/* ── Design system ─────────────────────────────────── */
:root {
  --bg: #0a0a0b;
  --card: #111113;
  --border: #27272a;
  --fg: #fafafa;
  --muted: #1c1c1e;
  --muted-fg: #71717a;
  --lime: #d4ff3a;
  --orange: #ff5a1f;
  --blue: #60a5fa;
  --red: #f87171;
  --yellow: #fbbf24;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: 'Bricolage Grotesque', sans-serif; }
a { color: inherit; }

/* ── Buttons ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer; font-weight: 500; font-size: .875rem; padding: 10px 20px; border-radius: 9999px; transition: all .2s; text-decoration: none; font-family: inherit; white-space: nowrap; }
.btn-primary { background: var(--lime); color: var(--bg); font-weight: 600; }
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 0 40px -8px rgba(212,255,58,.6); }
.btn-secondary { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--muted); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.btn-danger:hover { background: rgba(248,113,113,.1); }
.btn-ghost { background: transparent; color: var(--muted-fg); }
.btn-ghost:hover { background: var(--muted); color: var(--fg); }
.btn-sm { padding: 6px 14px; font-size: .8125rem; }
.btn-xs { padding: 4px 10px; font-size: .75rem; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Cards ──────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.card-sm { padding: 16px; border-radius: 12px; }
.card-xs { padding: 12px; border-radius: 10px; }
.card-hover { transition: border-color .15s, box-shadow .15s; }
.card-hover:hover { border-color: rgba(212,255,58,.3); box-shadow: 0 0 32px -8px rgba(212,255,58,.08); }
.card-lime { border-color: rgba(212,255,58,.2); }
.card-orange { border-color: rgba(255,90,31,.2); }
.card-red { border-color: rgba(248,113,113,.2); }
.card-blue { border-color: rgba(96,165,250,.2); }

/* ── Form elements ──────────────────────────────────── */
.input, .select, .textarea {
  width: 100%; padding: 10px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; color: var(--fg);
  font-size: .875rem; font-family: inherit; outline: none; transition: border-color .2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--lime); }
.textarea { resize: vertical; min-height: 80px; }
.select { appearance: none; cursor: pointer; }
.label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.field-row-3 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr 1fr; }
.form-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; margin-bottom: 0; }
.input-group { display: flex; gap: 8px; }
.input-group .input { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; }

/* ── Badge / Tag ─────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 9999px; font-size: .75rem; font-weight: 500; }
.badge-lime { background: rgba(212,255,58,.15); color: var(--lime); border: 1px solid rgba(212,255,58,.3); }
.badge-orange { background: rgba(255,90,31,.15); color: var(--orange); border: 1px solid rgba(255,90,31,.3); }
.badge-gray { background: var(--muted); color: var(--muted-fg); border: 1px solid var(--border); }
.badge-red { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.badge-blue { background: rgba(96,165,250,.15); color: var(--blue); border: 1px solid rgba(96,165,250,.3); }
.badge-yellow { background: rgba(251,191,36,.15); color: var(--yellow); border: 1px solid rgba(251,191,36,.3); }
.badge-sm { padding: 1px 7px; font-size: .68rem; }
.badge-dot::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Status badges ──────────────────────────────────── */
.status-PRESENT { background: rgba(212,255,58,.15); color: var(--lime); border: 1px solid rgba(212,255,58,.3); }
.status-ABSENT  { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.status-LATE    { background: rgba(251,191,36,.15); color: var(--yellow); border: 1px solid rgba(251,191,36,.3); }
.status-EXCUSED { background: rgba(96,165,250,.15); color: var(--blue); border: 1px solid rgba(96,165,250,.3); }

/* ── Table ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th { font-family: 'JetBrains Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-fg); padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; font-size: .875rem; border-bottom: 1px solid rgba(39,39,42,.5); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
.table-action { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 28px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-lg { max-width: 640px; }
.modal-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 20px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* ── Page header ─────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 600; }
.page-sub { font-size: .875rem; color: var(--muted-fg); margin-top: 4px; }

/* ── Section label (mono uppercase divider) ─────────── */
.section-label { font-family: 'JetBrains Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-fg); margin-bottom: 12px; display: block; }

/* ── Tab navigation ─────────────────────────────────── */
.tab-nav { display: flex; gap: 4px; background: var(--muted); border-radius: 12px; padding: 4px; margin-bottom: 24px; overflow-x: auto; }
.tab-btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: .8125rem; font-weight: 500; cursor: pointer; border: none; background: transparent; color: var(--muted-fg); font-family: inherit; transition: all .15s; white-space: nowrap; }
.tab-btn.active { background: var(--card); color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.tab-btn:hover:not(.active) { color: var(--fg); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Sidebar nav sections ───────────────────────────── */
.nav-section-label { font-family: 'JetBrains Mono', monospace; font-size: .55rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-fg); padding: 12px 10px 4px; opacity: .6; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: .8125rem; text-decoration: none; transition: all .15s; color: var(--muted-fg); }
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--fg); }
.nav-item.active { background: rgba(212,255,58,.12); color: var(--lime); }
.nav-item i { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Empty state ─────────────────────────────────────── */
.empty { border: 1px dashed var(--border); border-radius: 16px; padding: 48px; text-align: center; }
.empty-icon { width: 40px; height: 40px; color: var(--border); margin: 0 auto 16px; display: block; }
.empty-text { color: var(--muted-fg); font-size: .9375rem; }
.empty-sm { padding: 32px 24px; }

/* ── Alert / Flash ──────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: .875rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--red); }
.alert-success { background: rgba(212,255,58,.1); border: 1px solid rgba(212,255,58,.3); color: var(--lime); }
.alert-info { background: rgba(96,165,250,.1); border: 1px solid rgba(96,165,250,.3); color: var(--blue); }
.alert-warning { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); color: var(--yellow); }

/* ── Stat card ───────────────────────────────────────── */
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat-label { font-family: 'JetBrains Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-fg); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 600; }
.stat-sub { font-size: .75rem; color: var(--muted-fg); margin-top: 4px; }
.stat-delta { font-size: .75rem; font-weight: 500; }
.stat-delta-up { color: var(--lime); }
.stat-delta-down { color: var(--red); }
.stat-lime { color: var(--lime); }
.stat-orange { color: var(--orange); }
.stat-blue { color: var(--blue); }
.stat-red { color: var(--red); }

/* ── Wellness slider ─────────────────────────────────── */
.wellness-slider { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 9999px; background: var(--border); outline: none; }
.wellness-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--lime); cursor: pointer; box-shadow: 0 0 12px rgba(212,255,58,.4); }
.wellness-slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--lime); cursor: pointer; border: none; }

/* ── Attendance button ──────────────────────────────── */
.att-btn { padding: 6px 14px; border-radius: 8px; font-size: .75rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all .15s; font-family: inherit; }
.att-btn.active-PRESENT { background: rgba(212,255,58,.2); border-color: rgba(212,255,58,.5); color: var(--lime); }
.att-btn.active-ABSENT  { background: rgba(248,113,113,.2); border-color: rgba(248,113,113,.5); color: var(--red); }
.att-btn.active-LATE    { background: rgba(251,191,36,.2); border-color: rgba(251,191,36,.5); color: var(--yellow); }
.att-btn.active-EXCUSED { background: rgba(96,165,250,.2); border-color: rgba(96,165,250,.5); color: var(--blue); }
.att-btn:not(.active-PRESENT):not(.active-ABSENT):not(.active-LATE):not(.active-EXCUSED) { background: var(--muted); color: var(--muted-fg); }

/* ── Video card ─────────────────────────────────────── */
.video-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color .2s; }
.video-card:hover { border-color: rgba(113,113,122,.5); }
.video-thumb { width: 100%; aspect-ratio: 16/9; background: var(--muted); display: flex; align-items: center; justify-content: center; }
.video-info { padding: 14px; }

/* ── Progress bar ────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 9999px; transition: width .3s; }
.progress-lime { background: var(--lime); }
.progress-orange { background: var(--orange); }
.progress-red { background: var(--red); }
.progress-blue { background: var(--blue); }
.progress-yellow { background: var(--yellow); }

/* ── Player list item ───────────────────────────────── */
.player-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(39,39,42,.5); }
.player-row:last-child { border-bottom: none; }
.player-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .75rem; font-weight: 600; color: var(--muted-fg); }
.player-avatar-lg { width: 48px; height: 48px; font-size: .875rem; }
.player-name { font-weight: 500; font-size: .875rem; }
.player-meta { font-size: .75rem; color: var(--muted-fg); margin-top: 2px; }

/* ── Info row (label + value pairs) ────────────────── */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(39,39,42,.4); font-size: .875rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted-fg); font-size: .8125rem; }

/* ── Score display ──────────────────────────────────── */
.score-display { display: flex; align-items: center; gap: 16px; }
.score-team { text-align: center; }
.score-name { font-size: .75rem; color: var(--muted-fg); margin-bottom: 4px; }
.score-num { font-size: 2.5rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; line-height: 1; }
.score-sep { font-size: 1.5rem; color: var(--muted-fg); font-weight: 300; }

/* ── Timeline / event feed ──────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { display: flex; align-items: flex-start; gap: 12px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: 6px; }
.timeline-dot-lime { background: var(--lime); }
.timeline-dot-orange { background: var(--orange); }
.timeline-dot-red { background: var(--red); }
.timeline-dot-blue { background: var(--blue); }
.timeline-line { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 20px; }
.timeline-line::before { content: ''; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--border); }

/* ── Player bottom nav ──────────────────────────────── */
.player-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: var(--card); border-top: 1px solid var(--border); display: flex; align-items: center; z-index: 40; padding: 0 8px; backdrop-filter: blur(12px); }
.player-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 4px; cursor: pointer; text-decoration: none; color: var(--muted-fg); transition: color .15s; border-radius: 10px; }
.player-nav-item.active { color: var(--lime); }
.player-nav-item:hover:not(.active) { color: var(--fg); background: rgba(255,255,255,.04); }
.player-nav-label { font-size: .62rem; font-weight: 500; }
.player-nav-icon { position: relative; }
.player-nav-badge { position: absolute; top: -4px; right: -6px; background: var(--lime); color: var(--bg); border-radius: 99px; font-size: .55rem; font-weight: 700; padding: 0px 4px; min-width: 14px; text-align: center; }

/* ── Player top bar ─────────────────────────────────── */
.player-topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 16px; height: 52px; display: flex; align-items: center; justify-content: space-between; }
.player-topbar-title { font-weight: 600; font-size: .9375rem; }
.player-content { padding: 16px 16px 80px; max-width: 600px; margin: 0 auto; }

/* ── Chip / filter ──────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 9999px; font-size: .75rem; font-weight: 500; background: var(--muted); color: var(--muted-fg); border: 1px solid var(--border); cursor: pointer; transition: all .15s; }
.chip:hover, .chip.active { background: rgba(212,255,58,.12); color: var(--lime); border-color: rgba(212,255,58,.3); }

/* ── Search bar ─────────────────────────────────────── */
.search-bar { display: flex; align-items: center; gap: 10px; background: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.search-bar input { background: none; border: none; outline: none; color: var(--fg); font-family: inherit; font-size: .875rem; flex: 1; }
.search-bar input::placeholder { color: var(--muted-fg); }

/* ── Utility ─────────────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--muted-fg); }
.text-lime { color: var(--lime); }
.text-orange { color: var(--orange); }
.text-danger { color: var(--red); }
.text-blue { color: var(--blue); }
.text-yellow { color: var(--yellow); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: .8125rem; }
.fs-xs { font-size: .75rem; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.divider-sm { margin: 12px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ── Coach layout responsive ─────────────────────────── */

/* Mobile topbar: visible on mobile, hidden on desktop */
.coach-topbar { display: flex; }

/* Desktop sidebar: hidden on mobile, visible on desktop */
.coach-sidebar { display: none; }

/* Main content: desktop default (sidebar offset) */
.coach-main {
  margin-left: 220px;
  padding: 28px 24px;
}

@media (max-width: 767px) {
  /* Hide desktop sidebar on mobile */
  .coach-sidebar { display: none !important; }
  /* Show mobile topbar on mobile (already flex, just confirming) */
  .coach-topbar { display: flex !important; }
  /* Main: no sidebar offset, but clear the 56px fixed topbar */
  .coach-main {
    margin-left: 0;
    padding: 72px 14px 24px; /* 56px topbar + 16px gap */
  }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-title { font-size: 1.25rem; }
  .page-sub { font-size: .8rem; }
  .grid-2, .grid-3, .grid-4, .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
  /* Show desktop sidebar on desktop */
  .coach-sidebar { display: flex !important; }
  /* Hide mobile topbar on desktop */
  .coach-topbar { display: none !important; }
  /* Main: sidebar offset, normal padding */
  .coach-main { margin-left: 220px; padding: 28px 24px; }
  .hide-desktop { display: none !important; }
}
