/* =========================
   ROOT VARIABLES
========================= */
:root {
  --accent: #2fbf71;
  --accent-soft: #5fd89d;
  --accent-dark: #1f8a55;

  --bg-light: #ffffff;
  --bg-dark: #0f1115;

  --card-light: #f3f4f6;
  --card-dark: #1a1d24;

  --text-light: #111111;
  --text-dark: #f1f1f1;

  --text-muted-light: #555555;
  --text-muted-dark: #b5b5b5;
}

/* =========================
   RESET
========================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg-light);
  color: var(--text-light);
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

/* =========================
   HERO / HEADER
========================= */
.hero {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  padding: 14px 16px;
}

.hero-inner {
  max-width: 1100px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  text-decoration: none;
}

.tagline {
  font-size: 0.8rem;
  color: #eafff3;
}

.main-nav {
  display: flex;
  gap: 18px;
}

.main-nav a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

/* =========================
   MAIN
========================= */
main {
  max-width: 1100px;
  margin: auto;
  padding: 30px 16px;
}

section {
  margin-bottom: 50px;
}

h2 {
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}

/* =========================
   GENERIC CARDS
========================= */
.match-card,
.prediction-card,
.stat-card,
.no-data {
  background: var(--card-light);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

body.dark .match-card,
body.dark .prediction-card,
body.dark .stat-card,
body.dark .no-data {
  background: var(--card-dark);
}

/* =========================
   MATCH CARD (DASHBOARD)
========================= */
.match-card.dashboard {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
}

/* Day label */
.match-day {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-soft);
  letter-spacing: 0.08em;
}

/* League */
.match-league {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

/* =========================
   MATCH MAIN (LEFT)
========================= */
.match-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-row.primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.match-time {
  font-weight: 800;
}

.match-teams {
  font-weight: 800;
}

.match-row.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted-light);
}

body.dark .match-row.scores {
  color: var(--text-muted-dark);
}

/* =========================
   CONFIDENCE BADGE
========================= */
.confidence-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(156, 163, 175, 0.25);
  color: #374151;
}

body.dark .confidence-badge {
  color: #e5e7eb;
}

/* =========================
   DETAILS
========================= */
.match-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-soft);
  cursor: pointer;
  text-align: left;
}

.match-details {
  display: none;
  font-size: 0.8rem;
  margin-top: 6px;
  color: var(--text-muted-light);
}

body.dark .match-details {
  color: var(--text-muted-dark);
}

.match-details.open {
  display: block;
}

/* =========================
   INLINE PREDICTIONS (MATCHES)
========================= */
.match-inline-predictions {
  display: contents;
}

/* =========================
   PREDICTION CARD (UNIT)
========================= */
.prediction-card {
  background: rgba(47, 191, 113, 0.18);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}

body.dark .prediction-card {
  background: rgba(95, 216, 157, 0.22);
}

.prediction-card.highlight {
  outline: 2px solid var(--accent);
}

.prediction-market {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.prediction-value {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--accent);
}

/* =========================
   PREDICTIONS – GROUPED ROW
========================= */

.prediction-match-group {
  margin-bottom: 32px;
}

.prediction-match-group h3 {
  margin: 0;
  font-size: 1rem;
}

.prediction-meta {
  font-size: 0.8rem;
  color: var(--text-muted-light);
  margin-bottom: 10px;
}

body.dark .prediction-meta {
  color: var(--text-muted-dark);
}

/* Container row */
.prediction-groups-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Group container */
.prediction-group.compact {
  display: flex;
  flex-direction: column;
  align-items: center; /* ⬅️ CENTRA TUTTO */
  gap: 6px;
}

/* Group title */
.prediction-group-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center; /* ⬅️ CENTRA TESTO */
}

/* Pills container */
.prediction-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* ⬅️ CENTRA LE CARD */
  gap: 6px;
}


/* =========================
   PREDICTION CARD (COMPACT)
========================= */

.prediction-card {
  min-width: auto;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(47, 191, 113, 0.12);
  text-align: center;
}

body.dark .prediction-card {
  background: rgba(95, 216, 157, 0.18);
}

.prediction-card.highlight {
  outline: 2px solid var(--accent);
}

/* Market */
.prediction-market {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-dark);
}

/* Value */
.prediction-value {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--accent);
}

/* Placeholder text */
.prediction-card .prediction-value:contains("Insufficient") {
  font-size: 0.65rem;
  font-weight: 600;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
  .prediction-groups-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .prediction-groups-row {
    grid-template-columns: 1fr;
  }
}


/* =========================
   FOOTER
========================= */
footer {
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--text-muted-light);
}

body.dark footer {
  color: var(--text-muted-dark);
}


/* =========================
   ICONS (LEAGUE & TEAMS)
========================= */

.match-league {
  display: flex;
  align-items: center;
  gap: 8px;
}

.league-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.match-teams {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.team-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.match-teams .vs {
  margin: 0 6px;
  font-weight: 600;
}
/* =========================
   TOP PICKS – HORIZONTAL SCROLL
========================= */

#top-picks-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;

  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
}

#top-picks-list::-webkit-scrollbar {
  display: none; /* Chrome / Safari */
}

/* Card size for Top Picks */
.prediction-card.top-pick {
  min-width: 180px;
  flex-shrink: 0;
}

/* Placeholder style */
.prediction-card.top-pick.placeholder {
  opacity: 0.6;
}
/* =========================
   TOP PICKS – VISIBILITY FIX
========================= */

:root {
  --top-pick-accent: #f97316; /* fire orange */
}

/* Container */
.top-picks-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-behavior: smooth;
}

.top-picks-scroll::-webkit-scrollbar {
  display: none;
}
.top-picks-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Card base (same as prediction-card, but emphasized) */
.top-picks .prediction-card {
  min-width: 240px;
  background: var(--card-dark);
  border-left: 4px solid var(--top-pick-accent);
  box-shadow:
    0 0 0 1px rgba(249, 115, 22, 0.45),
    0 8px 22px rgba(249, 115, 22, 0.25);
}

/* Market label (e.g. Over 2.5, 1X, Goal) */
.top-picks .prediction-market {
  color: #ffffff; /* FULL WHITE */
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Percentage */
.top-picks .prediction-value {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--top-pick-accent);
  margin-top: 6px;
}

/* Match + meta info */
.top-picks .prediction-meta {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #e5e7eb; /* light gray, readable */
}

/* Placeholder (still readable, but calmer) */
.top-picks .prediction-card.placeholder {
  border-left-color: #6b7280;
  box-shadow: none;
}

.top-picks .prediction-card.placeholder .prediction-market {
  color: #f1f5f9;
}

.top-picks .prediction-card.placeholder .prediction-value {
  color: #9ca3af;
}

.top-picks .prediction-card.placeholder .prediction-meta {
  color: #9ca3af;
}

/* =========================
   MOBILE FIX – PREDICTIONS
========================= */
@media (max-width: 768px) {

  /* evita scroll orizzontale globale */
  body {
    overflow-x: hidden;
  }

  /* riga gruppi prediction */
  .prediction-groups-row {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  /* singolo gruppo */
  .prediction-group.compact {
    width: 100%;
    align-items: center;
    text-align: center;
  }

  /* titolo gruppo (1X2, Goals, ecc) */
  .prediction-group-title {
    text-align: center;
    margin-bottom: 10px;
  }

  /* pills container */
  .prediction-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; /* 🔑 */
    gap: 10px;
    width: 100%;
  }

  /* singola card */
  .prediction-card {
    flex: 1 1 calc(33.333% - 10px); /* default 3 per riga */
    max-width: calc(33.333% - 10px);
  }

  /* 2 per riga quando sono poche */
  .prediction-pills:has(.prediction-card:nth-child(2):last-child)
  .prediction-card {
    flex: 1 1 calc(50% - 10px);
    max-width: calc(50% - 10px);
  }

  /* card sempre leggibili */
  .prediction-market {
    font-size: 0.8rem;
  }

  .prediction-value {
    font-size: 0.9rem;
    font-weight: 700;
  }
}

/* =========================
   NAVIGATION – DESKTOP BASE
========================= */

.nav-toggle {
  display: none; /* ⛔ hamburger SEMPRE nascosto su desktop */
}

.main-nav {
  display: flex; /* ✅ menu orizzontale visibile */
}


/* =========================
   GLOBAL MOBILE FIX
========================= */
html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  max-width: 100%;
}

/* =========================
   HEADER / NAV – RESPONSIVE (UNICO)
========================= */

@media (max-width: 768px) {

  .hero-inner {
    flex-wrap: wrap;
  }

  /* HAMBURGER – VISIBILE E LEGGIBILE */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #0f1115;
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 0.8rem;
    cursor: pointer;
  }

  /* MENU CHIUSO */
  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    margin-top: 12px;
    gap: 12px;
  }

  /* MENU APERTO */
  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 10px 0;
    font-size: 1rem;
    color: #ffffff;
  }
}

/* =========================
   REPORT – SUMMARY
========================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.stat-card h3 {
  margin: 0;
  font-size: 1.8rem;
}

.stat-card p {
  margin: 4px 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* =========================
   REPORT – PICK CARD
========================= */
.report-pick {
  background: var(--card-light);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

body.dark .report-pick {
  background: var(--card-dark);
}

.report-pick.win {
  border-left: 4px solid var(--success);
}

.report-pick.loss {
  border-left: 4px solid #ef4444;
}

.report-pick .match {
  font-weight: 800;
}

.report-pick .market {
  font-size: 0.85rem;
  color: var(--accent);
}

.report-pick .result {
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* =========================
   REPORT – CHARTS
========================= */
.report-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.chart-card {
  background: var(--card-light);
  border-radius: 16px;
  padding: 16px;
}

body.dark .chart-card {
  background: var(--card-dark);
}

.chart-card h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
}
/* =========================
   REPORT – HISTORICAL INFO
========================= */
.report-historical-info {
  margin: 20px 0 16px;
  padding-left: 4px;
}

.report-historical-info h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
}

.report-historical-info p {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted-light);
}

body.dark .report-historical-info p {
  color: var(--text-muted-dark);
}

/* =========================
   REPORT – FILTERS
========================= */
.report-filters {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.report-filter {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.report-filter.active {
  background: var(--accent);
  color: #053b24;
}
/* =========================
   REPORT – FILTER MENU
========================= */

.report-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 24px;
}

.report-filter-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-light);
}

body.dark .report-filter-label {
  color: var(--text-muted-dark);
}

.report-select-wrapper {
  position: relative;
}

.report-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 6px 36px 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.report-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(47, 191, 113, 0.25);
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  pointer-events: none;
  color: var(--accent);
}

/* Mobile alignment */
@media (max-width: 600px) {
  .report-filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================
   HEADER – PILL BUTTONS
========================= */

.pill-btn {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.pill-btn:hover {
  background: rgba(47, 191, 113, 0.12);
}

body.dark .pill-btn:hover {
  background: rgba(95, 216, 157, 0.18);
}
/* =========================
   HEADER – PILL BUTTONS (INVERSE)
========================= */

.hero .pill-btn {
  border: 2px solid #ffffff;
  color: #ffffff;
  background: transparent;
}

.hero .pill-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* =========================
   PREDICTION CARD – VARIANTS (SAFE)
========================= */

/* Compact cards (Predictions grouped only) */
.prediction-card.compact {
  padding: 6px 10px;
  border-radius: 10px;
}

/* Compact typography */
.prediction-card.compact .prediction-market {
  font-size: 0.65rem;
  font-weight: 700;
}

.prediction-card.compact .prediction-value {
  font-size: 0.9rem;
  font-weight: 900;
}

/* Dark mode – compact keeps same contrast */
body.dark .prediction-card.compact {
  background: rgba(95, 216, 157, 0.18);
}

/* =========================
   GLOBAL FILTER BAR (MATCHES & PREDICTIONS)
========================= */

.filters-bar {
  display: flex;
  gap: 12px;
  margin: 16px 0 24px;
  flex-wrap: wrap;
  align-items: center;
}

/* Label sopra ai select (opzionale) */
.filter-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-light);
}

body.dark .filter-label {
  color: var(--text-muted-dark);
}

/* Select unificato */
.filter-select {
  appearance: none;
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 8px 36px 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* Focus accessibile */
.filter-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(47, 191, 113, 0.25);
}

/* Dark mode */
body.dark .filter-select {
  color: var(--accent-soft);
  border-color: var(--accent-soft);
}

/* Icona freccia */
.filter-select-wrapper {
  position: relative;
}

.filter-select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  pointer-events: none;
  color: var(--accent);
}

body.dark .filter-select-wrapper::after {
  color: var(--accent-soft);
}

.prediction-inline-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted-light);
}

body.dark .prediction-inline-meta {
  color: var(--text-muted-dark);
}

/* =========================
   MOBILE – MATCH INLINE (FIX DEFINITIVO)
========================= */
@media (max-width: 768px) {

  /* la card match diventa mono-colonna */
  .match-card.dashboard {
    grid-template-columns: 1fr;
  }

  /* wrapper predictions: FORZA riga completa */
  .match-inline-predictions {
    grid-column: 1 / -1;   /* 🔑 CHIAVE */
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
  }

  /* singola card */
  .match-inline-predictions .prediction-card {
    flex: 1 1 0;
    height: 64px;
    padding: 8px 6px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
}

/* =========================
   REPORT – PERFORMANCE BY MARKET
========================= */
.market-performance {
  margin: 24px 0;
}

.market-performance h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
}

.market-performance-table {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px 14px;
  font-size: 0.8rem;
}

.market-performance-table .header {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: var(--text-muted-light);
}

body.dark .market-performance-table .header {
  color: var(--text-muted-dark);
}

.market-performance-row {
  display: contents;
}

.market-name {
  font-weight: 700;
}

.market-win {
  color: #22c55e;
  font-weight: 800;
}

.market-loss {
  color: #ef4444;
  font-weight: 800;
}

.market-accuracy {
  font-weight: 800;
}

/* =========================
   COLLAPSIBLE SECTIONS
========================= */
.collapsible-section {
  margin-bottom: 32px; /* unico spazio tra sezioni */
}
.collapsible-header h2 {
  margin: 0;
}
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.collapsible-header:hover {
  opacity: 0.85;
}
.collapsible-toggle {
  font-size: 1.2rem;   /* ← forza dimensione uguale ovunque */
  line-height: 1;
  display: inline-block;
}
/* stato aperto (esplicito) */
.collapsible-section.is-open .collapsible-toggle {
  transform: rotate(0deg);
}
/* chiuso */
.collapsible-section:not(.is-open) .collapsible-content {
  display: none;
}

/* freccia ruotata */
.collapsible-section:not(.is-open) .collapsible-toggle {
  transform: rotate(-90deg);
}
/* =========================
   BACK TO TOP
========================= */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: #dff2ea;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: none;
  cursor: pointer;
}
