/* ============================================================
   BSL Index — Global Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', Tahoma, Arial, sans-serif;
  background-color: #f0f2f5;
  background-image: none !important;
  color: #1a1a2e;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  overflow-x: hidden;
  animation: fadein 0.3s ease;
  max-width: 100vw;
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ── Links ────────────────────────────────────────────────── */
a { text-decoration: none; transition: color 0.15s; }
a:hover { text-decoration: underline; }

a.linkmain {
  font-size: 9.5pt;
  font-weight: 500;
  color: #4a4a6a;
}
a.linkmain:hover { color: #1a1a2e; }

a.linkhuman {
  font-size: 9.5pt;
  font-weight: 600;
  color: #2563eb;
}
a.linkhuman:hover { color: #1d4ed8; }

/* ── Tables — fit to screen ───────────────────────────────── */
table {
  border-collapse: collapse;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 6px;
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
}

/* Tables with explicit width attrs scroll if needed */
table[width] {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  table-layout: auto;
  border-radius: 12px;
}

/* ── Header cells ─────────────────────────────────────────── */
td.header {
  font-size: 7.5pt;
  font-weight: 600;
  color: #f1f5f9 !important;
  padding: 6px 7px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.plainheader {
  background: #1e293b !important;
  font-family: 'Inter', Tahoma, sans-serif;
  font-size: 16pt;
  font-weight: 700;
  color: #f1f5f9 !important;
  padding: 12px 14px;
  white-space: nowrap;
}

td.headerbg {
  background: #1e293b !important;
  font-family: 'Inter', Tahoma, sans-serif;
  font-size: 7.5pt;
  font-weight: 600;
  color: #94a3b8 !important;
  padding: 5px 8px;
}

/* ── Page title header ────────────────────────────────────── */
td.newheader {
  font-family: 'Inter', Tahoma, sans-serif;
  font-size: 17pt;
  font-weight: 700;
  color: #1e293b;
  padding: 6px 0 4px;
  letter-spacing: -0.02em;
}

/* ── Section / table title ────────────────────────────────── */
td.tableheader {
  font-size: 11pt;
  font-weight: 700;
  color: #1e293b;
  padding: 10px 8px 5px;
}

/* ── Team header ──────────────────────────────────────────── */
td.teamheader {
  font-family: 'Inter', Tahoma, sans-serif;
  font-size: 16pt;
  font-weight: 700;
  color: #fff !important;
  padding: 12px 14px 4px;
}

td.teamheader2 {
  font-family: 'Inter', Tahoma, sans-serif;
  font-size: 9.5pt;
  font-weight: 500;
  color: #e2e8f0 !important;
  padding: 2px 14px 8px;
}

/* Top roster/team banner: keep it as a normal table so the header doesn't collapse */
body > table:first-of-type:has(td.teamheader) {
  display: table !important;
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
  table-layout: auto !important;
}

body > table:first-of-type:has(td.teamheader) td.teamheader,
body > table:first-of-type:has(td.teamheader) td.teamheader2 {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  min-width: 0;
}

/* ── Data cells ───────────────────────────────────────────── */
td.main {
  font-size: 9pt;
  font-weight: 400;
  color: #1e293b;
  padding: 5px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Name columns — allow more space */
td.main:nth-child(2) {
  max-width: 160px;
}

/* ── Alternating rows ─────────────────────────────────────── */
tr.row1 { background: #f1f5f9; }
tr.row1:hover { background: #e8f0fe; }

tr.row2 { background: #e2e8f0; }
tr.row2:hover { background: #dbeafe; }

/* Standings page promotion/relegation bands */
body.page-standings > table:nth-of-type(1):has(td.newheader) + table[width="800"] tr:nth-child(3) {
  background: #f4d35e !important;
}

body.page-standings > table:nth-of-type(1):has(td.newheader) + table[width="800"] tr:nth-last-child(-n+2) {
  background: #efb6b6 !important;
}

body.page-standings > table:nth-of-type(3):has(td.newheader) + table[width="800"] tr:nth-child(3),
body.page-standings > table:nth-of-type(3):has(td.newheader) + table[width="800"] tr:nth-child(4) {
  background: #b7e3be !important;
}

body.page-standings > table:nth-of-type(3):has(td.newheader) + table[width="800"] tr:last-child {
  background: #efb6b6 !important;
}

body.page-standings > table:nth-of-type(5):has(td.newheader) + table[width="800"] tr:nth-child(3) {
  background: #b7e3be !important;
}

/* ── Team colour row ──────────────────────────────────────── */
tr.teamcolor { color: #ffffff; }

/* ── HR divider ───────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid #cbd5e1;
  margin: 10px 0;
}

/* ── Footer font ──────────────────────────────────────────── */
font[size="2"] {
  font-size: 8.5pt;
  color: #64748b;
}

/* ── Menu sidebar ─────────────────────────────────────────── */
body[bgcolor="#990000"],
body[style*="990000"] {
  background: #0f172a !important;
  padding: 10px 6px;
}

a.menulink {
  font-size: 9.5pt;
  font-weight: 500;
  color: #e2e8f0 !important;
  display: flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 5px;
  transition: background 0.15s;
  min-height: 36px;
}

a.menulink:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff !important;
  text-decoration: none;
}

/* ── Utility ──────────────────────────────────────────────── */
br { display: block; margin: 4px 0; content: ""; }

/* Colour rating boxes */
td[height="10"][width="10"] {
  width: 20px !important;
  min-width: 20px !important;
  max-width: 32!important;
  height: 10px !important;
  border-radius: 3px;
}

/* Hide finance sub-table wrapper */
table[width="800"]:has(table[width="320"]) {
  display: none !important;
}

/* ── Scrollbar styling ────────────────────────────────────── */
table[width]::-webkit-scrollbar { height: 8px; }
table[width]::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 2px; }
table[width]::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 2px; }
/* Colour rating box — fixed width */
td > table[border="1"][cellpadding="0"][cellspacing="0"] {
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  display: inline-table !important;
}

td > table[border="1"][cellpadding="0"][cellspacing="0"] td {
  width: 24px !important;
  max-width: 24px !important;
  height: 10px !important;
  padding: 0 !important;
}
/* Shrink the td that contains the colour box */
td:has(> table[border="1"][cellpadding="0"][cellspacing="0"]) {
  width: 30px !important;
  padding: 0 4px !important;
  white-space: nowrap !important;
}
