:root {
  --indicator-size: 14px;
  --indicator-gap: 8px;
}

/* Contenitore principale */
#calendar-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden; /* IMPORTANTE: previene overflow */
}

/* Ruota */
.wheel-viewport {
  overflow: hidden;
  border-radius: 12px;
  background: white;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  width: 100%;
  position: relative;
}

#wheel {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
  touch-action: pan-y;
  align-items: stretch;
  width: 100%;
  will-change: transform; /* Ottimizzazione performance */
}

.wheel-item {
  min-width: 100%;
  flex-shrink: 0; /* IMPORTANTE: previene shrink */
  box-sizing: border-box;
  padding: 18px 22px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Card */
.wheel-card {
  width: 100%;
  max-width: 100%;
  background: linear-gradient(180deg, #fff, #fbfcfd);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  border: 1px solid #eaecef;
  box-sizing: border-box;
  min-height: 120px; /* Altezza minima per evitare collasso */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wheel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 10px;
}

.wheel-header h5 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.2px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: center; /* Centra il titolo tra i pulsanti */
}

.nav-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.nav-controls button {
  appearance: none;
  border: 1px solid #222;
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px; /* Padding uniforme */
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.1s, background-color 0.2s;
  font-size: 14px;
  line-height: 1;
  width: 32px; /* Larghezza fissa per renderli uguali */
  height: 32px; /* Altezza fissa */
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-controls button:hover {
  background: #f8f9fa;
}

.nav-controls button:active {
  transform: translateY(1px);
}

.nav-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Righe squadra + punteggio inline */
.match-line {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 6px 0;
  font-size: 0.95rem;
}

.team-home,
.team-away {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  max-width: 40%;
  text-align: center;
}

.score {
  font-weight: 600;
  margin: 0 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Se non c'è risultato, score mostra 'vs' con stile più leggero */
.score.upcoming {
  font-weight: 500;
  color: #666;
}

/* Indicatori */
#wheel-indicators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--indicator-gap);
  padding: 16px 6px 16px; /* Aumentato padding verticale per lo scale */
  margin-top: 10px;
  flex-wrap: wrap;
}

.wheel-indicator {
  width: var(--indicator-size);
  height: var(--indicator-size);
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  flex-shrink: 0;
}

.wheel-indicator:hover {
  transform: scale(1.08);
}

.wheel-indicator.active {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  transform: scale(1.18);
}

/* Stati giocati: win/draw/loss */
.wheel-indicator.win {
  background: #2ecc71;
  border-color: #2ecc71;
}

.wheel-indicator.draw {
  background: #f1c40f;
  border-color: #f1c40f;
}

.wheel-indicator.loss {
  background: #e74c3c;
  border-color: #e74c3c;
}

/* Prossimi: bianco con bordo nero più visibile */
.wheel-indicator.upcoming {
  background: #ffffff;
  border-color: #111111;
}

/* Responsività: riduci padding su mobile */
@media (max-width: 768px) {
  #calendar-wrapper {
    width: 100%;
    overflow: hidden;
  }

  .wheel-viewport {
    width: 100%;
    overflow: hidden;
  }

  .wheel-item {
    padding: 12px 8px;
    width: 100%;
  }

  .wheel-card {
    padding: 14px 12px;
    width: 100%;
    max-width: 100%;
  }

  .wheel-header {
    margin-bottom: 12px;
    flex-wrap: nowrap;
  }

  .wheel-header h5 {
    font-size: 0.85rem;
    text-align: center;
  }

  .match-line {
    font-size: 0.85rem;
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
  }

  .team-home,
  .team-away {
    max-width: 38%;
    font-size: 0.8rem;
  }

  .score {
    font-size: 0.85rem;
    flex-shrink: 0;
  }

  .nav-controls button {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .nav-controls button svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  #calendar-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .wheel-viewport {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
  }

  .wheel-item {
    padding: 8px 4px;
    width: 100%;
    min-width: 100%;
  }

  .wheel-card {
    padding: 12px 10px;
    width: 100%;
    max-width: 100%;
    min-height: 100px;
  }

  .wheel-header {
    margin-bottom: 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .wheel-header h5 {
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: center;
  }

  .wheel-header h5 small {
    display: block;
    margin-top: 2px;
    font-size: 0.7rem;
  }

  .match-line {
    font-size: 0.8rem;
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
  }

  .team-home,
  .team-away {
    max-width: 35%;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .score {
    font-size: 0.8rem;
    margin: 0 2px;
    flex-shrink: 0;
  }

  .nav-controls {
    gap: 4px;
  }

  .nav-controls button {
    width: 36px;
    height: 36px;
    padding: 6px;
    flex-shrink: 0;
  }

  .nav-controls button svg {
    width: 16px;
    height: 16px;
  }

  :root {
    --indicator-size: 10px;
    --indicator-gap: 4px;
  }

  #wheel-indicators {
    padding: 10px 4px 10px;
    gap: 4px;
  }
}
