/* ===== Site basics ===== */
.hero { padding: 4rem 0; background: linear-gradient(180deg,#f8fafc 0%,#ffffff 100%); }
.navbar-brand { letter-spacing: .2px; }

:root {
  --team-primary: #1f2937;
  --team-primary-text: #ffffff;
  --team-accent: #334155;
  --team-accent-text: #111827;
  --team-accent-soft: rgba(51, 65, 85, 0.14);
  --team-card-shadow: rgba(15, 23, 42, 0.12);
}

/* ===== Use the full window on data-heavy pages ===== */
.container-fluid { max-width: 100% !important; }

/* ===== UNIVERSAL table readability (ALL tables) ===== */
#statsTable table, #cmpTable table, #tpeTable table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#statsTable th, #statsTable td,
#cmpTable  th, #cmpTable  td,
#tpeTable  th, #tpeTable  td {
  padding: 0.45rem 0.70rem !important;             /* comfy cell padding */
  vertical-align: middle;
  border-right: 1px solid #EEF2F7 !important;      /* light column line */
  border-bottom: 1px solid #F1F5F9 !important;     /* light row line */
}

/* ===== Table tooling (filters + column toggles) ===== */
.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  position: relative;
  z-index: 1;
}

.table-tools.table-tools--active {
  z-index: 200;
}

.table-tools__search { flex: 1 1 220px; min-width: 200px; }

.table-tools__status {
  flex: 0 0 auto;
  min-width: 90px;
  text-align: right;
}

.table-tools__columns {
  position: relative;
  flex: 0 0 auto;
}

.table-tools__summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.9rem;
  border: 1px solid #CBD5F5;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2937;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.table-tools__summary::after {
  content: "▾";
  font-size: 0.65rem;
  transform: translateY(-1px);
}

.table-tools__columns[open] .table-tools__summary::after {
  transform: rotate(180deg) translateY(1px);
}

.table-tools__columns .table-tools__summary::-webkit-details-marker { display: none; }

.table-tools__summary:hover,
.table-tools__columns[open] .table-tools__summary {
  border-color: #94a3b8;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.table-tools__panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: min(340px, 85vw);
  max-width: min(420px, 90vw);
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
  z-index: 20;
}

.table-tools__columns[open] .table-tools__panel { display: block; }

.column-toggle-list {
  display: grid;
  gap: 0.5rem 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 0.5rem;
}

.column-toggle.form-check {
  margin-bottom: 0;
  padding-left: 1.75rem;
}

.column-toggle .form-check-input {
  margin-left: -1.75rem;
  margin-top: 0.1rem;
}

.table-column-hidden {
  display: none !important;
}

#statsTable th:last-child, #statsTable td:last-child,
#cmpTable  th:last-child, #cmpTable  td:last-child,
#tpeTable  th:last-child, #tpeTable  td:last-child {
  border-right: none !important;
}

#statsTable thead th, #cmpTable thead th, #tpeTable thead th {
  font-weight: 600;
  background: #FBFCFE;
  border-bottom: 2px solid #E2E8F0 !important;
}

/* Optional zebra striping */
#statsTable tbody tr:nth-child(odd) td,
#cmpTable  tbody tr:nth-child(odd) td,
#tpeTable  tbody tr:nth-child(odd) td { background: #FCFDFF; }

/* ===== Width behavior ===== */
/* TPE & Comparisons: fill the page (no horizontal scroll unless truly necessary) */
#tpeTable table, #cmpTable table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: auto;
  white-space: normal;                                /* allow wrapping */
}

/* Stats: the FIRST (Skaters) table should keep natural width and can scroll.
   We wrap it in .scroll-section via JS. */
.scroll-section .x-scrollbar {
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;                                       /* visible bar */
  border-bottom: 1px solid #e5e7eb;
}
.scroll-section .x-scroll { overflow-x: auto; }
.scroll-section .x-scroll table {
  width: max-content;
  max-width: none !important;
  border-collapse: separate;
}
.scroll-section th, .scroll-section td { white-space: nowrap; } /* numbers compact */
.scroll-section td:nth-child(1), .scroll-section th:nth-child(1) {
  white-space: normal; max-width: 240px;              /* let names wrap */
}

/* Any other Stats tables below (Goalies, Combined): fill page width */
#statsTable > :not(.scroll-section) table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: auto;
  white-space: normal;
}

/* Undo restrictive heights if they come in with pasted HTML */
#statsTable table, #statsTable thead, #statsTable tbody,
#tpeTable table, #tpeTable thead, #tpeTable tbody,
#cmpTable table, #cmpTable thead, #cmpTable tbody {
  height: auto !important; max-height: none !important; overflow: visible !important;
}
#statsTable thead, #tpeTable thead, #cmpTable thead { display: table-header-group !important; }
#statsTable tbody, #tpeTable tbody, #cmpTable tbody { display: table-row-group !important; }

/* Slightly denser type for big numeric tables */
#statsTable table { font-size: 0.92rem; }
@media (max-width: 1200px) { #statsTable table { font-size: 0.88rem; } }

/* === Stats: team theming === */
#statsTable.team-themed thead th {
  background: var(--team-primary, #1f2937);
  color: var(--team-primary-text, #ffffff) !important;
  border-bottom: 2px solid var(--team-primary, #1f2937) !important;
}

#statsTable.team-themed tbody tr:nth-child(odd) td {
  background: var(--team-accent-soft, rgba(148, 163, 184, 0.16));
}

#statsTable.team-themed tbody tr:nth-child(even) td {
  background: #ffffff;
}

#statsTable.team-themed tbody tr:hover td {
  background: var(--team-accent, #334155);
  color: var(--team-primary-text, #ffffff);
}

#statsTable.team-themed tbody tr:hover a { color: inherit; }

#statsTable.team-themed th,
#statsTable.team-themed td {
  border-right: 1px solid rgba(255,255,255,0.18) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12) !important;
}

#statsTable.team-themed .scroll-section {
  border-color: var(--team-primary, #1f2937) !important;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

#statsTable.team-themed .scroll-section .x-scrollbar {
  border-bottom: 1px solid var(--team-primary, #1f2937);
}

#statsTable.team-themed .team-highlight {
  background: var(--team-primary, #1f2937);
  color: var(--team-primary-text, #ffffff);
}

/* === Comparisons: force header/body column alignment via colgroup === */
#cmpTable table {
  table-layout: fixed !important;  /* honor <colgroup> widths */
  width: 100% !important;          /* fill the page width */
}

#cmpTable th, #cmpTable td {
  box-sizing: border-box;          /* include padding/borders in width calc */
  overflow: hidden;                /* avoid column spill when fixed width */
  text-overflow: ellipsis;         /* graceful truncation for long strings */
  white-space: nowrap;             /* keep numbers tidy; change to normal if you want wrapping */
}

/* Keep our global padding & separators you already added */

/* Left-align ALL table headers to match left-aligned data */
#cmpTable thead th,
#statsTable thead th,
#tpeTable thead th {
  text-align: left !important;
}

/* Home league images: keep aspect + nice radius */
.home-league-img { display:block; object-fit:cover; border-radius: .5rem; }

/* Team logo card */
.team-logo-card {
  display: inline-flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  margin: 0;
}
.team-logo-card img {
  width: 150px;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  max-width: 100%;
}
.team-logo-card--vhl img {
  width: 448px;
}
.team-logo-card--vhlm img {
  width: 896px;
}
.team-logo-card > div:last-child {
  flex: 0 1 auto;
  min-width: 0;
}
.team-logo-name {
  font-weight: 700;
  line-height: 1.1;
  font-size: 1.2rem;
  color: var(--team-primary, #111827);
}
.team-logo-league {
  font-size: .9rem;
  color: var(--team-accent-text, #475569);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.team-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 10px 16px rgba(15, 23, 42, 0.12);
}

@media (max-width: 992px) {
  .team-logo-card { gap: .75rem; }
  .team-logo-card img { width: 130px; }
  .team-logo-card--vhl img { width: 320px; }
  .team-logo-card--vhlm img { width: 480px; }
}

@media (max-width: 768px) {
  .team-logo-card { gap: .6rem; }
  .team-logo-card img { width: 100px; }
  .team-logo-card--vhl img { width: 230px; }
  .team-logo-card--vhlm img { width: 320px; }
  .team-logo-card > div:last-child { min-width: 140px; }
}

@media (max-width: 540px) {
  .team-logo-card { justify-content: center; text-align: center; }
  .team-logo-card > div:last-child { flex: 1 1 100%; }
}

@media (max-width: 640px) {
  .table-tools {
    padding: 0.6rem 0.75rem;
    gap: 0.6rem;
  }
  .table-tools__status {
    min-width: 100%;
    text-align: left;
  }
  .table-tools__panel {
    right: auto;
    left: 0;
  }
}