.stats-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.stats-button:hover {
    background-color: #45a049;
}

.date-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.date-input {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-input input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.date-filters button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.date-filters button:hover {
    background-color: #45a049;
}

/* Stile specifico per la modale delle statistiche */
.stats-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
}

.stats-modal-content {
    background-color: #fefefe;
    margin: 10px auto;
    padding: 30px;
    border: 1px solid #888;
    width: 95%;  /* Aumentato da 90% a 95% */
    max-width: 1800px;  /* Aumentato da 1200px a 1800px */
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 90vh;  /* Aggiunto per garantire un'altezza minima */
}

/* Stile per il canvas del grafico */
#statsChart {
    width: 100% !important;
    margin-top: 20px;
}

/* Aggiustamenti per il pulsante di chiusura */
.stats-modal .close {
    position: absolute;
    right: 25px;
    top: 20px;
    font-size: 32px;  /* Aumentato da 28px a 32px */
    z-index: 1;
}

/* Aggiustamenti per i controlli */
.stats-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;  /* Centrato i controlli */
}

.stats-controls input[type="date"] {
    padding: 10px;  /* Aumentato da 8px a 10px */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-width: 200px;  /* Aggiunto per dare più spazio */
}

.stats-controls button {
    padding: 10px 20px;  /* Aumentato il padding */
    font-size: 16px;
    min-width: 120px;  /* Aggiunto per uniformità */
}

/* Media query per dispositivi mobili */
@media screen and (max-width: 768px) {
    .stats-modal {
        padding: 10px;
    }

    .stats-modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 20px;
    }

    .stats-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-controls input[type="date"],
    .stats-controls button {
        width: 100%;
    }
}

/* Stili per i tab */
.stats-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

/* OpenAI Stats Styles */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h4 {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.stat-card div {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 0.5rem;
    color: #333;
}

.stats-chart-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-tables {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
}

.stats-table-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-table-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.table-responsive {
    overflow-x: auto;
}

.stats-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.stats-controls input[type="date"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.stats-controls button {
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.stats-controls button:hover {
    background-color: #0056b3;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-controls {
        flex-direction: column;
    }
    
    .stats-controls input[type="date"],
    .stats-controls button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }
}