/*
  styles.css — Tema minimalista, responsivo e mobile-first
  Paleta: fundo #0b0f14, superfícies #121826/#0f1720, acentos #2FD39A, texto #e8eef5
*/

:root {
  --bg: #0b0f14;
  --surface: #121826;
  --surface-2: #0f1720;
  --text: #e8eef5;
  --muted: #9aa6b2;
  --accent: #2FD39A;
  --border: #1f2937;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 1200px at 10% -10%, rgba(47,211,154,.12), transparent 40%),
              radial-gradient(1000px 800px at 100% 0%, rgba(47,211,154,.08), transparent 45%),
              var(--bg);
  line-height: 1.5;
}

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(8px);
  background: linear-gradient(to bottom, rgba(11,15,20,.9), rgba(11,15,20,.6));
  border-bottom: 1px solid var(--border);
}
.site-header .container { padding: 18px 0; }
.site-header h1 { margin: 0; font-size: 1.45rem; letter-spacing: .2px; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }
.small { font-size: .875rem; }

/* Tabs */
.tabs { display: flex; gap: 10px; padding: 18px 0 4px; overflow-x: auto; }
.tab-button {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 10px 14px; border-radius: 999px; cursor: pointer;
  transition: transform .08s ease, background .2s ease, color .2s ease;
  white-space: nowrap; font-weight: 600; font-size: .95rem;
}
.tab-button:hover { transform: translateY(-1px); background: var(--surface-2); }
.tab-button.active { background: var(--accent); color: #0a0e13; border-color: transparent; }

/* Sections */
main { padding: 20px 0 60px; }
.tabcontent { display: none; }
.tabcontent.active { display: block; animation: fadeIn .25s ease both; }

.section-header { margin-bottom: 12px; }
.section-header h2 { margin: 0; font-size: 1.25rem; letter-spacing: .2px; }

/* Cards */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0) 60%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 14px 0 18px;
}
.card-title { margin: 0 0 12px; font-size: 1.05rem; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

/* Buttons & Links */
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700;
  padding: 10px 14px; background: var(--accent); color: #07110d; border-radius: 10px;
  border: 0; box-shadow: 0 6px 16px rgba(47,211,154,.25);
}
.btn:hover { filter: brightness(.98); transform: translateY(-1px); }

/* Tables */
.table-wrap { width: 100%; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; background: var(--surface-2); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; }
.table th { position: sticky; top: 0; background: #0d141c; color: var(--text); font-weight: 700; }
.table tr:hover td { background: rgba(255,255,255,.02); }

/* Heatmap container */
.heatmap-wrap { width: 100%; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 18px 0; background: rgba(0,0,0,.25); }
.muted { color: var(--muted); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Ensemble Prediction Styles */
.card.highlight {
  background: linear-gradient(135deg, rgba(47,211,154,.15), rgba(47,211,154,.05));
  border: 1px solid rgba(47,211,154,.3);
}

.ensemble-result {
  text-align: center;
  padding: 20px 0;
}

.ensemble-result .prediction {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 10px;
  font-family: 'Courier New', monospace;
}

.ensemble-result .confidence {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.ensemble-result .timestamp {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Benchmark Interactive Styles */
.benchmark-wrap {
  margin: 15px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.benchmark-wrap .js-plotly-plot {
  background: transparent !important;
}

.benchmark-wrap .plotly .modebar {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
}

.benchmark-wrap .plotly .modebar-btn {
  color: var(--text) !important;
}

.benchmark-wrap .plotly .modebar-btn:hover {
  background: var(--accent) !important;
  color: var(--bg) !important;
}

/* Seção de Benchmark Aprimorada */
.benchmark-card {
  position: relative;
  overflow: hidden;
}

.benchmark-header {
  padding: 0 0 12px 16px;
  margin-bottom: 16px;
  border-radius: 8px 8px 0 0;
}

.benchmark-header .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px 0;
}

.benchmark-icon {
  font-size: 1.2em;
}

.benchmark-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

/* Sumário do benchmark */
.benchmark-summary {
  margin-bottom: 20px;
}

.summary-header {
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-content {
  margin-top: 8px;
}

.md-content {
  background: var(--surface-2);
  padding: 16px;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-x: auto;
}

/* Container de gráficos */
.benchmark-chart-container {
  margin: 16px 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px;
}

.chart-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.chart-info {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Wrapper para gráfico interativo */
.benchmark-chart-wrapper {
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  width: 100%;
  max-width: 100%;
}

.benchmark-chart-wrapper .plotly-graph-div {
  background: transparent !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 400px;
  height: auto !important;
}

.benchmark-chart-wrapper .js-plotly-plot {
  width: 100% !important;
  height: auto !important;
}

.benchmark-chart-wrapper .plotly .modebar {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
}

.benchmark-chart-wrapper .plotly .modebar-btn {
  color: var(--text) !important;
}

.benchmark-chart-wrapper .plotly .modebar-btn:hover {
  background: var(--accent) !important;
  color: var(--bg) !important;
}

/* Wrapper para imagem PNG */
.benchmark-img-wrapper {
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  padding: 8px;
}

.benchmark-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

/* Seção de ações */
.benchmark-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.actions-header {
  margin-bottom: 8px;
}

.actions-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.actions-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-download {
  border: none !important;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Estado vazio */
.benchmark-empty {
  text-align: center;
}

.benchmark-empty-state {
  padding: 40px 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-message {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
}

/* Responsividade */
@media (max-width: 640px) {
  .benchmark-header {
    padding-left: 12px;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .chart-info {
    font-size: 0.75rem;
  }
  
  .actions-buttons {
    flex-direction: column;
  }
  
  .benchmark-chart-wrapper .plotly-graph-div {
    min-height: 300px;
  }
}

/* Cores específicas por jogo (cores oficiais) */
[data-game="lotofacil"] .benchmark-chart-wrapper {
  border-color: #c2318f20;
}

[data-game="supersete"] .benchmark-chart-wrapper {
  border-color: #a8cf4520;
}

[data-game="megasena"] .benchmark-chart-wrapper {
  border-color: #009e4c20;
}

[data-game="quina"] .benchmark-chart-wrapper {
  border-color: #42338b20;
}

[data-game="milionaria"] .benchmark-chart-wrapper {
  border-color: #2e307a20;
}

/* Responsividade adicional para benchmark */
@media (max-width: 1024px) {
  .benchmark-chart-wrapper .plotly-graph-div {
    min-height: 350px;
  }
  
  .benchmark-grid {
    gap: 1.2rem;
  }
}

@media (max-width: 768px) {
  .benchmark-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .benchmark-metrics {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.8rem;
  }
  
  .benchmark-chart-wrapper .plotly .modebar {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 480px) {
  .benchmark-metrics {
    grid-template-columns: 1fr 1fr;
  }
  
  .benchmark-metric {
    text-align: center;
  }
  
  .benchmark-chart-wrapper .plotly-graph-div {
    min-height: 250px;
  }
  
  .benchmark-section h2 {
    font-size: 1.5rem;
  }
  
  .benchmark-metric-value {
    font-size: 1.5rem;
  }
  
  .benchmark-metric-label {
    font-size: 0.75rem;
  }
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .site-header h1 { font-size: 1.25rem; }
  .card { padding: 14px; }
  .table th, .table td { padding: 8px; }
  .ensemble-result .prediction { font-size: 1.5rem; letter-spacing: 2px; }
  .benchmark-wrap { margin: 10px 0; }
}
