/* Stili generali del corpo della pagina */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

/* Navbar orizzontale in alto */
.navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    width: 100%;
    height: 90px;
    display: flex;
    justify-content: center; /* Centrato per icone vicine */
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-x: auto;
    white-space: nowrap;
}

/* Stili per i link della navbar */
.navbar a {
    color: #333333;
    margin: 0 0.75rem; /* Ridotto il margine per avvicinare le icone */
    font-size: 1.5rem;
    text-decoration: none;
    position: relative;
}

/* Effetto hover sui link */
.navbar a:hover {
    color: #28a745;
}

/* Icona corrente in verde */
.navbar a.active {
    color: #28a745;
}

/* Contenitore principale centrato */
.container {
    width: 90%; /* Occupa il 90% della larghezza */
    margin: 80px 5% 4rem; /* 5% di margine a sinistra e destra */
    padding: 2rem 1rem;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

/* Titolo principale */
.container h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 1.5rem;
    line-height: 1.4;
    padding: 1rem 0;
}

/* Sottotitolo */
.container h2 {
    font-size: 1.25rem;
    font-weight: 500;
    color: #555555;
    margin-bottom: 1.5rem;
}

/* Sezione di upload */
.upload-section {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

/* Nasconde l'input file nativo */
.file-input {
    display: none;
}

/* Area di drag-and-drop per i file */
.file-drop-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    height: 120px;
    background-color: #f1f1f1;
    border: 2px dashed #cccccc;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #555555;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

/* Effetto hover e stato attivo per l'area di drag-and-drop */
.file-drop-area:hover,
.file-drop-area.drag-active {
    background-color: #e6e6e6;
    border-color: #28a745;
}

/* Testo all'interno dell'area di drag-and-drop */
.file-drop-area span {
    padding: 0.5rem;
    font-weight: 500;
}

/* Testo di errore */
.error-text {
    color: #dc3545;
    font-size: 0.9rem;
    text-align: center;
}

/* Nome del file caricato */
.file-name {
    font-size: 0.9rem;
    color: #555555;
    text-align: center;
}

/* Sezione card */
.section-card {
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Sottotitolo nella card */
.section-card h2 {
    font-size: 1.25rem;
    font-weight: 500;
    color: #333333;
    margin-bottom: 1rem;
}

/* Sezione dei filtri */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

/* Contenitore per il dropdown */
.dropdown {
    position: relative;
    width: 100%;
    max-width: 400px;
}

/* Pulsante del dropdown */
.dropdown-button {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
    font-size: 0.9rem;
    color: #333333;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* Effetto hover e stato attivo per il pulsante del dropdown */
.dropdown-button:hover,
.dropdown-button.active {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Menu del dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    padding: 0.5rem;
    display: none;
}

/* Menu del dropdown attivo */
.dropdown-menu.active {
    display: block;
}

/* Gruppo di checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

/* Etichetta per i checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #333333;
    cursor: pointer;
}

/* Checkbox */
.filter-checkbox {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #28a745;
    cursor: pointer;
}

/* Testo delle etichette dei checkbox */
.checkbox-label span {
    font-weight: 500;
}

/* Input di ricerca */
.search-input {
    padding: 0.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    flex-grow: 1;
    max-width: 400px;
}

/* Stile focus per l'input di ricerca */
.search-input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Select per i filtri */
.filter-select {
    padding: 0.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    max-width: 400px;
    width: 100%;
}

/* Stile focus per il select */
.filter-select:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Gruppi di opzioni nel select */
.filter-select optgroup {
    font-weight: 600;
    color: #333333;
}

/* Opzioni nel select */
.filter-select option {
    padding-left: 1.5rem;
}

/* Contenitore per la tabella */
.table-container {
    overflow-x: auto;
    width: 100%;
}

/* Tabella dati */
.data-table {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
}

/* Intestazioni e celle della tabella */
.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #e5e5e5;
}

/* Intestazione della tabella */
.data-table thead tr {
    background-color: #f8f9fa;
}

/* Contenitore del grafico */
.chart-container {
    max-width: 95%;
    width: 100%;
    margin: 0 auto 1.5rem;
    height: 500px;
}

/* Canvas del grafico */
.chart-container canvas {
    max-width: 100% !important;
    height: 100% !important;
}

/* Grafico a linee */
#line-chart {
    height: 500px !important;
    max-height: 500px !important;
}

/* Testo di riepilogo */
.summary-text {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #555555;
}

/* Div nel testo di riepilogo */
.summary-text div {
    padding: 0.5rem;
    border-radius: 0.25rem;
}

/* Classe per nascondere elementi */
.hidden {
    display: none;
}

/* Footer */
footer {
    background-color: #ffffff;
    color: #555555;
    text-align: center;
    padding: 1.5rem 1rem;
    border-top: 1px solid #e5e5e5;
    width: 100%;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
}

/* Testo del footer */
footer p {
    margin: 0;
    font-size: 0.875rem;
}

/* Stili per dispositivi mobili */
@media (max-width: 414px) {
    .navbar {
        height: 50px;
        justify-content: space-between;
        padding: 0 0.5rem;
    }

    .navbar a {
        margin: 0 0.5rem; /* Ulteriore riduzione per mobile */
        font-size: 1.2rem;
    }

    .navbar a::after {
        display: none;
    }

    .container {
        margin-top: 70px;
        margin-left: 5%;
        margin-right: 5%;
        padding: 1.5rem 1rem;
        margin-bottom: 4rem;
    }

    body {
        font-size: 0.9rem;
    }

    .container h1 {
        font-size: 2rem;
        line-height: 1.3;
        padding: 0.75rem 0;
        margin-bottom: 1rem;
    }

    .section-card {
        padding: 1rem;
    }

    .section-card h2 {
        font-size: 1.1rem;
    }

    .upload-section {
        gap: 0.5rem;
    }

    .file-drop-area {
        max-width: 100%;
        height: 100px;
        font-size: 0.8rem;
    }

    .file-drop-area span {
        padding: 0.4rem;
    }

    .error-text {
        font-size: 0.8rem;
    }

    .file-name {
        font-size: 0.8rem;
    }

    .dropdown {
        max-width: 100%;
    }

    .dropdown-button {
        font-size: 0.8rem;
    }

    .dropdown-menu {
        max-width: 100%;
        font-size: 0.8rem;
    }

    .checkbox-group {
        font-size: 0.8rem;
    }

    .checkbox-label {
        font-size: 0.8rem;
        gap: 0.4rem;
    }

    .filter-checkbox {
        width: 1rem;
        height: 1rem;
    }

    .search-input {
        font-size: 0.8rem;
        max-width: 100%;
    }

    .filter-select {
        font-size: 0.8rem;
        max-width: 100%;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    .chart-container {
        max-width: 95%;
        width: 100%;
        height: 300px;
    }

    .chart-container canvas {
        max-width: 100% !important;
        height: 100% !important;
    }

    #line-chart {
        height: 300px !important;
        max-height: 300px !important;
    }

    .summary-text {
        font-size: 0.8rem;
    }

    footer {
        padding: 1.5rem 0.5rem;
    }

    footer p {
        font-size: 0.8rem;
    }
}