/* ============================================================
   style.css — MARF-H2H Dark Theme
   ============================================================ */

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

/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --bg2:         #161b22;
  --bg3:         #1e2535;
  --bg4:         #252d3d;
  --border:      #30363d;
  --accent:      #3a7bd5;
  --accent2:     #00d4aa;
  --text:        #e0e0e0;
  --text-muted:  #8b949e;
  --text-dim:    #6e7681;
  --win:         #27ae60;
  --loss:        #e74c3c;
  --draw:        #f39c12;
  --radius:      12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Layout ──────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h1 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.sidebar-logo .logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover   { color: var(--text); background: var(--bg3); }
.nav-link.active  { color: #fff; background: var(--bg3); border-left-color: var(--accent); }
.nav-link .icon   { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-section {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
  font-weight: 600;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1100px;
}

.page-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.page-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ── Form elements ───────────────────────────────────────── */
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

select, input[type="range"], input[type="number"] {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

select:focus { border-color: var(--accent); }

select option { background: var(--bg3); color: var(--text); }

.form-row { margin-bottom: 1rem; }

.team-selection {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.vs-badge {
  width: 40px;
  height: 40px;
  background: var(--bg4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  margin-bottom: 0.1rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, #2563c7 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.3px;
}

.btn-primary:hover   { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active  { transform: translateY(0); }
.btn-primary:disabled{ opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-scrape {
  width: 100%;
  padding: 0.65rem 1rem;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.5rem;
}

.btn-scrape:hover    { opacity: 0.9; }
.btn-scrape:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 0.6rem 1.2rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--bg4); }

.predict-btn-wrap { margin: 1.5rem 0; }

.btn-predict {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #00d4aa 0%, #00a882 100%);
  border: none;
  border-radius: 10px;
  color: #0d1117;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-predict:hover   { opacity: 0.9; transform: translateY(-1px); }
.btn-predict:disabled{ opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Status messages ─────────────────────────────────────── */
.status-msg {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin: 0.5rem 0;
  display: none;
}

.status-info    { background: #1a2a3a; border-left: 3px solid var(--accent); color: #7ab8f5; }
.status-success { background: #1a3a2a; border-left: 3px solid var(--win);    color: #6fcf97; }
.status-error   { background: #3a1a1a; border-left: 3px solid var(--loss);   color: #eb8585; }

/* ── Data banner ─────────────────────────────────────────── */
.data-banner {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.banner-success { background: #1a3a2a; border: 1px solid #27ae60; color: #6fcf97; }
.banner-warn    { background: #3a3210; border: 1px solid #f39c12; color: #f0c040; }

/* ── Verdict card ────────────────────────────────────────── */
.verdict-box {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid #0f3460;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.verdict-label {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-family: 'Rajdhani', sans-serif;
}

.verdict-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  margin: 0.3rem 0;
}

.conf-text   { color: #bbb; font-size: 0.95rem; margin-bottom: 1rem; }
.conf-text strong { color: #fff; }

.verdict-divider { border: none; border-top: 1px solid #2a3a5a; margin: 1rem auto; width: 60%; }

.score-value { font-family: 'Rajdhani', sans-serif; font-size: 2.2rem; font-weight: 700; color: #f0c040; }
.score-alt   { color: #888; font-size: 0.85rem; margin-top: 4px; }

/* ── Section header ──────────────────────────────────────── */
.section-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.5px;
}

/* ── Probability grid ────────────────────────────────────── */
.prob-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.prob-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.prob-team  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.prob-value { font-family: 'Rajdhani', sans-serif; font-size: 1.8rem; font-weight: 700; color: #fff; }
.prob-bar   { height: 6px; background: var(--bg4); border-radius: 3px; margin-top: 0.5rem; overflow: hidden; }
.prob-fill  { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

/* ── Component grid ──────────────────────────────────────── */
.component-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.comp-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.comp-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.comp-caption {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.6rem;
}

/* ── Metric card ─────────────────────────────────────────── */
.metric-card {
  background: var(--bg3);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.4rem 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.8;
}

.metric-card b     { color: #fff; }
.metric-card small { color: var(--text-muted); }

/* ── Reliability gauge ───────────────────────────────────── */
.reliability-box {
  background: var(--bg3);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.rel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.gauge-track {
  background: var(--bg4);
  border-radius: 4px;
  height: 7px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.gauge-note { color: var(--text-muted); font-size: 0.75rem; margin-top: 5px; }

/* ── Info box ────────────────────────────────────────────── */
.info-box {
  background: var(--bg3);
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Goals grid ──────────────────────────────────────────── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.goal-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  text-align: center;
}

.goal-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.goal-value { font-family: 'Rajdhani', sans-serif; font-size: 1.5rem; font-weight: 700; color: #fff; }

/* ── H2H rows ────────────────────────────────────────────── */
.h2h-list    { display: flex; flex-direction: column; gap: 4px; margin-bottom: 1rem; }

.h2h-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

.h2h-row b  { color: #fff; }
.h2h-home   { background: #1a3a2a; border-left: 3px solid var(--win); }
.h2h-away   { background: #3a1a1a; border-left: 3px solid var(--loss); }
.h2h-draw   { background: #3a3210; border-left: 3px solid var(--draw); }

/* ── Signal box ──────────────────────────────────────────── */
.signal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 2;
}

/* ── Live count tag ──────────────────────────────────────── */
.live-tag {
  font-size: 0.75rem;
  color: var(--accent2);
  padding: 2px 8px;
  background: rgba(0,212,170,0.1);
  border-radius: 20px;
  display: inline-block;
  margin-top: 0.3rem;
}

/* ── Backtester ──────────────────────────────────────────── */
.bt-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.bt-metric {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  border-top: 3px solid var(--border);
}

.bt-metric-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.4rem; }
.bt-metric-value { font-family: 'Rajdhani', sans-serif; font-size: 1.8rem; font-weight: 700; color: #fff; }
.bt-metric-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.bt-tables {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.bt-table-wrap {}

.bt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.bt-table th {
  background: var(--bg3);
  color: var(--text-muted);
  padding: 0.5rem 0.7rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.bt-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.bt-table tr:hover td { background: var(--bg3); }

.bt-full-table { min-width: 700px; }
.bt-scroll     { overflow-x: auto; margin-bottom: 1rem; max-height: 500px; overflow-y: auto; }

.row-correct td { border-left: 2px solid var(--win); }
.row-wrong   td { border-left: 2px solid transparent; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-wrap {
  display: none;
  background: var(--bg3);
  border-radius: 6px;
  height: 8px;
  margin: 0.8rem 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 6px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Filter row ──────────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-group { flex: 1; min-width: 120px; }

.verdict-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.verdict-filters label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
}

.export-row { display: flex; gap: 1rem; margin-top: 1rem; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Fade-in ─────────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Info block ──────────────────────────────────────────── */
.info-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  min-height: 44px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .component-grid { grid-template-columns: 1fr 1fr; }
  .bt-metrics     { grid-template-columns: repeat(3, 1fr); }
  .bt-tables      { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-wrapper    { flex-direction: column; }
  .sidebar        { width: 100%; height: auto; position: static; }
  .main-content   { padding: 1rem; }
  .prob-grid      { grid-template-columns: 1fr; }
  .component-grid { grid-template-columns: 1fr; }
  .goals-grid     { grid-template-columns: 1fr 1fr; }
  .bt-metrics     { grid-template-columns: repeat(2, 1fr); }
  .team-selection { grid-template-columns: 1fr; }
  .vs-badge       { display: none; }
}
