/* Shared football components (player, team, manager, matches, tables).
   Loaded after dark-theme.css and built only on the theme tokens, so every
   rule works in both newspaper themes without a dark override. */

.fb-muted { color: var(--muted); }

/* ── Team crest + name ─────────────────────────────────────────────────── */
.fb-team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  vertical-align: middle;
}
a.fb-team:hover .fb-team-name { text-decoration: underline; text-underline-offset: 2px; }
.fb-team-strong { font-weight: 700; }
.fb-team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-crest { flex: 0 0 auto; object-fit: contain; display: inline-block; }
.fb-crest-xs { width: 16px; height: 16px; }
.fb-crest-sm { width: 20px; height: 20px; }
.fb-crest-md { width: 28px; height: 28px; }
.fb-crest-lg { width: 56px; height: 56px; }
.fb-crest-xl { width: 72px; height: 72px; }

/* ── Headshots ─────────────────────────────────────────────────────────── */
.fb-headshot {
  flex: 0 0 auto;
  object-fit: cover;
  object-position: top;
  border-radius: 50%;
  background: var(--surface-raised);
}
.fb-headshot-xs { width: 24px; height: 24px; }
.fb-headshot-sm { width: 32px; height: 32px; }
.fb-headshot-md { width: 44px; height: 44px; }
.fb-headshot-lg { width: 96px; height: 96px; border-radius: 4px; border: 1px solid var(--line-soft); }

/* ── Form strip ────────────────────────────────────────────────────────── */
.fb-form { display: inline-flex; gap: 3px; }
.fb-form-chip {
  width: 20px; height: 20px;
  display: inline-grid; place-items: center;
  font-size: 0.68rem; font-weight: 700;
  border-radius: 3px;
  color: #fff;
}
.fb-form-w { background: #2f7d4a; }
.fb-form-d { background: #8a8578; }
.fb-form-l { background: #b2453c; }

/* ── Percentile bar ────────────────────────────────────────────────────── */
.fb-pct { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 110px; }
.fb-pct-track { flex: 1; height: 6px; background: var(--surface-raised); border-radius: 3px; overflow: hidden; }
.fb-pct-fill { display: block; height: 100%; border-radius: 3px; }
.fb-pct-high { background: #2f7d4a; }
.fb-pct-mid { background: var(--gold); }
.fb-pct-low { background: #b2453c; }
.fb-pct-num { min-width: 22px; text-align: right; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Page frame ────────────────────────────────────────────────────────── */
.fb-page { padding: 20px 25px; display: block; color: var(--text-soft); }
.fb-breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.fb-breadcrumb a { color: var(--text); text-decoration: none; }
.fb-breadcrumb a:hover { text-decoration: underline; }

.fb-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 3px double var(--line);
}
.fb-hero-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.fb-hero h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.05;
  margin: 0 0 6px;
  color: var(--text);
}
.fb-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 0.92rem; color: var(--muted); }
.fb-hero-meta a { color: var(--text-soft); }
.fb-hero-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.fb-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  color: var(--text-soft);
  white-space: nowrap;
}
.fb-badge-strong { border-color: var(--text); color: var(--text); }
.fb-badge-warn { border-color: var(--danger); color: var(--danger); }

.fb-btn {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 7px 14px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border-radius: 3px;
}
.fb-btn:hover { border-color: var(--text); }
.fb-btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.fb-btn-primary:hover { background: var(--accent-strong); }

.fb-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--text);
  border-radius: 3px;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.fb-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.fb-tabs::-webkit-scrollbar { display: none; }
.fb-tab {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 10px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.fb-tab:hover { color: var(--text); }
.fb-tab.is-active { color: var(--text); border-bottom-color: var(--text); }
.fb-panel[hidden] { display: none; }

.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.fb-chip {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.fb-chip:hover { border-color: var(--text); color: var(--text); }
.fb-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.fb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.fb-grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.fb-stack { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.fb-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 16px;
  min-width: 0;
}
.fb-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
  margin: 0 0 12px;
}
.fb-card-title a { font-weight: 600; letter-spacing: 0.3px; text-transform: none; color: var(--text-soft); }
.fb-section-title {
  font-family: 'Newsreader', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--line);
  padding-bottom: 6px;
  margin: 0 0 12px;
}

/* ── KPI tiles ─────────────────────────────────────────────────────────── */
.fb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; }
.fb-kpi { padding: 10px 12px; background: var(--surface-raised); border-radius: 4px; min-width: 0; }
.fb-kpi-value { display: block; font-size: 1.45rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.fb-kpi-label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-top: 4px; }

/* ── Key/value facts ───────────────────────────────────────────────────── */
.fb-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px 18px; margin: 0; }
.fb-facts div { min-width: 0; }
.fb-facts dt { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.fb-facts dd { margin: 2px 0 0; font-size: 0.95rem; color: var(--text); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.fb-table-wrap { overflow-x: auto; }
.fb-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.fb-table th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: transparent;
}
.fb-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); text-align: right; color: var(--text-soft); }
.fb-table tr:last-child td { border-bottom: none; }
.fb-table .fb-left { text-align: left; }
.fb-table .fb-center { text-align: center; }
.fb-table .fb-strong { font-weight: 700; color: var(--text); }
.fb-table tbody tr.is-own td { background: var(--accent-wash); font-weight: 700; color: var(--text); }
.fb-table tbody tr.is-linked { cursor: pointer; }
.fb-table tbody tr.is-linked:hover td { background: var(--surface-hover); }
.fb-table td.fb-team-cell { text-align: left; max-width: 0; width: 45%; }
.fb-table td.fb-qual { border-left: 3px solid transparent; }
.fb-rank { color: var(--muted); width: 28px; }

/* ── Fixture rows (matches page, team & competition fixtures) ──────────── */
.fb-fixtures { width: 100%; border-collapse: collapse; font-size: 0.92rem; table-layout: fixed; }
.fb-fixtures td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--text-soft); }
.fb-fixtures tr:last-child td { border-bottom: none; }
.fb-fixtures tbody tr.is-linked { cursor: pointer; }
.fb-fixtures tbody tr.is-linked:hover td { background: var(--surface-hover); }
.fb-fx-meta { width: 118px; font-size: 0.8rem; color: var(--muted); }
.fb-fx-meta small { display: block; font-size: 0.72rem; }
.fb-fx-home { text-align: right; }
.fb-fx-home .fb-team { flex-direction: row-reverse; }
.fb-fx-score {
  width: 76px;
  text-align: center;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.fb-fx-score span {
  display: inline-block;
  min-width: 52px;
  padding: 3px 6px;
  border-radius: 3px;
  background: var(--surface-raised);
}
.fb-fx-score.is-live span { background: #2f7d4a; color: #fff; }
.fb-fx-score.is-upcoming span { background: transparent; font-weight: 500; color: var(--muted); font-size: 0.85rem; }
.fb-fx-tail { width: 34px; text-align: right; }

.fb-result {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
}
.fb-result-w { background: #2f7d4a; }
.fb-result-d { background: #8a8578; }
.fb-result-l { background: #b2453c; }

/* ── Leader lists ──────────────────────────────────────────────────────── */
.fb-leaders { list-style: none; margin: 0; padding: 0; }
.fb-leaders li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}
.fb-leaders li:last-child { border-bottom: none; }
.fb-leaders .fb-leader-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.fb-leaders a.fb-leader-name:hover { text-decoration: underline; }
.fb-leaders .fb-leader-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.fb-empty { font-style: italic; color: var(--muted); font-size: 0.9rem; margin: 6px 0; }
.fb-note { font-size: 0.8rem; color: var(--muted); font-style: italic; margin-top: 10px; }

/* ── Radar ─────────────────────────────────────────────────────────────── */
.fb-radar-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 420px; margin: 0 auto; }
.fb-radar-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.fb-radar-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 10px; font-size: 0.8rem; color: var(--text-soft); }
.fb-radar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

@media (max-width: 900px) {
  .fb-grid, .fb-grid-even { grid-template-columns: minmax(0, 1fr); }
  .fb-hero h1 { font-size: 1.8rem; }
}
@media (max-width: 600px) {
  .fb-page { padding: 12px; }
  .fb-hero h1 { font-size: 1.45rem; }
  .fb-fx-meta { width: 70px; }
  .fb-fx-score { width: 62px; }
  .fb-fixtures { font-size: 0.84rem; }
  .fb-crest-lg { width: 44px; height: 44px; }
}

/* ── Ratings ───────────────────────────────────────────────────────────── */
.fb-rating {
  display: inline-block;
  min-width: 34px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  background: var(--surface-raised);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.fb-rating-top { background: #2f7d4a; color: #fff; }
.fb-rating-good { background: #4f8f5f; color: #fff; }
.fb-rating-low { background: #b2453c; color: #fff; }
.fb-kpi-value .fb-rating { font-size: 1.15rem; padding: 2px 8px; }

/* ── Player page ───────────────────────────────────────────────────────── */
.player-facts { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.player-picker { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.player-picker .fb-chips { margin-bottom: 10px; }
.player-picker .fb-chip { display: inline-flex; align-items: center; gap: 6px; }
.market-chart { position: relative; height: 170px; }
.match-log td { white-space: nowrap; }
.match-log .match-venue { display: inline-block; width: 18px; font-size: 0.78rem; }
.match-log td.fb-team-cell { width: auto; max-width: 220px; }
.career-caret { display: inline-block; width: 12px; color: var(--muted); transition: transform 0.15s; }
.career-season-group.is-open .career-caret { transform: rotate(90deg); }
.career-comp-row td { font-size: 0.84rem; border-bottom-style: dashed; }
.stat-cat-table td:first-child { max-width: 180px; }
.stat-cat-table .fb-pct { min-width: 100px; }
