/* Stile specifico per la pagina di login */
body.login-page {
    background: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
        url('isola-bergamasca-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    padding: 20px;
    overflow: auto;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.05) 0%, rgba(108, 117, 125, 0.05) 100%);
    z-index: -1;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo img {
    max-width: 180px;
    margin-bottom: 1rem;
}

/* Sidebar styles (centralized) */
.sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar .nav-link {
    color: #ecf0f1;
    padding: 0.75rem 1rem;
    margin: 0.2rem 0;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: #3498db;
    color: white;
}

.offcanvas-body .nav-link {
    color: #ecf0f1;
    padding: 0.75rem 1rem;
    margin: 0.2rem 0;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.offcanvas-body .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.offcanvas-body .nav-link.active {
    background-color: #3498db;
    color: white;
}

.stat-card {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
    border: none;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.nav-tabs .nav-link {
    color: #495057;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    font-weight: 600;
}

.section-title {
    border-left: 4px solid #0d6efd;
    padding-left: 10px;
    margin: 20px 0 15px;
}

.form-section {
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 3px solid #0d6efd;
}

.required-field::after {
    content: " *";
    color: red;
}

.progress-section {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab-pane {
    padding: 20px 0;
}

.search-results {
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
}

.operator-match {
    cursor: pointer;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.operator-match:hover {
    background-color: #f8f9fa;
}

.disabled-field {
    background-color: #e9ecef;
    opacity: 0.7;
}

body.operativi-page {
    overflow-x: hidden;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 10px;
}

.records-per-page {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.records-per-page label {
    margin-right: 10px;
    margin-bottom: 0;
    white-space: nowrap;
}

.page-info {
    margin: 0 15px;
    font-weight: bold;
    white-space: nowrap;
}

.table-container {
    min-height: 400px;
}

/* Stili per la tabella degli operativi */
.operativi-table {
    width: 100%;
    border-collapse: collapse;
}

.operativi-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

.operativi-table td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

.operativi-table tr:hover {
    background-color: #f8f9fa;
}

/* Badge per lo stato */
.badge-status {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 0.25rem;
}

.badge-status.active {
    background-color: #198754;
    color: white;
}

.badge-status.inactive {
    background-color: #6c757d;
    color: white;
}

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge.bg-success {
    background-color: #198754 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Pulsanti azione */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    margin: 0 2px;
}

/* Responsive per dispositivi mobili */
@media (max-width: 991.98px) {
    .pagination-container {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .operativi-table {
        display: block;
        overflow-x: auto;
    }

    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }

    .records-per-page {
        margin-bottom: 10px;
    }

    .btn-action {
        margin-bottom: 5px;
    }
}

@media (max-width: 576px) {
    .pagination-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .records-per-page {
        margin-bottom: 10px;
    }

    /* Card migliorate */
    .operativo-card {
        transition: transform 0.2s, box-shadow 0.2s;
        border: 1px solid rgba(0, 0, 0, 0.125);
    }

    .operativo-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }

    .avatar-placeholder {
        width: 80px;
        height: 80px;
        margin: 0 auto;
        border-radius: 50%;
        background-color: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 3px solid #e9ecef;
    }

    @media (max-width: 768px) {
        .stat-card .fa-3x {
            font-size: 2em !important;
        }

        .operativo-card {
            margin-bottom: 1rem;
        }
    }

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

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .stat-card {
        animation: fadeIn 0.6s ease-out;
    }

    .operativo-card {
        animation: fadeIn 0.8s ease-out;
    }

    .chart-container {
        position: relative;
        height: 250px;
        width: 100%;
    }

}

.login-container {
    background-color: rgba(255, 255, 255, 0.98);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: fadeInUp 0.6s ease-out;
    margin: 0 auto;
    /* Centra orizzontalmente */
}

.login-card {
    text-align: center;
}

.login-title {
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.login-subtitle {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Miglioramenti per i gruppi di input */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: block;
}

.input-group {
    position: relative;
    transition: all 0.3s ease;
}

.input-group-text {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-right: none;
    color: #6c757d;
    transition: all 0.3s ease;
}

.form-control {
    border-left: none;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    border-color: #86b7fe;
}

.input-group:focus-within .input-group-text {
    border-color: #86b7fe;
    background-color: #e7f1ff;
    color: #0d6efd;
}

/* Pulsante per mostrare/nascondere password */
.toggle-password {
    border-left: none;
    transition: all 0.3s ease;
}

.toggle-password:hover {
    background-color: #f8f9fa;
    color: #495057;
}

/* Pulsante di login migliorato */
.login-btn {
    padding: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

/* Footer del login */
.login-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f1f1;
}

/* Alert migliorato */
.forgot-password {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #0d6efd;
    text-decoration: underline;
}

/* Alert migliorato */
.alert-danger {
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive improvements */
@media (max-width: 576px) {
    body.login-page {
        padding: 15px;
        align-items: flex-start;
        /* Allinea in alto su mobile */
        padding-top: 40px;
        /* Spazio dall'alto */
    }

    .login-container {
        padding: 1.5rem;
        margin-top: 0;
    }

    .login-title {
        font-size: 1.5rem;
    }
}

/* Garantisce che nessun altro stile interferisca */
body.login-page * {
    box-sizing: border-box;
}

/* Reset specifico per elementi che potrebbero interferire */
body.login-page .container,
body.login-page .row,
body.login-page .col {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Stili per le card delle scadenze */
.scadenza-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid;
}

.scadenza-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.scadenza-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border-radius: 50%;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid;
}

/* Stili per la tabella delle scadenze */
.table-warning {
    background-color: #fff3cd !important;
}

.table-danger {
    background-color: #f8d7da !important;
}

/* Pulsanti azione */
.btn-aggiorna {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
}

/* Filtri */
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Aggiungi questi stili per i pulsanti di stato */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Animazione per il caricamento */
.fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Miglioramenti per gli alert */
.alert {
    border: none;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #198754;
}

.alert-info {
    border-left-color: #0dcaf0;
}

/* Dashboard Avanzata */
.dashboard-page {
    background-color: #f8f9fa;
}

.stat-card .card-body {
    padding: 1.5rem;
}

/* Tabelle responsive */
.table-responsive {
    border-radius: 0.375rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.table th {
    border-top: none;
    font-weight: 600;
    background-color: #f8f9fa;
}

/* Badge personalizzati */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Card hover effects */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Form styles */
.form-control:focus,
.form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Button styles */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-1px);
}

/* Alert styles */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* List group items */
.list-group-item {
    border: 1px solid rgba(0, 0, 0, 0.125);
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0;
    }

    .col-md-9 {
        padding: 1rem;
    }

    .stat-card .card-body {
        padding: 1rem;
    }
}

/* Chart container */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Off-canvas sidebar su mobile */
@media (max-width: 991.98px) {
    .container-fluid > .row > .col-md-9.col-lg-10 {
        padding-top: 60px !important;
    }
}

/* Stampa: nascondi hamburger button */
@media print {
    .btn.position-fixed {
        display: none !important;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .btn,
    .alert {
        display: none !important;
    }

    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* Stili per il modal degli attestati */
#modalAttestati .modal-dialog {
    max-width: 800px;
}

#modalAttestati .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Stili per la tabella nel modal */
#elencoAttestatiModal table {
    margin-bottom: 0;
}

#elencoAttestatiModal .table td {
    vertical-align: middle;
}

/* Miglioramenti responsive per il modal */
@media (max-width: 768px) {
    #modalAttestati .modal-dialog {
        margin: 1rem;
    }

    #modalAttestati .modal-body {
        max-height: 50vh;
    }
}

/* Stili per i badge di conteggio */
.badge-count {
    font-size: 0.8em;
    padding: 0.25em 0.5em;
}

/* Transizioni per il modal */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}