/*
========================================
BETDOMUS HOMEPAGE CSS
========================================

VERSION: 3.4.12
DATE: 2026-01-04

CHANGELOG:

- v3.4.12 (2026-01-04):
  * 🏗️ FIX ARCHITETTURA: Rimosso selector fragile [style*="display: block"]
  * Sostituito con .is-visible / .is-hidden (classi semantiche)
  * FIX: .live-indicator default display:none (prima era flex)
  * .active ora ha effetto reale (toggle none↔flex)
  * Zero dipendenze da style inline, CSS pulito!

- v3.4.11 (2026-01-04):
  * 🎨 Aggiunto CSS loading placeholder (da daily_ingest)
  * Classi: .loading-container, .loading-card, .loading-spinner
  * Zero CSS inline negli script Python!

- v3.4.9 (2026-01-02):
  * 👻 Badge LIVE nascosto inizialmente (opacity: 0)
  * Previene flash minutaggio vecchio al reload
  * Visibile solo dopo primo aggiornamento JS

- v3.4.8 (2026-01-02):
  * 📏 Score box width: 80px → 90px (previene testo su due righe)
  * Grid vista nazione: 70px 1fr 90px 90px 1fr 90px
  * Grid vista orario: 200px 70px 1fr 90px 90px 1fr 90px
  * Fix: "0 - 1 HT" rimane su una riga

- v3.4.7 (2026-01-02):
  * 🎯 FIX allineamento HT score: .value con flex center + line-height: 1
  * Risolve disallineamento verticale quando LIVE

- v3.4.6 (2026-01-02):
  * 🎯 LIVE badge SOPRA (tentativo 3): margin-top: -8px invece di top: -15px
  * Rimuove position: relative per evitare conflitti
  * Altezza riga uniforme (padding 20px top)

- v3.4.5 (2026-01-02):
  * 🎯 LIVE badge SOPRA (tentativo 2): top: -15px (era -10px)
  * Altezza riga uniforme (padding 20px top)

- v3.4.4 (2026-01-02):
  * 🎯 LIVE badge SOPRA score box: top: -10px (era -20px)
  * 📏 ALTEZZA UNIFORME: padding 20px 14px 10px 14px (era 10px 14px)
  * Tutte le righe hanno la stessa altezza (con o senza badge LIVE)
  * Fix applicato a ENTRAMBE le viste (nazione e orario)

- v3.4.3 (2026-01-02):
  * 🧹 CODICE PULITO: uniformato filtro testuale tra viste
  * applyFilter() semplificata e coerente con applyTableViewFilter()
  * Rimosso codice duplicato e complesso

- v3.4.2 (2026-01-01):
  * 🎯 LIVE badge SOPRA score box: position relative + top -20px
  * 🔍 FILTRO ORARIO: Rimosso DataTable, filtro manuale con applyTableViewFilter
  * Filtro funziona in entrambe le viste

- v3.4.1 (2026-01-01):
  * 🎯 LIVE BADGE CENTRATO: grid-column 3/5 (vista nazione) e 4/6 (vista orario)
  * Ora ESATTAMENTE al centro tra FT e HT in ENTRAMBE le viste
  * justify-self: center per centratura perfetta
  * margin-top: -12px per posizionamento sopra

- v3.4.0 (2026-01-01):
  * 🎯 VISTA ORARIO: griglia 7 colonne
  * Nazione/Camp | Orario | Casa | FT | HT | Trasferta | Stats
  * grid-template-columns: 200px 70px 1fr 90px 90px 1fr 90px
  * Rimossa <table>, ora tutto in div.matches-grid

- v3.3.9 (2026-01-01):
  * 🎯 LAYOUT GRIGLIA 6 COLONNE: Orario | Casa | FT | HT | Trasferta | Stats
  * grid-template-columns: 70px 1fr 90px 90px 1fr 90px
  * FT colonna 3, HT colonna 4 (centrati)
  * Squadra casa (col 2) allineata a destra, trasferta (col 5) a sinistra
  * STATS (col 6) allineato a destra
  * Layout PERFETTO e ALLINEATO!

- v3.3.8 (2026-01-01):
  * 🔧 FIX ALLINEAMENTO: height 52px su .m-boxes e .m-team
  * Tutti gli elementi ora PERFETTAMENTE allineati verticalmente
  * align-self: center su .m-boxes

- v3.3.7 (2026-01-01):
  * 📊 SCORE BOX DUE COLONNE: .m-boxes con grid 90px 90px
  * FT e HT in colonne affiancate (non più in riga)
  * Layout più ordinato e leggibile

- v3.3.6 (2026-01-01):
  * ⚖️ ALLINEAMENTO SCORE BOX: align-self: center su .m-score-box e .m-team
  * 🎯 STATS a destra: justify-self: end
  * Layout verticale perfettamente allineato

- v3.3.5 (2026-01-01):
  * Scorebox FT/HT allineati verticalmente (flex + dimensioni fisse)
  * Colonna STATS fissa a destra nella match-row (grid 70px 1fr 90px)
  * m-boxes allineato e non a capo

- v5.0.2 (2026-01-01):
  * Scorebox FT/HT allineati verticalmente (flex + dimensioni fisse)
  * Colonna STATS fissa a destra nella match-row (grid 70px 1fr 90px)
  * m-boxes allineato e non a capo
- v5.0.1 (2026-01-01):
  * Ripristinato look “scatola viola” (country-box e match-row più colorati)
  * page-wrap a larghezza piena (background radiale senza barre bianche)
- v5.0.0 (2026-01-01):
  * Pulsante STATS: pensato per solo <a.m-stats-btn> (un rettangolo)
  * Logo Betdomus sempre visibile nel banner
  * Badge LIVE più piccolo, centrato tra FT e HT
  * Layout pulito per vista per nazioni e per orario, scorebox affiancati

STRUTTURA:

1. Variabili CSS (theme colors, spacing, etc)
2. Reset & base styles
3. Loading & ingest progress
4. Banner & header
5. Filters & controls
6. Match cards & boxes
7. Score boxes & live indicators
8. Table view (vista oraria)
9. Animations
10. Utility classes
11. Responsive (mobile & tablet)

========================================
*/

/* ================================================
1. VARIABILI CSS - THEME & CONFIGURATION
================================================ */

:root {
  /* Colori principali */
  --bg-primary: #0a1628;
  --bg-secondary: #0f1c2e;
  --bg-gradient-start: #1d2847;
  --bg-gradient-mid: #050816;
  --bg-gradient-end: #020308;

  /* Accenti e highlights */
  --accent-cyan: #00d9ff;
  --accent-purple: #764ba2;
  --accent-blue: #667eea;
  --accent-red: #ff4444;
  --accent-red-soft: rgba(255, 68, 68, 0.12);

  /* Bordi e stroke */
  --stroke: rgba(255, 255, 255, 0.15);
  --stroke-soft: rgba(255, 255, 255, 0.08);
  --stroke-highlight: rgba(255, 255, 255, 0.24);

  /* Testo */
  --text-primary: #f5f7ff;
  --text-secondary: #9ca3c7;
  --text-muted: #6b7199;

  /* Box e card colors */
  --card-bg: rgba(17, 24, 48, 0.96);
  --card-bg-hover: rgba(21, 28, 58, 0.98);
  --country-box-bg: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.15) 0%,
    rgba(118, 75, 162, 0.08) 100%
  );
  --league-box-bg: rgba(5, 8, 22, 0.6);

  /* Ombre */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 22px 55px rgba(0, 0, 0, 0.6);

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-round: 999px;

  /* Controlli dimensioni */
  --logo-scale: 1.4;
  --banner-height-scale: 0.7;
}

/* ================================================
2. RESET & BASE STYLES
================================================ */

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

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(
    circle at top,
    var(--bg-gradient-start) 0%,
    var(--bg-gradient-mid) 45%,
    var(--bg-gradient-end) 100%
  );
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* ================================================
3. LOADING & INGEST PROGRESS
================================================ */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
}

.loading-box {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: white;
  padding: 32px 48px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.loading-spinner {
  animation: spin 2s linear infinite;
  margin: 0 auto 20px;
  display: block;
}

.loading-title {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
}

.loading-text {
  margin: 0;
  opacity: 0.9;
  font-size: 16px;
}

.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
}

.error-box {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  padding: 32px 48px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.error-title {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
}

.error-text {
  margin: 0;
  opacity: 0.9;
  font-size: 16px;
}

.ingest-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.ingest-spinner {
  animation: spin 1s linear infinite;
}

.ingest-text {
  font-size: 15px;
}

.ingest-progress-wrapper {
  margin-top: 8px;
}

.ingest-progress-bar {
  background: rgba(255, 255, 255, 0.2);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.ingest-progress-fill {
  background: white;
  height: 100%;
  transition: width 0.3s ease;
}

.ingest-progress-info {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.hidden-initial {
  display: none;
}

/* ================================================
4. BANNER & HEADER
================================================ */

.banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid var(--stroke);
}

.banner-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 5px 24px;
  min-height: calc(60px * var(--banner-height-scale));
  height: auto;
  gap: 8px;
}

.banner-logo {
  justify-self: start;
  grid-column: 1;
  display: block;
  visibility: visible;
  opacity: 1;
}

.banner-logo img {
  height: 80px;
  width: auto;
  display: block;
}

.banner-title {
  grid-column: 2;
  text-align: center;
  white-space: nowrap;
}

.banner-title-main {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================================
5. FILTERS & CONTROLS
================================================ */

/* larghezza piena: niente barre bianche laterali */
.page-wrap {
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 0;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke);
  padding: 16px;
  box-shadow: var(--shadow-lg);
}

.card-header {
  position: sticky;
  top: calc(60px * var(--banner-height-scale) + 1px);
  z-index: 99;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--stroke-soft);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin: -16px -16px 16px -16px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-select label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sort-select select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%239ca3c7' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.sort-select select:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--stroke-highlight);
}

.sort-select select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.15);
}

.header-filter {
  position: relative;
}

.header-filter input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 16px 8px 36px;
  font-size: 13px;
  width: 280px;
  transition: all 0.2s ease;
}

.header-filter input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.header-filter input:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--stroke-highlight);
}

.header-filter input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.header-filter::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  font-size: 14px;
}

.live-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-round);
  border: 1px solid rgba(255, 68, 68, 0.3);
  background: var(--accent-red-soft);
  color: var(--accent-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-transform: uppercase;
  outline: none;
}

.live-filter-btn:hover {
  background: rgba(255, 68, 68, 0.18);
  border-color: rgba(255, 68, 68, 0.5);
  transform: translateY(-1px);
}

.live-filter-btn.active {
  background: linear-gradient(135deg, #ff4444 0%, #ff6b6b 100%);
  border-color: #ff4444;
  color: white;
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

.live-filter-btn.active:hover {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff4444 100%);
}

.live-filter-dot {
  width: 5px;
  height: 5px;
  background: var(--accent-red);
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.live-filter-btn.active .live-filter-dot {
  background: white;
}

.live-counter {
  display: inline-block;
  margin-left: 6px;
  font-size: 13px;
  opacity: 0.8;
}

/* ================================================
6. MATCH CARDS & BOXES
================================================ */

/* country-box viola */
.country-box {
  background: var(--country-box-bg);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* header paese */
.country-header {
  background: linear-gradient(
    135deg,
    rgba(5, 8, 22, 0.95),
    rgba(17, 24, 48, 0.95)
  );
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--stroke);
}

.country-flag {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.country-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  flex: 1;
}

.country-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.7;
}

.leagues-wrap {
  padding: 12px;
}

.league-box {
  background: var(--league-box-bg);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.league-box:last-child {
  margin-bottom: 0;
}

.league-header {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.matches {
  padding: 10px;
}

/* MATCH ROW: 6 colonne (orario | casa | FT | HT | trasferta | stats) */

.match-row {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr 90px 90px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 20px 14px 10px 14px;
  background: rgba(15, 20, 38, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

.match-row:last-child {
  margin-bottom: 0;
}

.match-row:hover {
  background: var(--card-bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Colonna 1: ORARIO */
.m-time {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
}

/* ================================================
   LAYOUT 6 COLONNE: Orario | Casa | FT | HT | Trasferta | Stats
   ================================================ */

/* Colonna 2: SQUADRA CASA (allineata a destra) */
.m-team.home {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Colonna 5: SQUADRA TRASFERTA (allineata a sinistra) */
.m-team.away {
  grid-column: 5;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.team-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Colonna 6: STATS (allineato a destra) */
.m-stats-btn {
  grid-column: 6;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: rgba(0, 217, 255, 0.15);
  border: 1px solid rgba(0, 217, 255, 0.4);
  border-radius: 8px;
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  visibility: visible;
  opacity: 1;
}

.m-stats-btn:hover {
  background: rgba(0, 217, 255, 0.25);
  border-color: rgba(0, 217, 255, 0.6);
  transform: translateY(-1px);
}

/* ================================================
   7. SCORE BOXES & LIVE INDICATORS
   ================================================ */

.m-score-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 90px;
  width: 90px;
  min-width: 90px;
  max-width: 90px;
  height: 52px;
  padding: 8px 14px;
  box-sizing: border-box;
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.15) 0%,
    rgba(102, 126, 234, 0.1) 100%
  );
  border: 2px solid rgba(0, 217, 255, 0.4);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  align-self: center;
}

/* Colonna 3: FT al centro */
.m-score-box.ft {
  grid-column: 3;
  justify-self: center;
}

/* Colonna 4: HT al centro */
.m-score-box.ht {
  grid-column: 4;
  justify-self: center;
}

.m-score-box .value {
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.m-score-box .label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  line-height: 1;
}

.m-score-box.pending {
  opacity: 0.5;
  border-style: dashed;
}

.m-score-box.live {
  background: linear-gradient(
    135deg,
    rgba(255, 68, 68, 0.2) 0%,
    rgba(255, 107, 107, 0.15) 100%
  );
  border-color: rgba(255, 68, 68, 0.6);
  color: #ff6b6b;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.3);
}

.m-score-box.finished {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2) 0%,
    rgba(96, 165, 250, 0.15) 100%
  );
  border-color: rgba(59, 130, 246, 0.6);
  color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* Badge LIVE piccolo e centrato sul gap FT/HT */

/* Badge LIVE: centrato TRA colonna 3 (FT) e colonna 4 (HT) - SOPRA */
.m-live-status {
  grid-column: 3 / 5;
  justify-self: center;
  align-self: start;
  margin-top: -8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-red);
  background: rgba(0, 0, 0, 0.9);
  padding: 2px 6px;
  border-radius: 999px;
  z-index: 10;
  animation: livePulse 2s ease-in-out infinite;
  pointer-events: none;
  white-space: nowrap;
  border: 1px solid rgba(255, 68, 68, 0.4);
  opacity: 0;  /* 🆕 Nascosto inizialmente per evitare flash minutaggio vecchio */
  transition: opacity 0.3s ease;
}

/* 🆕 v3.4.12: Badge visibile tramite classe (NO più style inline!) */
.m-live-status.is-visible {
  opacity: 1;
}

/* 🆕 v3.4.12: Badge nascosto tramite classe */
.m-live-status.is-hidden {
  display: none;
}

/* Postponed / cancelled */
.m-live-status.postponed {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: 1px solid rgba(245, 87, 108, 0.4);
  animation: none;
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
}

/* Live indicator in alto a destra */

.live-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(
    135deg,
    rgba(5, 8, 22, 0.95),
    rgba(17, 24, 48, 0.95)
  );
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  font-size: 12px;
  font-weight: 700;
  z-index: 1000;
  display: none;  /* 🆕 v3.4.12: Nascosto di default */
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

/* 🆕 v3.4.12: .active ora ha effetto reale! */
.live-indicator.active {
  display: flex;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.live-indicator.updating .live-dot {
  background: #fbbf24;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.live-count {
  font-weight: 800;
  color: #ff6b6b;
}

.next-update {
  font-size: 10px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* nascondi elementi ridondanti nel widget live */
.live-indicator .count,
.live-indicator .live-text,
.live-indicator .live-count,
.live-indicator .live-number,
.live-indicator > span:first-child,
.live-indicator > div:first-child {
  display: none;
}

/* ================================================
8. TABLE VIEW (VISTA ORARIA)
================================================ */

#tableView {
  display: none;
}

#matches {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#matches thead th {
  border-bottom: 1px solid var(--stroke-highlight);
  padding: 8px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  background: rgba(5, 8, 22, 0.96);
  text-align: left;
}

#matches thead th:last-child {
  text-align: center;
}

#matches tbody tr {
  background: var(--card-bg);
  border-bottom: 1px solid var(--stroke-soft);
  transition: background 0.2s ease;
}

#matches tbody tr:hover {
  background: var(--card-bg-hover);
}

#matches tbody tr td {
  padding: 10px 8px;
  vertical-align: middle;
}

/* Vista Orario: griglia 7 colonne */
.table-match-wrapper {
  display: grid;
  grid-template-columns: 200px 70px 1fr 90px 90px 1fr 90px;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 20px 14px 10px 14px;
  background: rgba(15, 20, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}

/* Colonna 1: Nazione/Campionato */
.table-country-league {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.table-country {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.country-logo {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.table-league {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ================================================
9. ANIMATIONS
================================================ */

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

@keyframes livePulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
}

@keyframes scoreUpdate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 20px rgba(255, 215, 68, 0.6);
  }
  100% {
    transform: scale(1);
  }
}

.score-updated {
  animation: scoreUpdate 0.6s ease;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ================================================
10. UTILITY CLASSES
================================================ */

.filtered-hidden,
.match-row.filtered-hidden,
.league-box.filtered-hidden,
.country-box.filtered-hidden,
div.filtered-hidden,
div.match-row.filtered-hidden {
  display: none;
  visibility: hidden;
  opacity: 0;
  height: 0;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  position: absolute;
  left: -9999px;
}

.country-box:empty,
.league-box:empty,
.matches:empty,
.card:empty,
.page-wrap:empty,
div[class*="box"]:empty,
div[class*="wrap"]:empty {
  display: none;
  height: 0;
  margin: 0;
  padding: 0;
}

/* Evita duplicati di banner / header */
.banner ~ .banner,
.card-header ~ .card-header {
  display: none;
}

/* Version badge */
.version-badge {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  z-index: 999;
  font-family: monospace;
}

/* Immagini */

.fixture-card img {
  max-width: 100%;
  height: auto;
}

.fixture-card img[src*="flags"] {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}

.fixture-card img[src*="teams"] {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.league-info img,
.home-team img,
.away-team img {
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
}

/* Loghi generici */

.match-row img:not(.country-flag),
.match-teams img,
.team-logo img,
.m-team img,
img[src*="logo"]:not([src*="flag"]) {
  max-width: 40px;
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.country-header img,
img[src*="flag"],
img[src*="flags"] {
  max-width: 32px;
  max-height: 24px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Logo Betdomus header full */

.banner-logo img {
  max-width: none;
  max-height: 60px;
}

/* ================================================
11. RESPONSIVE - MOBILE (<768px)
================================================ */

@media (max-width: 768px) {
  .banner-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 12px;
    min-height: calc(50px * var(--banner-height-scale));
    gap: 3px;
  }

  .banner-logo {
    justify-self: center;
    grid-column: 1;
    grid-row: 1;
  }

  .banner-logo img {
    height: calc(80px * var(--logo-scale));
  }

  .banner-title {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
  }

  .banner-title-main {
    font-size: 14px;
    text-align: center;
  }

  .card-header {
    flex-direction: column;
    gap: 12px;
    top: calc(50px * var(--banner-height-scale) + 65px);
  }

  .header-left,
  .header-right {
    width: 100%;
    justify-content: center;
    display: contents;
  }

  .sort-select {
    flex-direction: column;
    width: 100%;
    order: 1;
  }

  .sort-select select {
    width: 100%;
    font-size: 11px;
  }

  .header-filter {
    order: 2;
    width: 100%;
  }

  .header-filter input {
    width: 100%;
    font-size: 11px;
    text-align: left;
    letter-spacing: 0;
  }

  .live-filter-btn {
    width: 100%;
    justify-content: center;
    margin-left: 0;
    margin-top: 8px;
    order: 3;
  }

  .page-wrap {
    padding: 8px;
  }

  .card {
    padding: 6px;
  }

  .leagues-wrap {
    padding: 6px;
  }

  .matches {
    padding: 4px;
  }

  .match-row {
    display: grid;
    grid-template-columns: 48px 58px 1fr 58px 58px;
    grid-template-rows: auto auto;
    gap: 4px 6px;
    padding: 12px;
  }

  .m-time {
    grid-column: 1;
    grid-row: 1 / 3;
    font-size: 12px;
  }

  .m-main {
    grid-column: 2 / 6;
    grid-row: 1;
  }

  .m-teams {
    font-size: 13px;
    justify-content: center;
    width: 100%;
    white-space: normal;
    line-height: 1.3;
  }

  .m-team {
    order: 2;
  }

  .m-stats-wrapper {
    grid-column: 2 / 6;
    grid-row: 2;
    justify-content: center;
    margin-top: 4px;
  }

  .m-stats-btn {
    width: 100%;
  }

  .m-score-box.ft {
    order: 4;
    width: 58px;
    font-size: 11px;
  }

  .m-score-box.ht {
    order: 5;
    width: 58px;
    font-size: 11px;
  }

  /* badge LIVE sotto l’orario su mobile */
  .m-live-status {
    position: static;
    transform: none;
    grid-column: 1;
    grid-row: 2;
    font-size: 9px;
    padding: 3px 8px;
    margin-top: 3px;
    min-width: 48px;
    border-radius: 4px;
    display: block;
    text-align: center;
  }

  #tableView {
    width: 100%;
    display: block;
  }

  #matches {
    font-size: 11px;
    width: 100%;
    display: block;
    table-layout: auto;
  }

  #matches thead {
    display: none;
  }

  #matches tbody {
    width: 100%;
    display: block;
  }

  #matches tbody tr {
    display: block;
    margin-bottom: 12px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke-soft);
    padding: 10px;
    width: 100%;
    max-width: none;
  }

  #matches tbody tr td,
  #matches tbody tr td[style*="width"] {
    display: block;
    padding: 6px 0;
    border: none;
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
  }

  .table-match-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    gap: 6px;
    box-sizing: border-box;
  }

  .table-match-wrapper .m-time {
    width: 100%;
    max-width: none;
    text-align: left;
    padding: 0;
    box-sizing: border-box;
  }

  .table-match-wrapper .m-main {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  .table-country {
    font-size: 11px;
  }

  .table-league {
    font-size: 10px;
  }
}

/* ================================================
12. RESPONSIVE - TABLET (768px - 980px)
================================================ */

@media (max-width: 980px) and (min-width: 769px) {
  .banner-inner {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
  }

  .banner-title {
    text-align: left;
    margin-left: 0;
  }
}

@media (max-width: 780px) and (min-width: 769px) {
  .match-row,
  .table-match-wrapper {
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 6px;
  }

  .m-team {
    font-size: 14px;
  }

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

  .m-score-box {
    width: 50px;
    font-size: 12px;
  }
}

/* Vista Orario: posizionamento elementi in 7 colonne */
.table-match-wrapper .m-time {
  grid-column: 2;
}

.table-match-wrapper .m-team.home {
  grid-column: 3;
}

.table-match-wrapper .m-score-box.ft {
  grid-column: 4;
}

.table-match-wrapper .m-score-box.ht {
  grid-column: 5;
}

.table-match-wrapper .m-team.away {
  grid-column: 6;
}

.table-match-wrapper .m-stats-btn {
  grid-column: 7;
}

/* Contenitore vista orario */
.matches-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Badge LIVE nella vista orario: tra colonne 4 e 5 */
.table-match-wrapper .m-live-status {
  grid-column: 4 / 6;  /* span da colonna 4 (FT) a colonna 6 (include FT, gap, HT) */
}

/* ================================================
   LOADING PLACEHOLDER (per daily_ingest)
   ================================================ */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
}

.loading-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 32px 48px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.loading-spinner {
  animation: spin 2s linear infinite;
  margin: 0 auto 20px;
  display: block;
}

.loading-title {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
}

.loading-text {
  margin: 0;
  opacity: 0.9;
  font-size: 16px;
}

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

/* ============================================================================
   SCOREBOXES DINAMICI - v4.0.15
   ============================================================================ */

/* Stato: Match in corso (1H, 2H, ET) */
.m-score-box.is-active {
  background: linear-gradient(
    135deg,
    rgba(255, 68, 68, 0.2) 0%,
    rgba(255, 107, 107, 0.15) 100%
  ) !important;
  border: 2px solid rgba(255, 68, 68, 0.6) !important;
  color: #ff6b6b !important;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.3) !important;
}

/* Stato: Periodo non iniziato (mostra clessidra) */
.m-score-box.is-not-started {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.15) 0%,
    rgba(102, 126, 234, 0.1) 100%
  ) !important;
  border: 2px solid rgba(0, 217, 255, 0.4) !important;
  opacity: 0.6;
}

/* Clessidra per periodi non iniziati */
.m-score-box.is-not-started .value {
  font-size: 24px !important;
}

.m-score-box.is-not-started .value::before {
  content: '⏳';
  display: block;
}

/* Nascondi score quando non iniziato */
.m-score-box.is-not-started .value {
  color: transparent !important;
}

/* Stato: Periodo completato */
.m-score-box.is-completed {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.15) 0%,
    rgba(102, 126, 234, 0.1) 100%
  ) !important;
  border: 2px solid rgba(0, 217, 255, 0.4) !important;
  color: var(--accent-cyan) !important;
}

/* Badge LIVE: Animazione pulse */
.m-live-status.live-pulse {
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}
