/* ========================================================================
   NCAA D1 Baseball Elo — site theme
   ======================================================================== */

@import url("./fonts.css");

:root {
  --bg:           #000000;
  --bg-elevated:  #0e0e0e;
  --bg-hover:     #1a1a1a;
  --border:       #2a2a2a;
  --border-soft:  #181818;
  --text:         #f5f5f5;
  --text-dim:     #a8a8a8;
  --text-muted:   #707070;
  --accent:       #FFA300;
  --accent-dim:   #CF7F00;
  --win:          #36d399;
  --loss:         #ff5252;
  --chart-line-dim: #707070;
  --radius:       6px;
  --shadow:       0 4px 18px rgba(0,0,0,0.7);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Gotham Office", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  --accent-fade: rgba(255, 163, 0, 0.16);     /* orange tint for hover/active backgrounds */
  --accent-fade-strong: rgba(255, 163, 0, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font-family: var(--sans); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Top nav ----- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; gap: 24px;
}
.nav-brand {
  font-weight: 700; font-size: 16px;
  color: var(--text);
  letter-spacing: 0.3px;
}
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  color: var(--text-dim);
  font-size: 13px; padding: 6px 12px; border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: background 0.12s, color 0.12s;
}
.nav-links a:hover {
  background: var(--accent-fade);
  color: var(--accent);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-fade-strong);
}
.nav-meta { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }

/* ----- Page container ----- */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px;
}

.section-title {
  font-size: 22px; font-weight: 600; margin: 0 0 18px;
  display: flex; align-items: baseline; gap: 12px;
}
.section-title .sub {
  font-size: 13px; color: var(--text-dim); font-weight: 400;
}

/* ----- Search bar ----- */
.search-wrap {
  margin-bottom: 18px;
  position: relative;
}
.search-input {
  width: 100%; max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 13px; border-radius: var(--radius);
  font-size: 14px; font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-fade);
}

/* ----- Leaderboard table ----- */
.lb-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lb-table th, .lb-table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.lb-table th {
  background: var(--bg-hover);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.lb-table th:hover { color: var(--accent); }
.lb-table th.sort-asc::after  { content: "  ▲"; color: var(--accent); font-size: 10px; }
.lb-table th.sort-desc::after { content: "  ▼"; color: var(--accent); font-size: 10px; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tbody tr:hover {
  background: var(--accent-fade);
  cursor: pointer;
}
.lb-table tbody tr:hover td.team span:last-child { color: var(--accent); }
.lb-table td.rank { font-family: var(--mono); color: var(--text-dim); width: 50px; }
.lb-table td.team {
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.lb-table td.team img { width: 22px; height: 22px; border-radius: 3px; }
.lb-table td.numeric { font-family: var(--mono); text-align: right; }

/* ----- Team detail header ----- */
.team-header {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 22px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}
.team-header img { width: 64px; height: 64px; border-radius: 6px; flex-shrink: 0; }
.team-header h1 { margin: 0 0 6px; font-size: 28px; }
.team-header .meta {
  display: flex; gap: 18px; font-size: 13px; color: var(--text-dim);
  flex-wrap: wrap;
}
.team-header .meta b { color: var(--text); font-family: var(--mono); }

/* ----- Two-column layout ----- */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}
@media (max-width: 1024px) { .grid-2col { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px; font-weight: 600; margin: 0 0 14px;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.6px;
}

/* ----- Schedule list (in team detail) ----- */
.sched {
  max-height: 580px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sched-row {
  display: grid;
  grid-template-columns: 70px 24px 1fr 90px 60px;
  gap: 8px; align-items: center;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.sched-row:hover { background: var(--accent-fade); }
.sched-row .date { color: var(--text-dim); font-family: var(--mono); }
.sched-row .site {
  font-size: 10px; color: var(--text-muted);
  font-weight: 600; text-align: center;
}
.sched-row .opp { color: var(--text); }
.sched-row .opp img { width: 16px; height: 16px; vertical-align: middle; margin-right: 6px; }
.sched-row .result { font-family: var(--mono); text-align: right; }
.sched-row .result .w { color: var(--win); font-weight: 700; }
.sched-row .result .l { color: var(--loss); font-weight: 700; }
.sched-row .delta { font-family: var(--mono); text-align: right; }
.sched-row .delta.pos { color: var(--win); }
.sched-row .delta.neg { color: var(--loss); }
.sched-row.active {
  background: var(--accent-fade-strong);
  border-left: 3px solid var(--accent);
  padding-left: 6px; margin-left: -9px;
}

/* ----- Chart area ----- */
#elo-chart {
  width: 100%;
  min-height: 460px;
  position: relative;
}
#elo-chart svg { width: 100%; height: 460px; display: block; }
.elo-line { fill: none; stroke-width: 2.2px; }
.elo-dot {
  stroke: var(--bg-elevated);
  stroke-width: 1.5px;
  cursor: pointer;
  transition: r 0.1s;
}
.elo-dot:hover { r: 6; }
.elo-axis path, .elo-axis line { stroke: var(--border); }
.elo-axis text { fill: var(--text-dim); font-size: 11px; font-family: var(--mono); }
.elo-grid line { stroke: var(--border-soft); stroke-dasharray: 2 3; }
.elo-grid path { display: none; }
.elo-1500 { stroke: var(--text-muted); stroke-dasharray: 4 3; stroke-width: 1px; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.1s;
  min-width: 200px;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-date { color: var(--text-dim); font-family: var(--mono); font-size: 11px; margin-bottom: 4px; }
.tooltip .tt-opp { font-weight: 600; margin-bottom: 6px; }
.tooltip .tt-opp img { width: 16px; height: 16px; vertical-align: middle; margin-right: 5px; }
.tooltip .tt-row { display: flex; justify-content: space-between; margin: 2px 0; }
.tooltip .tt-row span:first-child { color: var(--text-dim); }
.tooltip .tt-row span:last-child { font-family: var(--mono); }
.tooltip .tt-result-w { color: var(--win); font-weight: 700; }
.tooltip .tt-result-l { color: var(--loss); font-weight: 700; }
.tooltip .tt-elo-up { color: var(--win); }
.tooltip .tt-elo-down { color: var(--loss); }

/* ----- Year selector ----- */
.year-pills {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.year-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 13px; border-radius: 18px;
  font-size: 12px; font-family: var(--mono);
  cursor: pointer;
  transition: all 0.1s;
}
.year-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-fade);
}
.year-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

/* ----- Bracket grid ----- */
.bracket-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .bracket-grid { grid-template-columns: 1fr; } }
.regional-card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.regional-card h3 {
  margin: 0 0 10px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: baseline;
  color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--accent-fade-strong);
  padding-bottom: 8px;
}
.regional-card h3 .seed { color: var(--text-dim); font-family: var(--mono); font-weight: 500; }
.team-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px; align-items: center;
  margin: 6px 0;
}
.team-row img { width: 22px; height: 22px; border-radius: 3px; }
.team-row .team-name { font-size: 13px; }
.team-row .team-name a { color: var(--text); }
.team-row .team-name a:hover { color: var(--accent); }
.odds-bars {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px; align-items: center;
  margin-top: 4px;
}
.odds-bar-label { font-size: 10px; color: var(--text-muted); font-family: var(--mono); }
.odds-bar {
  position: relative;
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}
.odds-bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}
.odds-bar-text {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 10px; font-family: var(--mono); color: var(--text);
  text-shadow: 0 0 4px rgba(0,0,0,0.7);
}

/* ----- Bracket detail (team-card with 4 stages) ----- */
.bracket-team {
  background: var(--bg);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 8px 0;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
}
.bracket-team .left { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bracket-team .left img { width: 26px; height: 26px; border-radius: 3px; }
.bracket-team .left .seedchip {
  font-size: 9px; color: var(--text-muted); font-family: var(--mono);
}
.bracket-team .right { display: flex; flex-direction: column; gap: 7px; }
.bracket-team .right .name a {
  font-size: 13px; color: var(--text); font-weight: 500;
}
.bracket-team .right .name a:hover { color: var(--accent); }
.bracket-team .stages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.bracket-team .stage {
  position: relative;
  background: var(--bg-elevated);
  border-radius: 3px;
  padding: 5px 8px;
  font-family: var(--mono);
  overflow: hidden;
}
.bracket-team .stage .stage-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 3px;
  opacity: 0.32;
  pointer-events: none;
}
.bracket-team .stage .stage-row {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.bracket-team .stage .lbl {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.bracket-team .stage .val {
  font-size: 11.5px;
  color: var(--text);
  font-weight: 700;
}

/* ----- Footer ----- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 64px; padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.footer a { color: var(--text-dim); }

/* ----- Loading state ----- */
.loading {
  padding: 60px 0;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
}

/* ----- Hide broken logos cleanly ----- */
img.logo-fallback { display: none; }
