:root {
    --navbar-height: 72px;
    --sidebar-width: 280px;
    --primary-red: #BA1817;
    --text-gray: #555555;
    --border-color: #ddd;
    --hover-bg: #E2E3E5;
}

/* Base Styles */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Skip Links - Accessibility for keyboard navigation and screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: bold;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 20px;
    z-index: 9998;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
}

.cookie-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.cookie-banner-text {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.cookie-banner-text i {
    font-size: 24px;
    color: #ffc107;
    flex-shrink: 0;
}

.cookie-banner-link {
    color: #4fc3f7;
    text-decoration: underline;
    margin-left: 5px;
}

.cookie-banner-link:hover {
    color: #81d4fa;
}

.cookie-banner-btn {
    background: var(--primary-red);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: background 0.3s ease;
}

.cookie-banner-btn:hover {
    background: #9a1312;
}

.cookie-banner-btn i {
    font-size: 18px;
}

/* Responsive Cookie Banner */
@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-banner-text {
        flex-direction: column;
        text-align: center;
    }

    .cookie-banner-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Layout Structure */
#page-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
}

#main-content-row {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Navbar Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--navbar-height);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' fill='%23ffffff' viewBox='0 0 30 30'%3E%3Cpath d='M4 7h22M4 15h22M4 23h22' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.5em 1.5em;
}

/* Sidebar Styles */
#sidebar-placeholder {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background-color: #f8f9fa;
}

#sidebar-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar {
    background-color: #f8f9fa;
    padding-top: 10px;
    z-index: 1000;
    position: relative;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-nav {
    padding-bottom: 120px; /* Spazio per la decorazione in fondo */
}

.sidebar-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    pointer-events: none; /* Permette l'interazione con il menu anche sopra la decorazione */
}

.sidebar-decoration object {
    position: static;
    display: block;
    width: 100%;
}

/* Main Content Styles */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #fff;
}

/* Navigation Styles */
.nav-link {
    color: var(--text-gray);
    padding: 0.8rem;
}

    .nav-link:hover, .nav-link:focus {
        color: var(--text-gray);
        background-color: var(--hover-bg);
    }

.nav-pills .nav-link.active {
    background-color: var(--primary-red) !important;
}

/* Sidebar Menu - Miglioramento gerarchia visiva */

/* Voci principali con sotto-menu */
#side-menu > .nav-item > .nav-link[data-bs-toggle="collapse"] {
    font-weight: 500;
    position: relative;
}

/* Chevron rotante per feedback visivo */
#side-menu > .nav-item > .nav-link .bi-chevron-down {
    transition: transform 0.3s ease;
    float: right;
    margin-left: auto;
}

#side-menu > .nav-item > .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Area collassabile con sfondo quando espansa */
#side-menu .collapse.show {
    background-color: #f1f3f5;
    border-left: 3px solid var(--primary-red);
    margin: 0.25rem 0;
}

/* Sotto-voci (menu figlie) con indentazione e stile differenziato */
#side-menu .collapse .nav-link {
    padding: 0.65rem 0.8rem 0.65rem 2.5rem; /* Indentazione a sinistra */
    font-size: 0.9rem; /* Leggermente più piccolo */
    color: #6c757d; /* Colore più tenue */
    font-weight: 400;
    transition: all 0.2s ease;
}

#side-menu .collapse .nav-link:hover {
    background-color: #dee2e6;
    color: #495057;
    padding-left: 2.7rem; /* Leggero shift a destra on hover */
}

/* Icona delle sotto-voci leggermente più piccola */
#side-menu .collapse .nav-link i {
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

/* Separazione più marcata tra gruppi principali */
#side-menu > .nav-item.border-bottom {
    border-bottom: 2px solid #ced4da;
    margin-bottom: 0;
}

/* Evidenziazione voce attiva nelle sotto-voci */
#side-menu .collapse .nav-link.active {
    background-color: #d4d6d8;
    color: var(--primary-red);
    font-weight: 500;
    border-left: 3px solid var(--primary-red);
    padding-left: 2.2rem;
}

/* Form Styles */
.form-control:focus, .form-select:focus {
    border-color: #404040bd;
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
}

.input-group-append:hover {
    background-color: #6C757D !important;
    border-color: #6C757D !important;
}

/* Utility Classes */
.bg-red {
    background-color: var(--primary-red);
}

/* Breadcrumb Styles */
#breadcrumb-placeholder {
    font-weight: 200;
}

    #breadcrumb-placeholder > ol {
        margin-bottom: 1.6rem;
    }

        #breadcrumb-placeholder > ol > li a {
            color: #d0d0d0;
            text-decoration: none;
        }

            #breadcrumb-placeholder > ol > li a:hover {
                color: var(--primary-red);
            }

        #breadcrumb-placeholder > ol > li.breadcrumb-item.active {
            color: var(--text-gray);
            font-weight: 400;
        }

/* Profile Styles */
#profilo > div > div > div.profilo-immagine > img {
    border: 2px solid var(--text-gray);
    border-radius: 100%;
    padding: 0;
    margin: 0;
}

/* Table Styles */
.table-responsive th a {
    color: inherit;
    text-decoration: none;
}

/* Input Styles */
input[type="number"] {
    width: 60px;
    padding: 2px 4px;
    text-align: center;
}

/* Validation Styles */
.validation-summary-errors ul {
    padding: 0;
}

.validation-summary-errors li {
    list-style-type: none;
    color: red;
}

.field-validation-error {
    color: red !important;
}

/* Responsive Styles */
@media (max-width: 992px) {
    #sidebar-placeholder {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        bottom: 0;
        z-index: 1020;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

        #sidebar-placeholder.show {
            transform: translateX(0);
        }

    #main-content {
        width: 100%;
    }

    .navbar-nav .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        max-width: 100vw;
        margin: 0 auto;
        max-height: 80vh;
        overflow-y: auto;
    }

    .md-d-none {
        display: none;
    }

    .b-alternative {
        border-right: 0 !important;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 767px) {
    .px-2-md {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .me-0-md {
        margin-right: 0 !important;
    }
}

.navbar-link {
    color: white !important; /* Testo bianco */
    text-decoration: none !important; /* Rimuove la sottolineatura */
    font-weight: 600; /* Rende il testo pi� leggibile */
    padding: 0.5rem 1rem; /* Aggiunge spazio attorno al testo */
    border-radius: 5px; /* Smussa leggermente gli angoli */
    transition: background-color 0.3s ease-in-out; /* Effetto di transizione */
}

.navbar-link:hover,
.navbar-link:focus {
    background-color: rgba(255, 255, 255, 0.2); /* Sfondo leggermente evidenziato */
    color: white !important; /* Mantiene il colore bianco */
    text-decoration: none; /* Nessuna sottolineatura */
}

/* Vacation and Permit Statistics Styling */
.vacation-permit-statistics {
    margin-top: 20px;
}

.vacation-permit-statistics .card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.vacation-permit-statistics .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* Table styling for vacation/permit statistics */
.vacation-permit-table {
    font-size: 0.9rem;
}

.vacation-permit-table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 8px;
    vertical-align: middle;
    text-align: center;
}

.vacation-permit-table td {
    padding: 8px;
    vertical-align: middle;
    text-align: center;
    border-top: 1px solid #dee2e6;
}

/* Vacation-specific styling (green theme) */
.vacation-section th {
    background-color: #d4edda;
    color: #155724;
    border-bottom: 2px solid #c3e6cb;
}

.vacation-data {
    background-color: #f8fff9;
    color: #155724;
    font-weight: 500;
}

.vacation-positive {
    color: #28a745;
    font-weight: 600;
}

.vacation-negative {
    color: #dc3545;
    font-weight: 600;
}

/* Permit-specific styling (blue theme) */
.permit-section th {
    background-color: #d1ecf1;
    color: #0c5460;
    border-bottom: 2px solid #bee5eb;
}

.permit-data {
    background-color: #f1f9fa;
    color: #0c5460;
    font-weight: 500;
}

.permit-positive {
    color: #17a2b8;
    font-weight: 600;
}

.permit-negative {
    color: #dc3545;
    font-weight: 600;
}

/* Employee name column */
.employee-name {
    text-align: left !important;
    font-weight: 600;
    color: #495057;
    min-width: 150px;
}

/* Badge styling for better visual distinction */
.vacation-badge {
    background-color: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.permit-badge {
    background-color: #17a2b8;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Legend/Info box */
.statistics-legend {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.statistics-legend h6 {
    color: #495057;
    margin-bottom: 10px;
    font-weight: 600;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    margin-bottom: 8px;
}

.legend-item .color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
}

.legend-item .color-box.vacation {
    background-color: #28a745;
}

.legend-item .color-box.permit {
    background-color: #17a2b8;
}

.legend-item span {
    font-size: 0.9rem;
    color: #495057;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .vacation-permit-table {
        font-size: 0.8rem;
    }

    .vacation-permit-table th,
    .vacation-permit-table td {
        padding: 6px 4px;
    }

    .employee-name {
        min-width: 120px;
    }
}

/* ============================================
   FIX LEAFLET - Mappe interattive
   Risolve problema tile sfalsate con Bootstrap
   ============================================ */
.leaflet-container,
.leaflet-container *,
.leaflet-container *::before,
.leaflet-container *::after {
    box-sizing: content-box !important;
}
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}