*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, "Times New Roman", Times, serif;
  background: #000000e7;
  color: #e2e8f0;
  min-height: 100vh;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}
header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.5px;
}
header p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid .full-width {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.4rem;
}
.label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #6b7280;
}

input,
select {
  width: 100%;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #111827;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus,
select:focus {
  border-color: #3b82f6;
}
input::placeholder {
  color: #9ca3af;
}

button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #f76c6c;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
button[type="submit"]:hover {
  background: #ff0d0d;
}
button[type="submit"]:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
}

.spinner {
  display: none;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  padding: 1rem;
}
.spinner.visible {
  display: block;
}

.error-box {
  display: none;
  background: #3b1a1a;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  color: #fca5a5;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}
.error-box.visible {
  display: block;
}

/* ── Side-by-side layout (results left, charts right) ── */
#main-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

/* Results */
#results {
  display: none;
}
#results.visible {
  display: block;
}

.results-header {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1rem;
}
.results-header strong {
  color: #ffffff;
  font-size: 1rem;
}

/* Stack the three stat cards vertically on the left panel */
.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
}
.stat-card h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}
.stat-row:last-child {
  border-bottom: none;
}
.stat-label {
  color: #6b7280;
}
.stat-value {
  font-weight: 600;
  color: #111827;
}

.ev-positive {
  color: #4ade80;
}
.ev-negative {
  color: #f87171;
}
.odds-value {
  color: #93c5fd;
  font-weight: 700;
}

.confidence-bar-wrap {
  background: #e5e7eb;
  border-radius: 4px;
  height: 7px;
  margin: 2px 0 6px;
  overflow: hidden;
}
.confidence-bar {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s ease, background-color 0.5s ease;
}

/* Charts (right panel) */
#charts {
  display: none;
}
#charts.visible {
  display: block;
}

.chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.chart-card:last-child {
  margin-bottom: 0;
}
.chart-card h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem 1rem 1rem;
  font-size: 0.85rem;
}
footer a {
  color: #64748b;
  text-decoration: none;
  transition: color 0.15s;
}
footer a:hover {
  color: #e2e8f0;
}

/* ── Responsive: stack everything on smaller screens ── */
@media (max-width: 1000px) {
  #main-layout {
    grid-template-columns: 1fr;
  }
  .results-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .form-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .full-width {
    grid-column: 1;
  }
}
