@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  --scfc-blue:     #1E4FA0;
  --scfc-blue-dk:  #163A78;
  --scfc-blue-nav: #122E60;
  --scfc-blue-nav2:#0E2248;
  --scfc-gold:     #F0A500;
  --scfc-gold-lt:  #FFF3CC;
  --scfc-gold-dk:  #C17E00;
  --blue-accent:   #3B6FD4;
  --green:         #16A34A;
  --red:           #DC2626;
  --amber:         #D97706;
  --purple:        #7C3AED;
  --surface:       #FFFFFF;
  --bg:            #F0F3FA;
  --border:        #DDE3F0;
  --border2:       #E8ECF5;
  --text:          #0D1B3E;
  --muted:         #5C6F96;
  --sans:          'DM Sans', sans-serif;
  --mono:          'DM Mono', monospace;
  --sidebar-w:     228px;
  --header-h:      60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════
   LAYOUT
════════════════════════════════════ */
.app-shell { display: flex; min-height: 100vh; }
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.page-body { padding: 24px; flex: 1; overflow-y: auto; }

/* ════════════════════════════════════
   SIDEBAR
════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--scfc-blue-nav2);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-badge {
  width: 42px; height: 42px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-badge img { width: 42px; height: 42px; object-fit: contain; }
.sidebar-brand strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: white;
  line-height: 1.3;
}
.sidebar-brand span {
  display: block;
  font-size: 10px;
  color: var(--scfc-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-nav { flex: 1; padding: 8px 10px; }
.nav-section-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  padding: 10px 8px 4px;
  margin-bottom: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 400;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font-family: var(--sans);
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.nav-item.active { background: var(--scfc-blue); color: white; font-weight: 500; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px 10px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sidebar-user {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  padding: 0 2px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-signout {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-family: var(--sans);
  transition: color 0.12s;
}
.btn-signout:hover { color: rgba(255,255,255,0.8); }

/* ════════════════════════════════════
   TOPBAR
════════════════════════════════════ */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 2px solid var(--scfc-blue);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { flex: 1; min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 600; color: var(--scfc-blue); }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-date {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  background: var(--bg);
  padding: 5px 10px;
  border-radius: 6px;
}

/* ════════════════════════════════════
   KPI / METRIC CARDS
════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--scfc-blue);
  border-radius: 12px 12px 0 0;
}
.kpi-card.kpi-green::before  { background: var(--green); }
.kpi-card.kpi-amber::before  { background: var(--amber); }
.kpi-card.kpi-red::before    { background: var(--red); }
.kpi-card.kpi-purple::before { background: var(--purple); }
.kpi-card.kpi-gold::before   { background: var(--scfc-gold); }

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 30px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 5px;
}
.kpi-sub { font-size: 12px; color: var(--muted); }

/* ════════════════════════════════════
   SECTION TITLES
════════════════════════════════════ */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--scfc-blue);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--scfc-gold);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Gold rule divider */
.gold-rule {
  height: 2px;
  background: linear-gradient(90deg, var(--scfc-gold), transparent);
  border-radius: 1px;
  margin: 4px 0 16px;
}

/* ════════════════════════════════════
   CARDS
════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--scfc-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--scfc-blue); }
.card-body { padding: 16px 18px; }
.card-link {
  font-size: 12px;
  color: var(--scfc-blue);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.card-link:hover { text-decoration: underline; }

/* ════════════════════════════════════
   GRID HELPERS
════════════════════════════════════ */
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 5fr 7fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-22 { margin-bottom: 22px; }

/* ════════════════════════════════════
   MATCH LIST
════════════════════════════════════ */
.match-list { display: flex; flex-direction: column; }
.match-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  transition: background 0.1s;
  cursor: pointer;
}
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: #F5F7FF; }
.match-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.match-dot.w { background: var(--green); }
.match-dot.d { background: var(--amber); }
.match-dot.l { background: var(--red); }
.match-info { flex: 1; min-width: 0; }
.match-teams { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-meta  { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.match-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.match-score { font-size: 13px; font-weight: 600; font-family: var(--mono); }

/* ════════════════════════════════════
   ACTIVITY FEED
════════════════════════════════════ */
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: #F5F7FF; }
.feed-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--scfc-blue);
  flex-shrink: 0;
  margin-top: 4px;
}
.feed-body { flex: 1; min-width: 0; }
.feed-title { font-size: 13px; font-weight: 500; }
.feed-meta  { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.feed-right { flex-shrink: 0; }

/* ════════════════════════════════════
   BADGES
════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-w  { background: #DCFCE7; color: #15803D; }
.badge-d  { background: #FEF9C3; color: #854D0E; }
.badge-l  { background: #FEE2E2; color: #B91C1C; }
.badge-navy   { background: #EEF2FF; color: var(--scfc-blue); }
.badge-green  { background: #DCFCE7; color: var(--green); }
.badge-amber  { background: #FEF9C3; color: var(--amber); }
.badge-purple { background: #F3E8FF; color: var(--purple); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 500; }

/* Role badges */
.role-admin    { background: #EEF2FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.role-analysis { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.role-coaching { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.role-exec     { background: #F3E8FF; color: #7E22CE; border: 1px solid #E9D5FF; }

/* ════════════════════════════════════
   TABLES
════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 9px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text); }
thead th.sort-asc::after  { content: ' ↑'; color: var(--scfc-blue); }
thead th.sort-desc::after { content: ' ↓'; color: var(--scfc-blue); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 10px 16px; vertical-align: middle; }
tbody tr:hover td { background: #F5F7FF; cursor: pointer; }
.td-strong { font-weight: 600; }
.td-muted  { color: var(--muted); font-size: 12px; font-family: var(--mono); }

/* ════════════════════════════════════
   TABS
════════════════════════════════════ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  padding: 11px 16px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active { color: var(--scfc-blue); border-bottom-color: var(--scfc-gold); font-weight: 600; background: var(--surface); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ════════════════════════════════════
   FORM CONTROLS
════════════════════════════════════ */
select,
input[type=text],
input[type=email],
input[type=password] {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border 0.15s;
  -webkit-appearance: none;
}
select:focus, input:focus { border-color: var(--scfc-blue); }

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Login-specific form groups */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.form-group input { width: 100%; }

/* ════════════════════════════════════
   BUTTONS
════════════════════════════════════ */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary { background: var(--scfc-blue); color: white; }
.btn-primary:hover { background: var(--scfc-blue-dk); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--scfc-blue); }
.btn-gold { background: var(--scfc-gold); color: var(--scfc-blue-nav2); font-weight: 600; }
.btn-gold:hover { background: var(--scfc-gold-dk); }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ════════════════════════════════════
   CHARTS
════════════════════════════════════ */
.chart-wrap    { position: relative; height: 200px; padding: 0 18px 16px; }
.chart-wrap-md { position: relative; height: 260px; padding: 0 18px 16px; }
.chart-wrap-lg { position: relative; height: 340px; padding: 0 18px 16px; }

/* ════════════════════════════════════
   STATUS / STATES
════════════════════════════════════ */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.ok   { background: #22C55E; }
.status-dot.warn { background: #F59E0B; }
.status-dot.off  { background: var(--border); }

.loading { color: var(--muted); font-size: 13px; padding: 32px; text-align: center; }
.empty   { color: var(--muted); font-size: 13px; padding: 40px; text-align: center; }

/* ════════════════════════════════════
   PERCENTILE BARS (scout / player cards)
════════════════════════════════════ */
.scout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--scfc-blue);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.scout-card-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.scout-card.card-red    { border-left-color: var(--red); }
.scout-card.card-blue   { border-left-color: var(--blue-accent); }
.scout-card.card-green  { border-left-color: var(--green); }
.scout-card.card-amber  { border-left-color: var(--amber); }
.scout-card.card-purple { border-left-color: var(--purple); }

.metric-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}
.metric-label {
  font-size: 12px;
  color: var(--muted);
  width: 200px;
  flex-shrink: 0;
  line-height: 1.3;
}
.metric-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.metric-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.metric-value {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text);
  min-width: 52px;
  text-align: right;
}
.metric-pct {
  font-size: 11px;
  font-family: var(--mono);
  min-width: 30px;
  text-align: right;
}

/* Profile score strip */
.profile-score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  border-top-width: 3px;
  border-top-style: solid;
}
.profile-score-value {
  font-size: 30px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1;
}
.profile-score-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 5px;
}

/* ════════════════════════════════════
   RUN TYPE PILLS
════════════════════════════════════ */
.run-type-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 18px;
}
.run-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
}

/* ════════════════════════════════════
   LOGIN
════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--scfc-blue-nav2);
  background-image: radial-gradient(ellipse at 60% 20%, rgba(255,255,255,0.03) 0%, transparent 60%);
}
.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 42px 38px;
  width: 390px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { width: 68px; height: 68px; object-fit: contain; }
.login-heading { font-size: 20px; font-weight: 600; text-align: center; color: var(--text); }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin-top: 4px; margin-bottom: 28px; }
.error-msg { color: var(--red); font-size: 12.5px; margin-top: 10px; text-align: center; min-height: 18px; }

/* ════════════════════════════════════
   MODAL
════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,22,40,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 30px;
  width: 400px;
  box-shadow: 0 24px 60px rgba(14,34,72,0.25);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--scfc-blue); margin-bottom: 16px; }

/* ════════════════════════════════════
   FILTER BAR
════════════════════════════════════ */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-select {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border 0.15s;
}
.filter-select:focus { border-color: var(--scfc-blue); }

/* ════════════════════════════════════
   RESPONSIVE
════════════════════════════════════ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; }
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
}
