/* ==================================================
   Stats pages (/stats/{page}/, /stats/{page}/{season}/)
   Loaded after stats-hub.css, which supplies the title,
   status line, avatar faces and the leader board cards.
   Here: season chips, top-3 podium, category chips +
   Total / Per 90 toggle, the season table, About.
================================================== */

/* ── Header ─────────────────────────────────────────────────── */
.stats_board .hub_status {
  margin-top: 10px;
}

.bd_status_link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.bd_status_link .icon {
  font-size: 9px;
}

.bd_status_link:hover {
  color: var(--brand-hover);
}

.bd_status_more {
  display: none;
}

.bd_summary {
  max-width: 720px;
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ── Chip rows (scroll sideways on mobile) ──────────────────── */
.bd_label {
  display: none;
}

.bd_chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.bd_chips::-webkit-scrollbar {
  display: none;
}

.bd_seasons {
  margin-top: var(--space-4);
}

.bd_season_chip,
.bd_cat {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--dark);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.bd_season_chip {
  letter-spacing: 0.02em;
}

.bd_season_chip:hover,
.bd_cat:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.bd_season_chip.is_active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--dark);
}

.bd_cat.is_active {
  background: var(--brand-soft);
  border-color: rgba(57, 169, 151, 0.7);
  color: var(--brand);
}

/* ── Top three ──────────────────────────────────────────────── */
.bd_podium {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: var(--space-5);
}

.bd_pod {
  display: grid;
  grid-template-areas:
    "face"
    "who"
    "value";
  align-content: start;
  min-width: 0;
  padding: 14px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.bd_pod .hub_lead_face {
  grid-area: face;
  justify-self: start;
}

.bd_pod .hub_lead_face .hub_face {
  width: 40px;
  height: 40px;
  font-size: 11px;
}

.bd_pod .hub_who {
  grid-area: who;
  margin-top: 12px;
}

.bd_pod .hub_name {
  font-size: 15px;
}

.bd_pod_sub {
  display: none;
  overflow: hidden;
  font-size: 12px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bd_pod_value {
  grid-area: value;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
}

.bd_pod_num {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
}

.bd_pod_unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bd_rank_alt {
  background: var(--surface-raised);
  color: var(--text-primary);
}

/* The leader: full width, face · who · figure */
.bd_pod--lead {
  grid-column: 1 / -1;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-areas: "face who value";
  align-items: center;
  column-gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(57, 169, 151, 0.08), rgba(57, 169, 151, 0) 60%), var(--dark);
  border-color: rgba(57, 169, 151, 0.45);
}

.bd_pod--lead .hub_lead_face .hub_face {
  width: 48px;
  height: 48px;
  font-size: 13px;
}

.bd_pod--lead .hub_who {
  margin-top: 0;
}

.bd_pod--lead .hub_name {
  font-size: 17px;
}

.bd_pod--lead .bd_pod_sub {
  display: block;
}

.bd_pod--lead .bd_pod_value {
  flex-direction: row;
  margin-top: 0;
}

.bd_pod--lead .bd_pod_num {
  font-size: 40px;
  color: var(--brand);
}

/* ── Category chips + Total / Per 90 ────────────────────────── */
.bd_bar {
  margin-top: var(--space-5);
}

.bd_toggle {
  display: flex;
  gap: 3px;
  margin-top: 12px;
  padding: 3px;
  background: var(--dark);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}

.bd_toggle[hidden] {
  display: none;
}

.bd_toggle_btn {
  flex: 1;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.bd_toggle_btn:hover {
  color: var(--brand);
}

.bd_toggle_btn.is_active {
  background: var(--brand);
  color: var(--dark);
}

.bd_toggle_btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Season table ───────────────────────────────────────────── */
.bd_panels {
  margin-top: var(--space-4);
}

.bd_panel + .bd_panel {
  margin-top: var(--space-4);
}

.js_tabs .bd_panel {
  display: none;
}

.js_tabs .bd_panel.is_active {
  display: block;
}

.js_tabs .bd_panel + .bd_panel {
  margin-top: 0;
}

.bd_table_card {
  overflow: hidden;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.bd_table_head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 16px 16px 14px;
}

.bd_table_title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.bd_table_note {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.bd_scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.bd_table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.bd_table thead th {
  padding: 10px 12px;
  background: var(--surface-sunken);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
  white-space: nowrap;
  color: var(--text-secondary);
}

.bd_table abbr {
  text-decoration: none;
  cursor: help;
}

.bd_table thead th.bd_main {
  color: var(--brand);
}

.bd_table th.bd_pos,
.bd_table td.bd_pos {
  width: 44px;
  padding-left: 16px;
  text-align: left;
}

.bd_table th.bd_player {
  text-align: left;
}

.bd_table tbody td,
.bd_table tbody th {
  height: 56px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  color: var(--text-secondary);
}

.bd_table tbody tr:last-child td,
.bd_table tbody tr:last-child th {
  border-bottom: none;
}

.bd_table td:last-child,
.bd_table th:last-child {
  padding-right: 16px;
}

.bd_table td.bd_pos {
  font-size: 13px;
  font-weight: 700;
}

.bd_table td.bd_main {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.bd_table tbody tr:hover td,
.bd_table tbody tr:hover th {
  background-color: rgba(255, 255, 255, 0.02);
}

.bd_table.js_clip .bd_extra {
  display: none;
}

/* Player cell */
.bd_table th.bd_player {
  font-weight: inherit;
  text-align: left;
}

.bd_cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.bd_crest {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dark-secondary);
  border: 1px solid var(--border);
}

.bd_crest .team_badge {
  width: 18px;
  height: 18px;
  justify-content: center;
}

.bd_crest .team_badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bd_crest .team_badge--initials {
  border: none;
  background: none;
  font-size: 8px;
  font-weight: 800;
}

.bd_who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bd_name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  text-overflow: ellipsis;
}

.bd_club {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
  text-overflow: ellipsis;
}

a.bd_cell:hover .bd_name {
  color: var(--brand);
}

/* Phones: apps and minutes move under the name; the ranked figure comes first */
.bd_mmeta {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.bd_table .bd_am {
  display: none;
}

.bd_table {
  min-width: 0;
}

/* Mobile: rank + player stay put while the figures scroll */
.bd_table .bd_pos,
.bd_table .bd_player {
  position: sticky;
  z-index: 1;
  background: var(--dark);
}

.bd_table thead .bd_pos,
.bd_table thead .bd_player {
  background: var(--surface-sunken);
}

.bd_table .bd_pos {
  left: 0;
}

.bd_table .bd_player {
  left: 44px;
  max-width: 170px;
  box-shadow: 8px 0 10px -8px rgba(0, 0, 0, 0.6);
}

.bd_show_all {
  display: block;
  width: 100%;
  height: 50px;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--brand);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.bd_show_all[hidden] {
  display: none;
}

.bd_show_all:hover {
  background: rgba(57, 169, 151, 0.06);
}

.bd_legend {
  margin: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ── About ──────────────────────────────────────────────────── */
.bd_about {
  margin-top: var(--space-6);
  padding: 18px 16px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.bd_about_title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 800;
}

.bd_defs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px 40px;
  margin: 0;
}

.bd_defs dt {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.bd_defs dd {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.bd_about_note {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.bd_about a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.bd_about a:hover {
  text-decoration: underline;
}

/* ── Tablet+ (≥ 768px): bars behind the rows, no sticky cells ── */
@media screen and (min-width: 768px) {
  .bd_mmeta {
    display: none;
  }

  .bd_table .bd_am {
    display: table-cell;
  }

  .bd_table {
    min-width: 600px;
  }

  .bd_table tbody tr {
    background: linear-gradient(to right, rgba(57, 169, 151, 0.07) calc(var(--bar, 0%) * 0.7), transparent calc(var(--bar, 0%) * 0.7));
  }

  .bd_table .bd_pos,
  .bd_table .bd_player {
    position: static;
    max-width: none;
    background: none;
    box-shadow: none;
  }

  .bd_table thead .bd_pos,
  .bd_table thead .bd_player {
    background: var(--surface-sunken);
  }

  .bd_defs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bd_about {
    padding: 22px 24px;
  }
}

/* ── Desktop (≥ 1024px) ─────────────────────────────────────── */
@media screen and (min-width: 1024px) {
  .bd_status_more {
    display: inline;
  }

  .bd_summary {
    font-size: 13px;
  }

  .bd_seasons {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: var(--space-5);
  }

  .bd_label {
    display: block;
    flex-shrink: 0;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }

  .bd_seasons .bd_chips {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0 32px 0 0;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  }

  .bd_season_chip,
  .bd_cat {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }

  /* Podium: three equal cards, face · who · figure */
  .bd_podium {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .bd_pod,
  .bd_pod--lead {
    grid-column: auto;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "face who value";
    align-items: center;
    column-gap: 12px;
    padding: 16px 18px;
  }

  .bd_pod .hub_lead_face .hub_face {
    width: 44px;
    height: 44px;
    font-size: 12px;
  }

  .bd_pod .hub_who {
    margin-top: 0;
  }

  .bd_pod .hub_name,
  .bd_pod--lead .hub_name {
    font-size: 15px;
  }

  .bd_pod_sub {
    display: block;
  }

  .bd_pod_value,
  .bd_pod--lead .bd_pod_value {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    margin-top: 0;
  }

  .bd_pod_num,
  .bd_pod--lead .bd_pod_num {
    font-size: 34px;
  }

  .bd_pod_unit {
    font-size: 11px;
  }

  /* Category chips left, toggle right */
  .bd_bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: var(--space-6);
  }

  .bd_cats {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
  }

  .bd_toggle {
    flex-shrink: 0;
    margin-top: 0;
    border-radius: 10px;
  }

  .bd_toggle_btn {
    flex: 0 0 auto;
    min-width: 80px;
    height: 32px;
    border-radius: 7px;
    font-size: 13px;
  }

  .bd_table_head {
    padding: 18px 18px 14px;
  }

  .bd_table th.bd_pos,
  .bd_table td.bd_pos {
    padding-left: 18px;
  }

  .bd_table td:last-child,
  .bd_table th:last-child {
    padding-right: 18px;
  }

  .bd_legend {
    padding: 12px 18px 14px;
  }

  .stats_board .hub_group {
    margin-top: var(--space-7);
  }
}
