/* ============================================
   LEAN EDGE SPORTS — Team Stats Page
   team-stats.css
   ============================================ */

/* --- PAGE HERO --- */
.page-hero {
  padding: 120px 60px 40px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.page-hero h1 {
  font-family: 'tahoma', sans-serif;
  font-size: 64px;
  font-weight: 900;
  color: var(--white);
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --- PAGE LAYOUT --- */
.stats-page-layout {
  display: flex;
  min-height: calc(100vh - 300px);
}

/* --- SIDEBAR --- */
.team-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--darkest-navy);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  position: sticky;
  top: 0;
  max-height: 100vh;
}

.sidebar-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 16px 14px 8px;
}

.sidebar-conf-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Conference toggle */
.conf-toggle {
  display: flex;
  margin: 0 10px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.conf-btn {
  flex: 1;
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 5px;
  color: var(--text-muted);
  transition: all 0.15s;
}

.conf-btn.active {
  background: var(--red);
  color: var(--white);
}

/* Team buttons */
.team-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  color: var(--grey-font);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.team-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
}

.team-btn.active {
  background: rgba(196, 18, 48, 0.08);
  border-left: 3px solid var(--red);
  padding-left: 11px;
  color: var(--white);
  font-weight: 600;
}

.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- MAIN CONTENT --- */
.stats-main {
  flex: 1;
  padding: 24px 28px 60px;
  min-width: 0;
}

/* --- TOOLBAR --- */
.stats-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
}

.search-wrap .ti-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--white);
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  transition: border-color 0.2s;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: rgba(196, 18, 48, 0.5);
}

.sort-select {
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--white);
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
}

.sort-select:focus {
  outline: none;
  border-color: rgba(196, 18, 48, 0.5);
}

.sort-select option {
  background-color: var(--dark-navy);
  color: var(--white);
}

.view-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.view-btn {
  padding: 8px 14px;
  font-size: 12px;
  font-family: 'Barlow', sans-serif;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.view-btn.active {
  background: var(--red);
  color: var(--white);
}

.season-badge {
  padding: 9px 14px;
  background: rgba(196, 18, 48, 0.1);
  border: 1px solid rgba(196, 18, 48, 0.25);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #ff6b6b;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* ============================================
   SEASON NOTICE
   Matches the player stats page styling
============================================ */
.season-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(46, 117, 182, 0.08);
  border: 1px solid rgba(46, 117, 182, 0.2);
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

.season-notice .ti-info-circle {
  font-size: 16px;
  color: var(--mid-blue);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================
   SEASON DROPDOWN
   Dark navy theme, including the options list
============================================ */
.season-select {
  font-weight: 600;
  color: #ff6b6b;
  background-color: var(--dark-navy);
  border-color: rgba(196, 18, 48, 0.3);
}

.season-select:focus {
  outline: none;
  border-color: rgba(196, 18, 48, 0.5);
}

.season-select option {
  background-color: var(--dark-navy);
  color: var(--white);
}

/* --- STAT LEADERS STRIP --- */
.leaders-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.leader-card {
  background: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  border-top: 3px solid var(--red);
}

.leader-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.leader-team {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
}

/* --- TEAM HEADING --- */
.team-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.team-heading h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

.team-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* --- TABLE --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  margin-bottom: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: var(--darkest-navy);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
  transition: color 0.15s;
}

th:hover {
  color: var(--white);
}

th.sorted {
  color: var(--red);
}

.sort-arrow {
  font-size: 10px;
  margin-left: 2px;
  opacity: 0.7;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--white);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.td-rank {
  width: 40px;
}

.rank-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.rank-1 { background: rgba(250,204,21,0.15); color: #facc15; }
.rank-2 { background: rgba(156,163,175,0.15); color: #9ca3af; }
.rank-3 { background: rgba(180,83,9,0.15); color: #f59e0b; }
.rank-other { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.td-team-name {
  font-weight: 600;
  color: var(--white);
  min-width: 160px;
}

.td-record {
  color: var(--text-muted);
  font-size: 12px;
}

/* Colour coded cells */
.cell-high { color: #4ade80; font-weight: 600; }
.cell-low  { color: #f87171; font-weight: 600; }
.cell-mid  { color: var(--white); }

/* Games badge */
.games-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.games-4 { background: rgba(74,222,128,0.12); color: #4ade80; }
.games-3 { background: rgba(96,165,250,0.12); color: #60a5fa; }
.games-2 { background: rgba(248,113,113,0.12); color: #f87171; }

/* --- TEAM CARDS GRID --- */
.team-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.team-card {
  position: relative;
  background: var(--dark-navy);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  display: block;
}

.card-fav-btn {
  position: absolute;
  top: 18px;
  right: 16px;
  z-index: 5;
  background: rgba(13,24,48,0.6);
  border-radius: 50%;
}

.team-card:hover {
  transform: translateY(-4px);
  border-color: rgba(196, 18, 48, 0.3);
}

.card-top-border {
  height: 3px;
  display: flex;
}

.card-top-border .border-left { flex: 1; background: var(--navy); }
.card-top-border .border-right { flex: 1; background: var(--red); }

.card-body {
  padding: 16px 14px 14px;
}

.card-team-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 2px;
  line-height: 1.2;
}

.card-record {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

.card-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.card-stat-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 1;
}

.card-stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.card-games-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.card-games-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- STATS KEY --- */
.stats-key-section {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
}

.key-toggle {
  width: 100%;
  padding: 14px 20px;
  background: var(--darkest-navy);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  font-weight: 500;
  color: var(--grey-font);
  transition: color 0.2s, background 0.2s;
}

.key-toggle:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.02);
}

.key-toggle .ti-help {
  font-size: 15px;
  vertical-align: -2px;
  margin-right: 8px;
  color: var(--red);
}

.key-chevron {
  font-size: 15px;
  transition: transform 0.25s ease;
}

.key-chevron.open {
  transform: rotate(180deg);
}

.stats-key-content {
  padding: 20px 24px 24px;
  background: rgba(13, 24, 48, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.key-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 40px;
}

.key-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.key-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.key-abbr {
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  min-width: 60px;
  flex-shrink: 0;
}

.key-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- RESPONSIVE --- */
@media (max-width: 1100px) {
  .leaders-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .team-sidebar {
    width: 180px;
  }
}

@media (max-width: 900px) {
  .leaders-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-page-layout {
    flex-direction: column;
  }

  .team-sidebar {
    width: 100%;
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-wrap: wrap;
    position: static;
    overflow-x: auto;
  }

  .sidebar-title,
  .sidebar-conf-label {
    width: 100%;
  }

  .conf-toggle {
    width: 100%;
  }

  .team-btn {
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
  }

  .team-btn.active {
    border-left: none;
    border-bottom: 3px solid var(--red);
    padding-left: 14px;
    padding-bottom: 6px;
  }

  .page-hero {
    padding: 100px 24px 30px;
  }

  .page-hero h1 {
    font-size: 44px;
  }

  .stats-main {
    padding: 16px 16px 40px;
  }

  .leaders-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .key-columns {
    grid-template-columns: 1fr;
  }

  .stats-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .leaders-strip {
    grid-template-columns: 1fr 1fr;
  }

  .team-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* --- TEAM NAME LINKS IN TABLE --- */
.team-name-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.team-name-link:hover {
  color: var(--white);
}
