/* ── Dashboard Layout ── */
.dash-header {
  background: #0a0a0a;
  border-bottom: 1px solid #222;
  padding: 16px 0;
}
.dash-header h1 { font-size: 1.4em; margin: 4px 0; }
.dash-meta { display: flex; gap: 16px; align-items: center; font-size: 0.85em; color: #888; flex-wrap: wrap; }
.back-link { color: #00c853; text-decoration: none; font-size: 0.85em; }
.live-indicator { display: flex; align-items: center; gap: 6px; color: #00c853; font-weight: 600; font-size: 0.8em; }
.live-dot { width: 8px; height: 8px; background: #00c853; border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Track Tabs ── */
.track-tabs { background: #111; border-bottom: 1px solid #222; overflow-x: auto; white-space: nowrap; padding: 8px 0; }
.track-tabs .container { display: flex; gap: 6px; }
.track-tab {
  background: #1a1a1a; border: 1px solid #333; color: #aaa; padding: 6px 14px;
  border-radius: 20px; cursor: pointer; font-size: 0.8em; transition: all 0.2s;
}
.track-tab:hover { border-color: #555; color: #fff; }
.track-tab.active { background: #00c853; color: #000; border-color: #00c853; font-weight: 600; }
.track-tab .race-count { font-size: 0.75em; opacity: 0.7; margin-left: 4px; }
.track-tab .mtp-badge { font-size: 0.7em; background: rgba(255,255,255,0.15); padding: 1px 5px; border-radius: 8px; margin-left: 4px; }

/* ── Race Cards ── */
.dash-main { padding: 20px 0; }
.loading-msg { text-align: center; color: #666; padding: 40px; }

.race-card {
  background: #111; border: 1px solid #222; border-radius: 8px;
  margin-bottom: 16px; overflow: hidden;
}
.race-card.has-edge { border-color: #00c853; }

.race-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: #1a1a1a; border-bottom: 1px solid #222;
  flex-wrap: wrap; gap: 8px;
}
.race-title { font-weight: 600; font-size: 0.95em; }
.race-info { display: flex; gap: 10px; font-size: 0.8em; color: #888; flex-wrap: wrap; }
.race-tag {
  background: #222; padding: 2px 8px; border-radius: 4px; font-size: 0.75em;
}
.race-tag.turf { background: #1a3a1a; color: #4caf50; }
.race-tag.dirt { background: #3a2a1a; color: #c89e6a; }
.race-tag.synthetic { background: #1a2a3a; color: #6aacda; }
.mtp-tag { font-weight: 600; }
.mtp-tag.soon { color: #ff9800; }
.mtp-tag.imminent { color: #f44336; animation: pulse 1s infinite; }
.mtp-tag.finished { color: #666; }

.race-desc { font-size: 0.75em; color: #666; padding: 4px 14px; border-bottom: 1px solid #1a1a1a; }

/* ── Horse Table ── */
.horse-table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
.horse-table th {
  text-align: left; padding: 6px 10px; color: #666; font-weight: 500;
  font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid #222;
}
.horse-table td { padding: 6px 10px; border-bottom: 1px solid #1a1a1a; }
.horse-table tr:last-child td { border-bottom: none; }
.horse-table tr:hover { background: #1a1a1a; }
.horse-table tr.scratched td { opacity: 0.3; text-decoration: line-through; }
.horse-table tr.scratched.was-pick td {
  opacity: 0.5; text-decoration: line-through;
  background: rgba(244, 67, 54, 0.05);
}
.horse-table tr.scratched.was-pick td::after { content: ''; }
.horse-table tr.scratched.was-pick .horse-name::after {
  content: ' SCRATCHED';
  color: #f44336; font-size: 0.7em; font-weight: 600;
  text-decoration: none; display: inline-block; margin-left: 6px;
}
.horse-table tr.edge-row { background: rgba(0, 200, 83, 0.05); }
.horse-table tr.strong-edge { background: rgba(0, 200, 83, 0.1); }

.horse-num { font-weight: 600; width: 30px; }
.horse-name { font-weight: 500; }
.horse-connections { color: #888; font-size: 0.8em; }
.odds-cell { font-family: monospace; font-weight: 600; text-align: right; }
.odds-live { color: #fff; }
.odds-ml { color: #666; font-size: 0.85em; }
.odds-fav { color: #ff9800; }
.prob-cell { text-align: right; font-family: monospace; }
.edge-cell { text-align: right; font-family: monospace; }
.edge-primary { font-weight: 700; font-size: 1.05em; }
.edge-secondary { font-weight: 400; opacity: 0.5; font-size: 0.85em; }
.edge-positive { color: #00c853; }
.edge-negative { color: #666; }
.edge-strong { color: #00c853; font-size: 1.2em; font-weight: 800; }
.edge-ml-val { color: #777; }
.edge-source-tag { font-size: 0.65em; color: #555; font-weight: 400; vertical-align: super; }
.rec-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 0.75em; font-weight: 600;
}
.rec-strong { background: #00c853; color: #000; }
.rec-value { background: #1a3a1a; color: #4caf50; }
.rec-pass { color: #555; }
.rec-toss { color: #333; }
.form-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.form-tag {
  font-size: 0.7em; padding: 1px 5px; border-radius: 3px;
  background: #222; color: #aaa;
}
.form-tag.peaking { background: #1a3a1a; color: #4caf50; }
.form-tag.improving { background: #1a2a3a; color: #6aacda; }
.form-tag.bounce_risk { background: #3a1a1a; color: #e57373; }
.form-tag.tired { background: #2a1a1a; color: #a67373; }

/* ── Edge Shift Indicators ── */
.shift-up {
  color: #00c853; font-size: 0.75em; margin-left: 4px; font-weight: 600;
  display: inline-block; animation: fadeIn 0.5s;
}
.shift-down {
  color: #f44336; font-size: 0.75em; margin-left: 4px; font-weight: 600;
  display: inline-block; animation: fadeIn 0.5s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Official / Completed Races ── */
.race-card.race-just-finished {
  border-color: #555;
}
.race-card.race-official {
  opacity: 0.7;
  border-color: #333;
}
.race-card.race-official:hover {
  opacity: 1;
}
.official-badge {
  background: #333;
  color: #aaa;
  font-size: 0.7em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 600;
}
.finish-pos {
  display: inline-block;
  font-size: 0.8em;
  font-weight: 600;
  color: #888;
  margin-right: 6px;
}
.finish-win {
  color: #00c853;
}

/* ── Results Box ── */
.results-box {
  border-top: 1px solid #333;
  padding: 8px 14px 10px;
  background: #0d0d0d;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8em;
}
.results-hdr td {
  color: #555;
  font-size: 0.75em;
  font-weight: 500;
  text-transform: uppercase;
  padding: 0 0 4px;
  text-align: right;
}
.results-hdr td:nth-child(1),
.results-hdr td:nth-child(2) { text-align: left; }
.results-table .rp { width: 32px; font-weight: 600; color: #888; }
.results-table .rn { color: #aaa; }
.results-table .rw,
.results-table .rpl,
.results-table .rs { text-align: right; font-family: monospace; color: #777; width: 65px; }
.results-table tr.results-winner .rp,
.results-table tr.results-winner .rn { color: #00c853; }
.results-table tr.results-winner .rw { color: #00c853; font-weight: 600; }
.results-also-row {
  font-size: 0.7em;
  color: #444;
  padding: 4px 0 0;
}
.results-exotics {
  border-top: 1px solid #1a1a1a;
  margin-top: 6px;
  padding-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ex {
  font-size: 0.7em;
  color: #666;
  background: #151515;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.ex b { color: #999; font-weight: 600; }

/* ── Thesis & Guard Rails ── */
.thesis-text {
  font-size: 0.75em;
  color: #999;
  font-style: italic;
  margin-top: 4px;
}

.drift-flag {
  font-size: 0.7em;
  color: #ff9800;
  margin-top: 2px;
}

.horse-table tr.drift-warning {
  background: rgba(255, 152, 0, 0.05);
}
.horse-table tr.drift-warning .odds-live {
  color: #ff9800;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .horse-table { font-size: 0.75em; }
  .horse-table th, .horse-table td { padding: 4px 6px; }
  .race-header { padding: 8px 10px; }
  .form-tags { display: none; }
}
