:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --body-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --sidebar-width: 250px;
    --sidebar-bg: #343a40;
    --sidebar-color: #f8f9fa;
    --sidebar-hover-bg: #495057;
    --sidebar-active-bg: #0d6efd;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--primary-color);
}

/* Menu laterale */
.sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    z-index: 1050;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
}

    .sidebar.active {
        left: 0;
    }

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-link {
    display: block;
    padding: 15px 20px;
    color: var(--sidebar-color);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

    .sidebar-link:hover {
        background-color: var(--sidebar-hover-bg);
        color: var(--sidebar-color);
    }

    .sidebar-link.active {
        background-color: var(--sidebar-active-bg);
    }

.sidebar-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Header fisso */
header {
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
}

/* Contenuto principale */
.content-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    padding-top: 0; /* Spazio per l'header fisso */
}

    /* Overlay scuro quando la sidebar è attiva */
    .content-wrapper::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0);
        z-index: 1040;
        visibility: hidden;
        transition: background-color 0.3s ease, visibility 0.3s ease;
        pointer-events: none;
        cursor: pointer;
    }

    .content-wrapper.sidebar-active::before {
        background-color: rgba(0, 0, 0, 0.5);
        visibility: visible;
        pointer-events: auto;
    }

/* Stile per il pulsante di toggle della sidebar */
.sidebar-toggler {
    font-size: 1.5rem;
    padding: 0.25rem 0.75rem;
    border: none;
    background-color: transparent;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

    .sidebar-toggler:hover {
        transform: scale(1.1);
    }

    .sidebar-toggler:focus {
        box-shadow: none;
        outline: none;
    }

@media (min-width: 992px) {
    .sidebar-toggler {
        display: block !important;
    }
}

/* Stile per il pulsante di chiusura della sidebar */
.sidebar-close {
    font-size: 1.5rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin-left: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    z-index:10001;
    border:none;
    border-radius:0;
}

    .sidebar-close:hover {
        background-color: var(--sidebar-hover-bg);
    }

    .sidebar-close:focus {
        box-shadow: none;
        outline: none;
    }

.footer {
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
    margin-top: auto;
    position: relative;
}

/* Stili per le card */
.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    margin-bottom: 20px;
}

/* Stili per i titoli delle card */
.card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stili per il tema scuro */
body.dark-mode {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #343a40;
    --dark-color: #f8f9fa;
    --body-bg: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #343a40;
    --sidebar-bg: #1a1a1a;
    --sidebar-hover-bg: #2a2a2a;
    background-color: var(--body-bg);
    color: var(--text-color);
}

    body.dark-mode .card {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }

    body.dark-mode .bg-light {
        background-color: var(--light-color) !important;
    }

    body.dark-mode .text-dark {
        color: var(--text-color) !important;
    }

    body.dark-mode .text-muted {
        color: #a0a0a0 !important;
    }

    body.dark-mode .border-top {
        border-top-color: var(--border-color) !important;
    }

    body.dark-mode .form-control,
    body.dark-mode .form-select {
        background-color: #2a2a2a;
        border-color: #444;
        color: var(--text-color);
    }

        body.dark-mode .form-control:focus,
        body.dark-mode .form-select:focus {
            background-color: #2a2a2a;
            color: var(--text-color);
        }

    body.dark-mode .list-group-item {
        background-color: var(--card-bg);
        border-color: var(--border-color);
        color: var(--text-color);
    }

    body.dark-mode .dropdown-menu {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }

    body.dark-mode .dropdown-item {
        color: var(--text-color);
    }

        body.dark-mode .dropdown-item:hover {
            background-color: #2a2a2a;
        }

    body.dark-mode .dropdown-divider {
        border-top-color: var(--border-color);
    }

/* Stili per i grafici */
.chart-container {
    position: relative;
    margin: auto;
    height: 100%;
    min-height: 300px;
}

/* Stili per le icone nei titoli delle card */
.card-title i {
    vertical-align: middle;
}

/* Stili per i badge nei card */
.badge {
    font-weight: 500;
}

/* Stili per i form */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--primary-color);
}

/* Stili per il toggle del tema scuro */
.form-switch .form-check-input {
    cursor: pointer;
}

/* Stili per il menu mobile */
@media (max-width: 991.98px) {
    .navbar-toggler {
        padding: 0.5rem 0.75rem;
        font-size: 1.25rem;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }

    .dropdown-menu {
        padding: 0.5rem 0;
    }

    .dropdown-item {
        padding: 0.5rem 1.5rem;
        font-size: 1.1rem;
    }
}

/* Stili per le tabelle */
.table {
    color: var(--text-color);
}

body.dark-mode .table {
    color: var(--text-color);
}

body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Formattazione numeri e date */
.format-number {
    font-family: 'Roboto Mono', monospace;
}

.format-date {
    font-family: 'Roboto Mono', monospace;
}

/* Stili per i toast */
.toast {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .toast {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .toast-header {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

/* Stili per i pulsanti outline */
body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-success,
body.dark-mode .btn-outline-danger,
body.dark-mode .btn-outline-warning,
body.dark-mode .btn-outline-info {
    color: #e0e0e0;
}

/* Stili per le pagine di autenticazione */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stili per le card moderne */
.modern-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-top: 4px solid;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    height: 100%;
}

    .modern-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }

.modern-card-content {
    padding: 20px;
    display: flex;
    align-items: flex-start;
}

.modern-card-icon {
    font-size: 2.5rem;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-card-info {
    flex: 1;
}

.modern-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.2;
}

.modern-card-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
    font-weight: 500;
}

/* Card con sfondo colorato */
.modern-card-colored {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    height: 100%;
    color: white;
}

    .modern-card-colored:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }

.modern-card-icon-light {
    font-size: 2.5rem;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
}

.modern-card-info-light {
    flex: 1;
}

.modern-card-value-light {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.2;
    color: white;
}

.modern-card-label-light {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
    font-weight: 500;
}

/* Card con barra di progresso */
.modern-card-with-progress {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    height: 100%;
}

    .modern-card-with-progress:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }

/* Stili per il tema scuro delle card moderne */
body.dark-mode .modern-card {
    background-color: var(--card-bg);
}

body.dark-mode .modern-card-with-progress {
    background-color: var(--card-bg);
}

body.dark-mode .modern-card-label {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .progress {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Colori per le icone del menu */
.icon-dashboard {
    color: var(--primary-color);
}

.icon-charts {
    color: var(--success-color);
}

.icon-settings {
    color: var(--warning-color);
}

.icon-info {
    color: var(--info-color);
}

.icon-profile {
    color: var(--secondary-color);
}

.icon-logout {
    color: var(--danger-color);
}

/* Stile per il pulsante di chiusura della sidebar */
#closeSidebar {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

    #closeSidebar:hover {
        background-color: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }

/* Stili per le informazioni utente */
.user-info {
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.2);
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.user-details {
    flex: 1;
}

    .user-details h5 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: white;
    }

.user-role {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Stili per card professionali (grafici e filtri) */
.professional-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    border: none;
    overflow: hidden;
}

    .professional-card .card-header {
        background-color: transparent;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 15px 20px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        .professional-card .card-header h5 {
            margin: 0;
            font-size: 1.1rem;
            font-weight: 600;
        }

    .professional-card .card-body {
        padding: 20px;
    }

    .professional-card .card-footer {
        background-color: transparent;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        padding: 15px 20px;
    }

/* Stili per i filtri */
.filter-section {
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-bottom: 15px;
}

    .filter-section .form-label {
        font-weight: 500;
        font-size: 0.9rem;
    }

    .filter-section .form-control,
    .filter-section .form-select {
        border-radius: 6px;
        font-size: 0.9rem;
    }

    .filter-section .btn {
        border-radius: 6px;
        font-weight: 500;
    }

/* Stili per i grafici */
.chart-card {
    height: 100%;
}

    .chart-card .card-body {
        padding: 15px;
    }

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

/* Stili per il tema scuro delle card professionali */
body.dark-mode .professional-card {
    background-color: var(--card-bg);
}

    body.dark-mode .professional-card .card-header {
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }

    body.dark-mode .professional-card .card-footer {
        border-top-color: rgba(255, 255, 255, 0.05);
    }

body.dark-mode .filter-section {
    background-color: rgba(255, 255, 255, 0.03);
}
