/* ============================================================================
   Football database — site theme
   ========================================================================== */
:root {
  --brand:      #0c2340;   /* deep navy */
  --brand-2:    #123257;
  --accent:     #1d6fb8;   /* primary blue */
  --accent-dk:  #155a96;
  --gold:       #d4af37;
  --bg:         #eef1f5;
  --panel:      #ffffff;
  --line:       #e3e8ef;
  --line-2:     #eef2f7;
  --ink:        #1f2a37;
  --ink-soft:   #5b6b7b;
  --ink-faint:  #8a96a4;
  --good:       #1c8f5a;
  --bad:        #c0392b;
  --radius:     10px;
  --shadow:     0 1px 2px rgba(16,33,56,.06), 0 2px 8px rgba(16,33,56,.06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dk); text-decoration: underline; }

/* ---- header ---- */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 0 22px; height: 56px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 2px 10px rgba(8,20,38,.25);
}
header h1 {
  font-size: 1.05rem; font-weight: 700; letter-spacing: .2px; margin: 0;
  display: flex; align-items: center; gap: 9px;
}
header h1::before {
  content: "⚽"; font-size: 1.15rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}
header nav { display: flex; gap: 4px; }
header nav a {
  color: #c8d6e8; text-decoration: none;
  padding: 7px 14px; border-radius: 7px; font-weight: 500; font-size: .92rem;
  transition: background .12s, color .12s;
}
header nav a:hover { color: #fff; background: rgba(255,255,255,.10); text-decoration: none; }
header nav a.active { color: #fff; background: rgba(255,255,255,.16); }
.gsearch-wrap { position: relative; margin-left: auto; }
.gsearch { width: 280px; max-width: 42vw; padding: 7px 11px; border: 0; border-radius: 8px; font-size: .9rem; font-family: inherit; background: rgba(255,255,255,.15); color: #fff; }
.gsearch::placeholder { color: #c8d6e8; }
.gsearch:focus { outline: 0; background: #fff; color: var(--ink); box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.gsearch-res { position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: 80vw; max-height: 70vh; overflow: auto;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(8,20,38,.28); z-index: 50; padding: 5px; }
.gs-grp { font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); font-weight: 700; padding: 8px 9px 3px; }
.gs-opt { display: flex; align-items: center; padding: 6px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-opt:hover { background: #eef4fb; }
.gs-opt .hint { margin-left: 6px; }
.gs-empty { padding: 9px; color: var(--ink-faint); }

/* ---- app layout (Competitions page): header + navbar + scrolling dashboard ---- */
body.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
#navbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 10px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(16,33,56,.04); flex: none;
}
#navbar select { padding: 8px 11px; font-size: .92rem; font-family: inherit; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); min-width: 140px; }
#navbar select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,111,184,.15); }
#dash { flex: 1; min-height: 0; overflow: auto; padding: 22px 26px; }
.page { padding: 22px 26px; max-width: 1100px; }
.flag { width: 20px; height: 15px; vertical-align: middle; margin-right: 6px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.10); }

/* ---- searchable combobox ---- */
.combo { position: relative; }
.combo-input { padding: 8px 11px; font-size: .92rem; font-family: inherit; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); min-width: 200px; }
.combo-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,111,184,.15); }
.combo-input:disabled { background: #f3f5f8; color: var(--ink-faint); }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 3px); left: 0; min-width: 240px; max-width: 340px;
  max-height: 340px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(16,33,56,.16); padding: 4px; }
.combo-opt { display: flex; align-items: center; padding: 6px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.combo-opt:hover { background: #eef4fb; }
.combo-opt em { color: var(--ink-faint); font-style: normal; font-size: .82em; margin-left: 4px; }
.combo-empty { padding: 7px 9px; color: var(--ink-faint); }

/* ---- headings ---- */
#dash h2, .page h2 { margin: 0 0 2px; font-size: 1.3rem; font-weight: 700; color: var(--brand); }
#dash h3 { margin: 20px 0 6px; font-size: .82rem; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); }
.meta { color: var(--ink-soft); margin: 2px 0 14px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 10px 0 14px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 9px 15px; cursor: pointer;
  font-size: .92rem; color: var(--ink-soft); font-family: inherit;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0;
  transition: color .12s, background .12s;
}
.tabs button:hover { color: var(--accent); background: #f3f7fc; }
.tabs button.active { color: var(--brand); font-weight: 600; border-bottom-color: var(--accent); }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; margin-top: 6px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f4f7fb; color: var(--ink-soft);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:hover { background: #eef4fb; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.rt { text-align: right; }
td.sc { text-align: center; }
.res { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 5px; font-weight: 700; font-size: .8rem; color: #fff; }
.resW { background: var(--good); } .resL { background: var(--bad); } .resD { background: #8a96a4; }
td.gcell { white-space: normal; }
.gchip { display: inline-block; margin-right: 12px; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }

/* fixtures list: full width; Home & Away split the row and hug the centered score */
table.fixtures { width: 100%; table-layout: fixed; }
table.fixtures th, table.fixtures td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.fixtures th:nth-child(1), table.fixtures td:nth-child(1) { text-align: right; }                 /* Home → hugs score */
table.fixtures th:nth-child(2), table.fixtures td:nth-child(2) { text-align: center; width: 96px; }   /* Score */
table.fixtures th:nth-child(3), table.fixtures td:nth-child(3) { text-align: left; }                  /* Away */
table.fixtures th:nth-child(4), table.fixtures td:nth-child(4) { text-align: right; width: 80px; }     /* view */

/* form strip in standings */
.frm { display: inline-block; width: 17px; height: 17px; line-height: 17px; text-align: center; border-radius: 3px;
  font-size: .62rem; font-weight: 700; color: #fff; margin-right: 2px; }
.frmW { background: var(--good); } .frmD { background: #8a96a4; } .frmL { background: var(--bad); }
.frmcell { white-space: nowrap; }

/* standings progression chart */
.progwrap { overflow-x: auto; padding-bottom: 6px; }
.progchart .ax { font-size: 10px; fill: var(--ink-faint); }
.progchart .lbl { font-size: 11px; font-weight: 600; }

/* league table accents */
table.standing tbody tr:first-child { background: #fbf7e8; }
table.standing tbody tr:first-child td:nth-child(2) { font-weight: 700; }
table.standing td:last-child { font-weight: 700; color: var(--brand); }

/* ---- teams accordion ---- */
.teamblk { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--panel); overflow: hidden; box-shadow: var(--shadow); }
.teamhdr { display: flex; align-items: center; gap: 8px; padding: 11px 14px; cursor: pointer; }
.teamhdr:hover { background: #f3f7fc; }
.teamhdr .tw { color: var(--ink-faint); font-size: .72rem; }
.teamhdr em { color: var(--ink-faint); font-style: normal; font-size: .85em; font-weight: 400; }
.teambody { padding: 0 14px 14px; }
.teambody table { box-shadow: none; }

/* ---- forms / filters ---- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 16px; }
.roundbar { margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.rnav { padding: 5px 12px; cursor: pointer; font-family: inherit; font-size: .9rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
.rnav:hover:not(:disabled) { background: #eef4fb; border-color: var(--accent); color: var(--accent-dk); }
.rnav:disabled { opacity: .45; cursor: default; }
.filters input, .filters select, .roundbar select {
  padding: 8px 11px; font-size: .92rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.filters input:focus, .filters select:focus, .roundbar select:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,111,184,.15);
}
.filters input { min-width: 180px; }
.filters button {
  padding: 8px 20px; cursor: pointer; font-family: inherit; font-size: .92rem; font-weight: 600;
  color: #fff; background: var(--accent); border: 0; border-radius: 8px;
  transition: background .12s;
}
.filters button:hover { background: var(--accent-dk); }

/* ---- clickable match rows + inline match view ---- */
tr.clk { cursor: pointer; }
tr.clk:hover { background: #e7f0fa; }
.center { text-align: center; }
.matchhdr { display: flex; align-items: center; gap: 18px; justify-content: center; margin: 10px 0 2px; font-size: 1.15rem; }
.matchhdr .mt { flex: 1; max-width: 320px; font-weight: 600; }
.matchhdr .mt:last-child { text-align: left; }
.matchhdr .ms { font-weight: 800; font-size: 1.5rem; color: var(--brand); font-variant-numeric: tabular-nums; padding: 2px 14px; background: #f1f5fa; border-radius: 8px; }
.matchcard { margin-top: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 18px; box-shadow: var(--shadow); }
.matchtop { text-align: right; }
.closex { font-size: .85rem; color: var(--ink-soft); }
.goals-compact { display: flex; justify-content: center; align-items: flex-start; gap: 16px; margin: 2px 0 14px; font-size: .85rem; }
.goals-compact .gc-side { flex: 1; max-width: 300px; color: var(--ink-soft); }
.goals-compact .gc-home { text-align: right; }
.goals-compact .gc-away { text-align: left; }
.goals-compact .gc-side div { padding: 1px 0; }
.goals-compact .gc-ball { color: var(--ink-faint); padding-top: 1px; }
.goals-compact .gmin { font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.lineups { display: flex; gap: 16px; margin-top: 8px; }
.lup { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.lup-sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); font-weight: 700; margin: 12px 0 5px; border-bottom: 1px solid var(--line-2); padding-bottom: 3px; }
.lup-sec:first-child { margin-top: 0; }
.lup-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.lup-row a { flex: 0 1 auto; }
.lup-row .evs { margin-left: auto; display: flex; gap: 5px; white-space: nowrap; }
.lup-row .ev { font-size: .82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pos { flex: none; display: inline-block; width: 20px; text-align: center; font-size: .68rem; font-weight: 700;
  color: #fff; border-radius: 4px; padding: 1px 0; }
.pos0 { background: #e0a800; } .pos1 { background: #2f7fd1; } .pos2 { background: #1c8f5a; } .pos3 { background: #c0392b; } .pos4 { background: #98a4b3; }

/* ---- misc ---- */
.hint { color: var(--ink-soft); font-size: .9rem; }
.err { color: var(--bad); background: #fdecea; border: 1px solid #f5c6c0; padding: 8px 12px; border-radius: 8px; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #c4cdd8; border-radius: 6px; border: 3px solid var(--bg); }
#tree::-webkit-scrollbar-thumb { border-color: #fff; }
