/* === VARIABILI TEMA === */
:root {
  --bg-main: #fafafa;
  --bg-secondary: #fff;
  --text-main: #181818;
  --text-secondary: #333;
  --card-bg: #f5f5f5;
  --border-main: #e0e0e0;
  --operator-color-light: #e0e0e0;
  --operator-color: #232323;
}
body.dark-mode {
  --bg-main: #212121;
  --bg-secondary: #232323;
  --text-main: #e0e0e0;
  --text-secondary: #bdbdbd;
  --card-bg: #181818;
  --border-main: #292929;
  --operator-color-light: #232323;
  --operator-color: #e0e0e0;
}

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Applica le variabili ai principali elementi */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.container {
    background: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-main);
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 0;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-main);
    text-shadow: 0 2px 8px #111;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header.dark-header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-main);
    background: none;
    padding-bottom: 0;
}

.logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}
.logo-img {
    background: var(--bg-main);
    border-radius: 50%;
    width: 90px;
    height: 90px;
    object-fit: contain;
    box-shadow: 0 2px 16px rgba(0,0,0,0.7);
    border: 2px solid var(--border-main);
}

/* Filtri */
.filters {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 32px;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-main);
    transition: background 0.3s, box-shadow 0.3s, border 0.3s;
}

.filter-group {
    margin-bottom: 0;
}

.filter-group.operator-group {
    flex: 0 0 30%;
    min-width: 120px;
}

.filter-group.time-group {
    flex: 0 0 50%;
    min-width: 200px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    padding: 12px;
    border: 1.5px solid var(--border-main);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-main);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px var(--border-main);
}

.btn-primary {
    flex: 0 0 20%;
    min-width: 120px;
    margin-bottom: 0;
    height: 44px;
    font-size: 1rem;
    background: var(--text-main);
    color: var(--bg-main);
    border: 1.5px solid var(--border-main);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--text-secondary);
    color: var(--bg-main);
}

.btn-primary:active {
    transform: translateY(0);
}

.time-inputs {
    display: flex;
    gap: 8px;
}

/* Statistiche */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.13);
    text-align: center;
    transition: background 0.3s, color 0.3s, box-shadow 0.3s;
    color: var(--text-main);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card p {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-main);
}

/* Grafici */
.chart-container {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    position: relative;
    min-height: 400px;
    transition: background 0.3s, box-shadow 0.3s;
}

.chart-container canvas {
    max-height: 500px;
}

/* Sezione confronto */
.comparison-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    border: 1px solid var(--border-main);
}

.comparison-section h2 {
    color: var(--text-main);
    margin-bottom: 20px;
    text-align: center;
}

.operator-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-main);
    border: 1px solid var(--border-main);
}

.checkbox-item:hover {
    background: var(--card-bg);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--text-main);
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--text-main);
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 900px) {
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .filter-group.operator-group,
    .filter-group.time-group,
    .btn-primary {
        flex: 1 1 100%;
        min-width: 0;
        width: 100%;
    }
    .btn-primary {
        margin-top: 8px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card p {
        font-size: 1.5rem;
    }
    
    .chart-container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }
    
    .operator-checkboxes {
        flex-direction: column;
        align-items: center;
    }
    
    /* Responsive per filtri orari su schermi molto piccoli */
    .time-filters-container {
        flex-direction: column;
        gap: 8px;
        padding: 16px;
        min-width: auto;
    }
    
    .time-input {
        width: 140px;
    }
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

#charts-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 32px;
}

.chart-box {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px 16px 32px 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
  margin-bottom: 0;
  border: 1px solid var(--border-main);
  transition: background 0.3s, box-shadow 0.3s, border 0.3s, padding 0.3s;
}

.chart-box h3 {
  margin-bottom: 12px;
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.chart-legend {
  margin-top: 12px;
  font-size: 1rem;
  color: #bdbdbd;
}

.chart-error {
  color: #ff4d4f;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 10px;
  text-align: center;
  font-weight: bold;
  border: 1px solid var(--border-main);
}

canvas {
  width: 100% !important;
  max-width: 100%;
  height: 320px !important;
  max-height: 320px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 0;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  border: 1px solid var(--border-main);
  transition: background 0.3s, box-shadow 0.3s, border 0.3s;
}

@media (max-width: 700px), (max-height: 600px) {
  .chart-box {
    background: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  canvas {
    height: 200px !important;
    max-height: 200px;
    background: #232323;
    border-radius: 8px;
    box-shadow: none;
    border: none;
  }
  #charts-section {
    gap: 40px;
  }
  #charts-section > div {
    margin-bottom: 32px;
  }
}

.operator-toggle-group {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  justify-content: space-between;
  align-items: center;
}

.operators-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.time-filters-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-main);
  min-width: 280px;
  transition: background 0.3s, border 0.3s;
}

.time-input {
  background: var(--card-bg);
  border: 1px solid var(--border-main);
  border-radius: 6px;
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 0.9rem;
  width: 110px;
  text-align: center;
  font-weight: 500;
  transition: background 0.3s, color 0.3s, border 0.3s;
}

.time-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.time-separator {
  color: #bdbdbd;
  font-weight: 600;
  font-size: 1rem;
}

.reset-time-btn {
  background: #333;
  color: #bdbdbd;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 500;
}

.reset-time-btn:hover {
  background: #444;
  color: #e0e0e0;
  border-color: #555;
}

.operator-toggle-btn {
  border: none;
  outline: none;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--operator-color-light, #232323);
  color: var(--operator-color, #e0e0e0);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  border: 2px solid var(--operator-color, #292929);
}
.operator-toggle-btn.active {
  background: var(--operator-color, #fff);
  color: #fff;
  box-shadow: 0 2px 8px var(--operator-color-dark, rgba(255,255,255,0.10));
  border-color: var(--operator-color, #fff);
}
.operator-toggle-btn:focus {
  outline: 2px solid #fff;
}

/* Day Selector Styles */
.day-selector {
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--border-main);
    transition: background 0.3s, box-shadow 0.3s, border 0.3s;
}

.day-selector-header {
    background: var(--bg-secondary);
    padding: 20px;
    border-bottom: 1px solid var(--border-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-selector-header h3 {
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.day-selector-controls {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    padding: 8px 16px;
    background: #333;
    color: #bdbdbd;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-secondary:hover {
    background: #444;
    color: #e0e0e0;
    border-color: #555;
}

.btn-secondary.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.day-selector-content {
    padding: 20px;
}

.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.day-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-main);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-main);
}

.day-option:hover {
    background: var(--card-bg);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

.day-option.selected {
    background: #2563eb;
    border-color: #3b82f6;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.13);
    color: #fff;
    font-weight: 700;
}
.day-option.selected .day-name,
.day-option.selected .day-id {
    color: #fff;
}
body.dark-mode .day-option.selected {
    background: #1e40af;
    color: #fff;
}
body.dark-mode .day-option.selected .day-name,
body.dark-mode .day-option.selected .day-id {
    color: #fff;
}

.day-checkbox {
    position: relative;
    flex-shrink: 0;
}

.day-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.day-checkbox label {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.day-info {
    flex: 1;
    min-width: 0;
}

.day-name {
    color: var(--text-main);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    line-height: 1.3;
}

.day-id {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}

.day-selector-footer {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-top: 1px solid var(--border-main);
    text-align: center;
    color: var(--text-secondary);
}

/* Barra centrale sotto il day-selector */
#day-selector-container + div {
    color: var(--text-secondary) !important;
    border-radius: 0 0 15px 15px;
    border-top: 1px solid var(--border-main);
    padding: 18px 0;
    font-weight: 500;
    font-size: 1.1rem;
    text-align: center;
    transition: background 0.3s, color 0.3s;
}

.selected-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.no-days {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 40px;
}

/* Responsive per day selector */
@media (max-width: 768px) {
    .day-selector-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .day-selector-controls {
        justify-content: center;
    }
    
    .day-grid {
        grid-template-columns: 1fr;
    }
    
    .day-option {
        padding: 12px;
    }
    
    .day-name {
        font-size: 0.95rem;
    }
    
    .day-id {
        font-size: 0.8rem;
    }
    
    /* Responsive per filtri orari */
    .operator-toggle-group {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .time-filters-container {
        justify-content: center;
        padding: 12px;
        min-width: auto;
        width: 100%;
    }
    
    .time-input {
        width: 120px;
    }
} 

#theme-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
}
#icon-sun {
  transition: opacity 0.3s;
}
#icon-moon {
  transition: opacity 0.3s;
}
body.dark-mode #icon-sun {
  opacity: 0.4;
}
body.dark-mode #icon-moon {
  opacity: 1;
}
body:not(.dark-mode) #icon-sun {
  opacity: 1;
}
body:not(.dark-mode) #icon-moon {
  opacity: 0.4;
} 

/* Stile per i nomi operatori in legenda SOLO in light mode */
body:not(.dark-mode) .operator-legend-label {
  color: #181818;
  font-weight: 700;
  text-shadow: 0 1px 4px #fff, 0 0px 1px #e0e0e0;
  letter-spacing: 0.5px;
  font-size: 1.05em;
} 

/* Rimuovi shadow da titolo e icona SOLO in light mode */
body:not(.dark-mode) .header h1 {
  text-shadow: none;
}
body:not(.dark-mode) .logo-img {
  box-shadow: none;
} 