/* STILI BASE */
.cdi-reports-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.cdi-reports-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.cdi-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cdi-page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.cdi-user-info {
    text-align: right;
}

.cdi-user-role {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

/* ALERT */
.cdi-alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 5px solid;
}

.cdi-alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.cdi-alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.cdi-alert-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.cdi-alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

/* PULSANTI */
.cdi-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.cdi-btn i {
    margin-right: 8px;
}

.cdi-btn-large {
    padding: 12px 24px;
    font-size: 16px;
}

.cdi-btn-medium {
    padding: 8px 16px;
    font-size: 14px;
}

.cdi-btn-small {
    padding: 5px 10px;
    font-size: 12px;
    margin: 0 2px;
}

.cdi-btn-primary {
    background: #0073aa;
    color: white;
}

.cdi-btn-primary:hover {
    background: #005a87;
    color: white;
}

.cdi-btn-secondary {
    background: #6c757d;
    color: white;
}

.cdi-btn-secondary:hover {
    background: #545b62;
    color: white;
}

.cdi-btn-edit {
    background: #28a745;
    color: white;
}

.cdi-btn-edit:hover {
    background: #218838;
    color: white;
}

.cdi-btn-view {
    background: #17a2b8;
    color: white;
}

.cdi-btn-view:hover {
    background: #138496;
    color: white;
}

.cdi-btn-danger {
    background: #dc3545;
    color: white;
}

.cdi-btn-danger:hover {
    background: #c82333;
    color: white;
}

.cdi-btn-close {
    background: #6c757d;
    color: white;
}

.cdi-btn-close:hover {
    background: #545b62;
    color: white;
}

/* AZIONI PRINCIPALI */
.cdi-main-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.cdi-actions-left {
    display: flex;
    gap: 10px;
}

/* STATISTICHE */
.cdi-stats-overview {
    display: flex;
    gap: 20px;
}

.cdi-stat-box {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 100px;
}

.cdi-stat-number {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.cdi-stat-label {
    font-size: 14px;
    color: #666;
}

.cdi-stat-success .cdi-stat-number {
    color: #28a745;
}

.cdi-stat-warning .cdi-stat-number {
    color: #ffc107;
}

/* ULTIMO REPORT */
.cdi-latest-report {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cdi-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.cdi-view-header h2 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdi-report-period {
    font-size: 16px;
    color: #666;
    font-weight: normal;
}

/* METADATI */
.cdi-report-meta {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.cdi-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cdi-meta-item strong {
    color: #555;
}

/* BADGE STATO */
.cdi-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.cdi-status-bozza {
    background: #ffc107;
    color: #856404;
}

.cdi-status-inviato {
    background: #28a745;
    color: white;
}

/* SEZIONI */
.cdi-detail-section {
    margin-bottom: 30px;
}

.cdi-detail-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* GRIGLIE */
.cdi-detail-grid,
.cdi-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.cdi-detail-item,
.cdi-view-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
}

.cdi-detail-item label,
.cdi-view-item label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    font-size: 14px;
}

.cdi-detail-value,
.cdi-view-value {
    font-size: 16px;
    color: #333;
}

/* AZIONI FINALI */
.cdi-main-actions-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

/* NESSUN REPORT */
.cdi-no-reports {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cdi-empty-state i {
    font-size: 60px;
    color: #6c757d;
    margin-bottom: 20px;
}

.cdi-empty-state h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.cdi-empty-state p {
    color: #666;
    margin-bottom: 25px;
}

/* TABELLA REPORT */
.cdi-other-reports {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cdi-other-reports h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdi-reports-table {
    width: 100%;
    border-collapse: collapse;
}

.cdi-reports-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

.cdi-reports-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.cdi-reports-table tbody tr:hover {
    background: #f8f9fa;
}

.cdi-actions {
    white-space: nowrap;
}

.cdi-action-buttons-small {
    display: flex;
    gap: 5px;
}

/* FORM */
.cdi-form-container {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cdi-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.cdi-form-header h2 {
    margin: 0;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdi-form-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.cdi-form-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdi-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.cdi-form-group {
    margin-bottom: 20px;
}

.cdi-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.cdi-form-group label .required {
    color: #dc3545;
}

.cdi-readonly-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.cdi-periodo-select,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.cdi-form-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

/* VISUALIZZAZIONE */
.cdi-view-container {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cdi-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.cdi-view-header h2 {
    margin: 0;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdi-view-section {
    margin-bottom: 30px;
}

.cdi-view-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdi-view-content-section {
    margin-bottom: 25px;
}

.cdi-view-content-section h4 {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 16px;
}

.cdi-view-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    line-height: 1.6;
}

.cdi-view-content p {
    margin: 0 0 10px 0;
}

.cdi-view-content p:last-child {
    margin-bottom: 0;
}

/* ACCESSO NEGATO */
.cdi-access-denied {
    max-width: 600px;
    margin: 100px auto;
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cdi-access-denied h1 {
    color: #dc3545;
    margin-bottom: 20px;
}

.cdi-access-denied p {
    margin-bottom: 20px;
    font-size: 16px;
}

.button {
    display: inline-block;
    padding: 12px 30px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background 0.3s;
}

.button:hover {
    background: #005a87;
    color: white;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .cdi-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .cdi-user-info {
        text-align: left;
    }
    
    .cdi-main-actions {
        flex-direction: column;
        gap: 20px;
    }
    
    .cdi-stats-overview {
        width: 100%;
        justify-content: space-around;
    }
    
    .cdi-view-header,
    .cdi-form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .cdi-report-meta {
        flex-direction: column;
        gap: 15px;
    }
    
    .cdi-detail-grid,
    .cdi-view-grid,
    .cdi-form-grid {
        grid-template-columns: 1fr;
    }
    
    .cdi-main-actions-footer,
    .cdi-form-footer {
        flex-direction: column;
    }
    
    .cdi-reports-table {
        display: block;
        overflow-x: auto;
    }
}

/* STILI AGGIUNTIVI PER LA NUOVA VERSIONE */

/* Layout a piena larghezza */
.cdi-view-grid.full-width {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.cdi-view-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.cdi-view-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cdi-view-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cdi-view-value {
    font-size: 16px;
    color: #212529;
    line-height: 1.5;
    min-height: 24px;
}

/* Tabella migliorata */
.cdi-reports-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.cdi-reports-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.cdi-reports-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
    background: white;
    color: #495057;
}

.cdi-reports-table tbody tr {
    transition: all 0.2s ease;
}

.cdi-reports-table tbody tr:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cdi-reports-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badge stato migliorato */
.cdi-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cdi-status-bozza {
    background: linear-gradient(135deg, #ffd700 0%, #ff9900 100%);
    color: #856404;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
}

.cdi-status-inviato {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

/* Metadati migliorati */
.cdi-report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.cdi-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cdi-meta-item strong {
    color: #495057;
    font-weight: 600;
}

/* Contenuti migliorati */
.cdi-view-content {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    line-height: 1.7;
    color: #495057;
}

.cdi-view-content-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #495057;
    margin: 20px 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    font-size: 18px;
}

.cdi-view-content-section h4 i {
    color: #667eea;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 992px) {
    .cdi-view-grid.full-width {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .cdi-view-grid.full-width {
        grid-template-columns: 1fr;
    }
    
    .cdi-report-meta {
        flex-direction: column;
        gap: 15px;
    }
    
    .cdi-reports-table {
        font-size: 14px;
    }
    
    .cdi-reports-table th,
    .cdi-reports-table td {
        padding: 12px;
    }
}

/* Aggiungi queste regole alla fine del reports.css */

/* Stili per campi editabili nel form di modifica */
.cdi-view-item input[type="text"],
.cdi-view-item select,
.cdi-view-item textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
}

.cdi-view-item input[type="text"]:focus,
.cdi-view-item select:focus,
.cdi-view-item textarea:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cdi-view-item textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* Campi readonly nel form di modifica */
.cdi-view-item .cdi-readonly-field {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #e9ecef;
    cursor: not-allowed;
}

/* Etichette dei campi */
.cdi-view-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Indicatore campo obbligatorio */
.cdi-view-item label .required {
    color: #dc3545;
    margin-left: 2px;
}

/* Contenitori dei campi nel form */
.cdi-view-item .cdi-view-value {
    font-size: 16px;
    color: #212529;
    line-height: 1.5;
    min-height: 24px;
}

/* Pulsanti specifici per il form */
.cdi-form-footer {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f1f3f5;
}

/* Responsive per il form */
@media (max-width: 768px) {
    .cdi-form-footer {
        flex-direction: column;
    }
    
    .cdi-view-item input[type="text"],
    .cdi-view-item select,
    .cdi-view-item textarea {
        font-size: 14px;
        padding: 8px;
    }
}

/* MODAL MIGLIORATO */
.cdi-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: cdiFadeIn 0.3s ease;
    backdrop-filter: blur(5px);
    padding: 20px;
}

.cdi-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: cdiSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cdi-modal-header {
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.cdi-modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.cdi-modal-header h3 i {
    font-size: 24px;
}

.cdi-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 300;
}

.cdi-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.cdi-modal-body {
    padding: 32px 28px;
    font-size: 17px;
    line-height: 1.7;
    color: #374151;
}

.cdi-modal-body p {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 500;
}

.cdi-modal-body p:last-child {
    margin-bottom: 0;
}

.cdi-modal-warning {
    background: linear-gradient(135deg, #fee 0%, #fcc 100%);
    border: 2px solid #f99;
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: #c53030;
    font-weight: 600;
    animation: cdiPulse 2s infinite;
}

.cdi-modal-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #90caf9;
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: #1565c0;
    font-weight: 600;
}

.cdi-modal-warning i,
.cdi-modal-info i {
    font-size: 22px;
    margin-top: 2px;
    flex-shrink: 0;
}

.cdi-modal-warning i {
    color: #e53e3e;
}

.cdi-modal-info i {
    color: #1976d2;
}

.cdi-modal-footer {
    padding: 24px 28px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.cdi-modal-footer .cdi-btn {
    min-width: 140px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cdi-modal-footer .cdi-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* ANIMAZIONI */
@keyframes cdiFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cdiSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cdiPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.3);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(229, 62, 62, 0);
    }
}

@keyframes cdiShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* CAMPI ERRORE */
.cdi-field-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    animation: cdiShake 0.5s ease;
}

/* MESSAGGI CARICAMENTO */
#cdiLoadingMessage {
    display: flex !important;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 16px;
    padding: 18px 24px;
    border-radius: 10px;
    margin-bottom: 25px;
    animation: cdiFadeIn 0.3s ease;
}

#cdiLoadingMessage .fa-spinner {
    font-size: 20px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .cdi-modal {
        max-width: 95%;
        margin: 10px;
    }
    
    .cdi-modal-header {
        padding: 20px;
    }
    
    .cdi-modal-header h3 {
        font-size: 19px;
    }
    
    .cdi-modal-body {
        padding: 24px 20px;
        font-size: 16px;
    }
    
    .cdi-modal-body p {
        font-size: 17px;
    }
    
    .cdi-modal-warning,
    .cdi-modal-info {
        padding: 16px;
        font-size: 15px;
    }
    
    .cdi-modal-footer {
        padding: 20px;
        flex-direction: column;
    }
    
    .cdi-modal-footer .cdi-btn {
        width: 100%;
        margin: 5px 0;
        min-width: auto;
    }
}

/* ANIMAZIONI */
@keyframes cdiFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cdiSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-40px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cdiShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* MESSAGGI DI CARICAMENTO */
.cdi-alert-info #cdiLoadingMessage {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.cdi-alert-info .fa-spinner {
    font-size: 18px;
}

/* RESPONSIVE MODAL */
@media (max-width: 768px) {
    .cdi-modal {
        width: 95%;
        margin: 10px;
    }
    
    .cdi-modal-header {
        padding: 18px 20px;
    }
    
    .cdi-modal-body {
        padding: 25px 20px;
    }
    
    .cdi-modal-footer {
        padding: 20px;
        flex-direction: column;
    }
    
    .cdi-modal-footer .cdi-btn {
        width: 100%;
        margin: 5px 0;
    }
}


/* ============================================
   MODAL STYLES - MIGLIORATO
   ============================================ */

.cdi-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.85) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    animation: cdiModalFadeIn 0.4s ease-out !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    padding: 20px !important;
}

.cdi-modal {
    background: #ffffff !important;
    border-radius: 20px !important;
    width: 100% !important;
    max-width: 520px !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
    overflow: hidden !important;
    animation: cdiModalSlideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    transform-origin: center center !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    position: relative !important;
}

.cdi-modal::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea) !important;
    background-size: 200% 100% !important;
    animation: cdiModalShine 3s linear infinite !important;
}

.cdi-modal-header {
    padding: 28px 32px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    position: relative !important;
}

.cdi-modal-header h3 {
    margin: 0 !important;
    font-size: 24px !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    letter-spacing: -0.3px !important;
}

.cdi-modal-header h3 i {
    font-size: 26px !important;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)) !important;
}

.cdi-modal-close {
    background: rgba(255, 255, 255, 0.25) !important;
    border: none !important;
    color: white !important;
    font-size: 32px !important;
    cursor: pointer !important;
    line-height: 1 !important;
    padding: 0 !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    font-weight: 300 !important;
    position: relative !important;
    overflow: hidden !important;
}

.cdi-modal-close::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1)) !important;
    border-radius: 50% !important;
    opacity: 0 !important;
    transition: opacity 0.3s !important;
}

.cdi-modal-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    transform: rotate(90deg) scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3) !important;
}

.cdi-modal-close:hover::before {
    opacity: 1 !important;
}

.cdi-modal-body {
    padding: 36px 32px !important;
    font-size: 18px !important;
    line-height: 1.7 !important;
    color: #2d3748 !important;
    background: linear-gradient(to bottom, #ffffff, #f8fafc) !important;
}

.cdi-modal-body p {
    margin: 0 0 24px 0 !important;
    font-size: 19px !important;
    font-weight: 600 !important;
    color: #1a202c !important;
    line-height: 1.6 !important;
}

.cdi-modal-body p:last-child {
    margin-bottom: 0 !important;
}

.cdi-modal-warning {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%) !important;
    border: 2px solid #fc8181 !important;
    border-radius: 14px !important;
    padding: 24px !important;
    margin: 28px 0 20px 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 18px !important;
    color: #9b2c2c !important;
    font-weight: 700 !important;
    animation: cdiModalPulse 2.5s ease-in-out infinite !important;
    box-shadow: 0 4px 15px rgba(254, 178, 178, 0.3) !important;
    position: relative !important;
    overflow: hidden !important;
}

.cdi-modal-warning::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 3px !important;
    background: linear-gradient(90deg, #fc8181, #f56565, #fc8181) !important;
}

.cdi-modal-info {
    background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%) !important;
    border: 2px solid #63b3ed !important;
    border-radius: 14px !important;
    padding: 24px !important;
    margin: 28px 0 20px 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 18px !important;
    color: #2c5282 !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(144, 205, 244, 0.3) !important;
}

.cdi-modal-warning i,
.cdi-modal-info i {
    font-size: 24px !important;
    margin-top: 2px !important;
    flex-shrink: 0 !important;
}

.cdi-modal-warning i {
    color: #e53e3e !important;
    filter: drop-shadow(0 2px 2px rgba(229, 62, 62, 0.3)) !important;
}

.cdi-modal-info i {
    color: #3182ce !important;
    filter: drop-shadow(0 2px 2px rgba(49, 130, 206, 0.3)) !important;
}

.cdi-modal-footer {
    padding: 28px 32px !important;
    background: linear-gradient(to bottom, #f7fafc, #edf2f7) !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 20px !important;
    border-bottom-left-radius: 20px !important;
    border-bottom-right-radius: 20px !important;
}

.cdi-modal-footer .cdi-btn {
    min-width: 160px !important;
    padding: 16px 32px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: none !important;
    position: relative !important;
    overflow: hidden !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.cdi-modal-footer .cdi-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(rgba(255,255,255,0.1), rgba(255,255,255,0)) !important;
    opacity: 0 !important;
    transition: opacity 0.3s !important;
}

.cdi-modal-footer .cdi-btn:hover {
    transform: translateY(-4px) scale(1.05) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2) !important;
}

.cdi-modal-footer .cdi-btn:hover::before {
    opacity: 1 !important;
}

.cdi-modal-footer .cdi-btn i {
    margin-right: 10px !important;
    font-size: 18px !important;
}

/* Bottoni specifici per modal */
.cdi-btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%) !important;
    color: white !important;
}

.cdi-btn-success:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%) !important;
    color: white !important;
}

/* ============================================
   ANIMAZIONI MODAL
   ============================================ */

@keyframes cdiModalFadeIn {
    from { 
        opacity: 0;
        backdrop-filter: blur(0);
        -webkit-backdrop-filter: blur(0);
    }
    to { 
        opacity: 1;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

@keyframes cdiModalSlideUp {
    from { 
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cdiModalShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes cdiModalPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(254, 178, 178, 0.3);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 6px 25px rgba(254, 178, 178, 0.4);
    }
}

/* ============================================
   STILI AGGIUNTIVI PER FORM
   ============================================ */

.cdi-field-error {
    border-color: #f56565 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 4px rgba(245, 101, 101, 0.2), inset 0 1px 2px rgba(0,0,0,0.1) !important;
    animation: cdiFieldErrorShake 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    position: relative !important;
}

.cdi-field-error::after {
    content: '✗' !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #f56565 !important;
    font-size: 18px !important;
    font-weight: bold !important;
}

@keyframes cdiFieldErrorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Messaggio caricamento */
#cdi-form-loading {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    font-weight: 700 !important;
    font-size: 17px !important;
    padding: 20px 28px !important;
    border-radius: 12px !important;
    margin-bottom: 30px !important;
    animation: cdiFadeIn 0.5s ease !important;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 2px solid #90caf9 !important;
    color: #1565c0 !important;
}

#cdi-form-loading .fa-spinner {
    font-size: 22px !important;
    animation: cdiSpin 1.5s linear infinite !important;
}

@keyframes cdiSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulsanti disabilitati */
.cdi-btn-disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.cdi-btn-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   RESPONSIVE MODAL
   ============================================ */

@media (max-width: 768px) {
    .cdi-modal-overlay {
        padding: 15px !important;
    }
    
    .cdi-modal {
        max-width: 95% !important;
        border-radius: 16px !important;
    }
    
    .cdi-modal-header {
        padding: 22px 24px !important;
    }
    
    .cdi-modal-header h3 {
        font-size: 20px !important;
        gap: 12px !important;
    }
    
    .cdi-modal-header h3 i {
        font-size: 22px !important;
    }
    
    .cdi-modal-close {
        width: 38px !important;
        height: 38px !important;
        font-size: 28px !important;
    }
    
    .cdi-modal-body {
        padding: 28px 24px !important;
        font-size: 16px !important;
    }
    
    .cdi-modal-body p {
        font-size: 17px !important;
        margin-bottom: 20px !important;
    }
    
    .cdi-modal-warning,
    .cdi-modal-info {
        padding: 20px !important;
        margin: 20px 0 !important;
        font-size: 15px !important;
    }
    
    .cdi-modal-warning i,
    .cdi-modal-info i {
        font-size: 20px !important;
    }
    
    .cdi-modal-footer {
        padding: 24px !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .cdi-modal-footer .cdi-btn {
        width: 100% !important;
        min-width: auto !important;
        margin: 4px 0 !important;
        padding: 14px 24px !important;
    }
}

@media (max-width: 480px) {
    .cdi-modal {
        max-width: 100% !important;
        border-radius: 12px !important;
    }
    
    .cdi-modal-header {
        padding: 20px !important;
    }
    
    .cdi-modal-body {
        padding: 24px 20px !important;
    }
    
    .cdi-modal-footer {
        padding: 20px !important;
    }
}

/* Aggiungi questa parte alla fine del file reports.css esistente */

/* ============================================
   STILI PER PERMESSI RUOLI
   ============================================ */

/* Badge proprietario */
.cdi-owner-badge {
    display: inline-block;
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Evidenzia righe di altri utenti */
.cdi-reports-table tbody tr:not(.cdi-owner-row) {
    background: linear-gradient(to right, #f8f9fa 0%, #ffffff 100%);
}

.cdi-reports-table tbody tr:not(.cdi-owner-row):hover {
    background: linear-gradient(to right, #e9ecef 0%, #f8f9fa 100%);
}

/* Evidenzia righe proprie */
.cdi-owner-row {
    background: linear-gradient(to right, #f0fff4 0%, #ffffff 100%);
    border-left: 3px solid #28a745;
}

.cdi-owner-row:hover {
    background: linear-gradient(to right, #e6ffed 0%, #f0fff4 100%);
}

/* Disabilita pulsanti quando non autorizzati */
.cdi-btn[disabled],
.cdi-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Messaggio di avviso per report di altri */
.cdi-report-other-user {
    background: linear-gradient(to right, #fff3cd 0%, #ffffff 100%);
    border: 1px solid #ffeaa7;
    border-radius: 5px;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 14px;
    color: #856404;
}

.cdi-report-other-user i {
    color: #f39c12;
    margin-right: 8px;
}

/* Indicatore visivo per permessi limitati */
.cdi-permission-restricted {
    position: relative;
}

.cdi-permission-restricted::after {
    content: "🔒";
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    opacity: 0.7;
}

/* Aggiungi questa parte alla fine del file reports.css esistente */

/* ============================================
   STILI PER SEZIONI SEPARATE REPORT
   ============================================ */

/* Intestazione sezione report */
.cdi-other-reports h3 {
    font-size: 20px;
    margin: 40px 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cdi-other-reports h3 i {
    color: #3498db;
    font-size: 18px;
}

/* Separatore visivo tra sezioni */
.cdi-other-reports:not(:first-of-type) {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f1f3f5;
}

/* Titolo sezione "Report degli Altri Operatori" */
.cdi-other-reports h3 i.fa-users {
    color: #e74c3c;
}

/* Titolo sezione "I Tuoi Altri Report" */
.cdi-other-reports h3 i.fa-history {
    color: #f39c12;
}

/* Messaggio quando non ci sono report di altri */
.cdi-no-other-reports {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px dashed #dee2e6;
}

.cdi-no-other-reports i {
    font-size: 40px;
    color: #95a5a6;
    margin-bottom: 15px;
}

.cdi-no-other-reports h4 {
    margin: 0 0 10px 0;
    color: #7f8c8d;
}

.cdi-no-other-reports p {
    color: #95a5a6;
    margin: 0;
}

/* Badge per statistiche */
.cdi-stat-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Evidenziazione per "I Tuoi Report" */
.cdi-stats-overview .cdi-stat-box:first-child .cdi-stat-number {
    color: #3498db;
}

/* Responsive per sezioni separate */
@media (max-width: 768px) {
    .cdi-other-reports {
        margin-top: 30px;
        padding-top: 20px;
    }
    
    .cdi-other-reports h3 {
        font-size: 18px;
        margin: 30px 0 15px 0;
    }
}

/* ============================================
   STILI PER SEZIONI SEPARATE REPORT
   ============================================ */

/* Intestazione sezione report */
.cdi-other-reports h3 {
    font-size: 20px;
    margin: 40px 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cdi-other-reports h3 i {
    color: #3498db;
    font-size: 18px;
}

/* Separatore visivo tra sezioni */
.cdi-other-reports:not(:first-of-type) {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f1f3f5;
}

/* Titolo sezione "Report degli Altri Operatori" */
.cdi-other-reports h3 i.fa-users {
    color: #e74c3c;
}

/* Titolo sezione "I Tuoi Altri Report" */
.cdi-other-reports h3 i.fa-history {
    color: #f39c12;
}

/* Messaggio quando non ci sono report di altri */
.cdi-no-other-reports {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px dashed #dee2e6;
}

.cdi-no-other-reports i {
    font-size: 40px;
    color: #95a5a6;
    margin-bottom: 15px;
}

.cdi-no-other-reports h4 {
    margin: 0 0 10px 0;
    color: #7f8c8d;
}

.cdi-no-other-reports p {
    color: #95a5a6;
    margin: 0;
}

/* Badge per statistiche */
.cdi-stat-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Evidenziazione per "I Tuoi Report" */
.cdi-stats-overview .cdi-stat-box:first-child .cdi-stat-number {
    color: #3498db;
}

/* Responsive per sezioni separate */
@media (max-width: 768px) {
    .cdi-other-reports {
        margin-top: 30px;
        padding-top: 20px;
    }
    
    .cdi-other-reports h3 {
        font-size: 18px;
        margin: 30px 0 15px 0;
    }
}

/* ============================================
   STILI PER PERMESSI RUOLI
   ============================================ */

/* Badge proprietario */
.cdi-owner-badge {
    display: inline-block;
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Evidenzia righe di altri utenti */
.cdi-reports-table tbody tr:not(.cdi-owner-row) {
    background: linear-gradient(to right, #f8f9fa 0%, #ffffff 100%);
}

.cdi-reports-table tbody tr:not(.cdi-owner-row):hover {
    background: linear-gradient(to right, #e9ecef 0%, #f8f9fa 100%);
}

/* Evidenzia righe proprie */
.cdi-owner-row {
    background: linear-gradient(to right, #f0fff4 0%, #ffffff 100%);
    border-left: 3px solid #28a745;
}

.cdi-owner-row:hover {
    background: linear-gradient(to right, #e6ffed 0%, #f0fff4 100%);
}

/* Disabilita pulsanti quando non autorizzati */
.cdi-btn[disabled],
.cdi-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Messaggio di avviso per report di altri */
.cdi-report-other-user {
    background: linear-gradient(to right, #fff3cd 0%, #ffffff 100%);
    border: 1px solid #ffeaa7;
    border-radius: 5px;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 14px;
    color: #856404;
}

.cdi-report-other-user i {
    color: #f39c12;
    margin-right: 8px;
}

/* Indicatore visivo per permessi limitati */
.cdi-permission-restricted {
    position: relative;
}

.cdi-permission-restricted::after {
    content: "🔒";
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    opacity: 0.7;
}

/* ============================================
   STILI PER SELECT DROPDOWN MIGLIORATI
   ============================================ */

select.cdi-periodo-select,
select[name="soggetto_attuatore"],
select[name="work_package"],
select[name="task_riferimento"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    cursor: pointer;
}

select.cdi-periodo-select:focus,
select[name="soggetto_attuatore"]:focus,
select[name="work_package"]:focus,
select[name="task_riferimento"]:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Stili per select richiesti ma non compilati */
select[required]:invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

select[required]:valid {
    border-color: #28a745;
}

/* Opzioni dei select */
select option {
    padding: 10px;
    font-size: 15px;
}

select option:disabled {
    color: #6c757d;
    font-style: italic;
}

/* ============================================
   STILI PER GRUPPI DI SEZIONI
   ============================================ */

.cdi-detail-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f3f5;
    transition: all 0.3s ease;
}

.cdi-detail-section:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-color: #e9ecef;
}

.cdi-detail-section h3 {
    font-size: 20px;
    margin-bottom: 25px;
    color: #2c3e50;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cdi-detail-section h3 i {
    color: #3498db;
    font-size: 18px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
}

/* Sezione specifica per "Relazione delle attività svolte" */
.cdi-detail-section h3 i.fa-calendar-alt {
    color: #e74c3c;
}

/* Sezione specifica per "Dati del Progetto" */
.cdi-detail-section h3 i.fa-project-diagram {
    color: #9b59b6;
}

/* Sezione specifica per "Dati identificativi dell'operatore" */
.cdi-detail-section h3 i.fa-user {
    color: #3498db;
}

/* Sezione specifica per "Attività Svolte nel Trimestre" */
.cdi-detail-section h3 i.fa-tasks {
    color: #2ecc71;
}

/* Sezione specifica per "Output Prodotti nel Trimestre" */
.cdi-detail-section h3 i.fa-chart-line {
    color: #f39c12;
}

/* Responsive per sezioni */
@media (max-width: 768px) {
    .cdi-detail-section {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .cdi-detail-section h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }
}

/* Modal */
.cdi-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.cdi-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.cdi-modal-header {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.cdi-modal-header i {
    font-size: 24px;
}

.cdi-modal-header h3 {
    margin: 0;
    font-size: 20px;
    flex: 1;
}

.cdi-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.cdi-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cdi-modal-content {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.6;
}

.cdi-modal-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e9ecef;
}

.cdi-modal-warning {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cdi-modal-warning i {
    color: #ff9800;
    font-size: 18px;
    margin-top: 2px;
}

.cdi-modal-info {
    background: #e7f3ff;
    border: 1px solid #b3d4fc;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cdi-modal-info i {
    color: #2196f3;
    font-size: 18px;
    margin-top: 2px;
}

/* Loading overlay */
.cdi-loading-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
}

.cdi-loading-spinner {
    text-align: center;
}

.cdi-loading-spinner i {
    color: #0073aa;
    margin-bottom: 15px;
}

.cdi-loading-spinner p {
    color: #666;
    font-size: 14px;
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stili per i pulsanti */
.cdi-btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: 1px solid #dc3545;
    color: white;
}

.cdi-btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    border-color: #bd2130;
    color: white;
}

.cdi-btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    border: 1px solid #4CAF50;
    color: white;
}

.cdi-btn-success:hover {
    background: linear-gradient(135deg, #45a049 0%, #1b5e20 100%);
    border-color: #45a049;
    color: white;
}

.cdi-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* Pulsanti piccoli */
.cdi-btn-small {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    min-width: auto;
}

/* Pulsanti medi */
.cdi-btn-medium {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
}

/* Gruppo pulsanti */
.cdi-action-buttons-small {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

/* Messaggi di notifica */
.cdi-alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.cdi-alert-success i {
    color: #28a745;
    font-size: 20px;
}

/* Tabelle */
.cdi-reports-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cdi-reports-table th {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border: none;
}

.cdi-reports-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.cdi-reports-table tr:last-child td {
    border-bottom: none;
}

.cdi-reports-table tr:hover {
    background: #f8f9fa;
}

.cdi-owner-row {
    background: #f0f9ff;
}

/* Pulsanti azioni */
.cdi-action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.cdi-btn-view {
    background: #17a2b8;
    color: white;
}

.cdi-btn-view:hover {
    background: #138496;
    color: white;
}

/* Stati */
.cdi-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.cdi-status-inviato {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cdi-status-bozza {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Campo errore */
.cdi-field-error {
    border-color: #dc3545 !important;
    background: #fff5f5 !important;
}

/* Animazioni */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ultimo report */
.cdi-latest-report {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.cdi-report-summary {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cdi-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.cdi-summary-item {
    display: flex;
    flex-direction: column;
}

.cdi-summary-item label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 600;
}

.cdi-summary-item span {
    font-size: 14px;
    color: #212529;
    font-weight: 500;
}

/* Pulsanti azioni nell'header */
.cdi-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cdi-action-buttons-small {
    display: flex;
    gap: 5px;
}

/* Stato badge migliorato */
.cdi-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cdi-status-inviato {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #28a745;
}

.cdi-status-bozza {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffc107;
}

/* Periodo report nel titolo */
.cdi-report-period {
    font-size: 16px;
    color: #6c757d;
    font-weight: normal;
    margin-left: 10px;
}

/* Alert successo con animazione */
.cdi-alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulsante view */
.cdi-btn-view {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border: 1px solid #17a2b8;
    color: white;
}

.cdi-btn-view:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    border-color: #138496;
    color: white;
}

/* Tabella responsive */
.cdi-reports-table-container {
    overflow-x: auto;
    margin: 20px 0;
}

.cdi-reports-table {
    min-width: 800px;
}

/* Stato vuoto */
.cdi-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.cdi-empty-state i {
    font-size: 60px;
    color: #dee2e6;
    margin-bottom: 20px;
}

.cdi-empty-state h3 {
    color: #6c757d;
    margin-bottom: 10px;
}

.cdi-empty-state p {
    margin-bottom: 20px;
}

/* Test area per admin */
.cdi-test-area {
    background: #fff3cd;
    padding: 15px;
    margin: 20px 0;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
}

.cdi-test-area h4 {
    color: #856404;
    margin-top: 0;
}

.cdi-test-area ul {
    margin: 10px 0;
    padding-left: 20px;
}

.cdi-test-area li {
    margin-bottom: 5px;
    font-family: monospace;
    font-size: 12px;
}

.cdi-test-area a.test-link {
    background: #dc3545;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    margin: 10px 0;
}

.cdi-test-area a.test-link:hover {
    background: #c82333;
}

/* ============================================
   NUOVE REGOLE CSS PER AJAX E SICUREZZA
   ============================================ */

/* Stili per pulsanti AJAX */
.cdi-delete-report-btn {
    transition: all 0.3s ease;
}

.cdi-delete-report-btn:hover {
    background-color: #dc3545 !important;
    transform: translateY(-1px);
}

.cdi-delete-report-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Overlay per caricamento AJAX */
.cdi-ajax-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.cdi-ajax-loading.active {
    display: flex;
}

.cdi-ajax-loading-spinner {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cdi-ajax-loading-spinner i {
    font-size: 32px;
    color: #0073aa;
    margin-bottom: 10px;
    display: block;
}

/* Gradiente per contenuti lunghi */
.cdi-content-fade {
    height: 40px;
    background: linear-gradient(to bottom, transparent, white);
    margin-top: -40px;
    position: relative;
    z-index: 1;
}

/* Stili per form legacy */
form.cdi-legacy-delete-form {
    display: inline;
}

/* Stati vuoti */
.cdi-empty-state {
    text-align: center;
    padding: 50px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.cdi-empty-state i {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 20px;
}

.cdi-empty-state h3 {
    color: #343a40;
    margin-bottom: 10px;
}

.cdi-empty-state p {
    color: #6c757d;
    margin-bottom: 25px;
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cdi-alert {
    animation: fadeInUp 0.3s ease;
}

/* Responsive per tabelle */
@media (max-width: 768px) {
    .cdi-action-buttons-small {
        display: flex;
        flex-wrap: nowrap;
    }
    
    .cdi-action-buttons-small .cdi-btn-small {
        padding: 4px 8px;
        font-size: 12px;
        min-width: 36px;
    }
    
    .cdi-action-buttons-small .cdi-btn-small i {
        margin-right: 0;
    }
}

/* Stili per messaggi di conferma */
.cdi-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.cdi-confirm-dialog {
    background: white;
    border-radius: 8px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.3s ease;
}

.cdi-confirm-dialog h4 {
    margin-top: 0;
    color: #343a40;
    font-size: 18px;
}

.cdi-confirm-dialog p {
    color: #6c757d;
    margin-bottom: 20px;
}

.cdi-confirm-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   CORREZIONI PER MENU A TENDINA
   ============================================ */

/* Reset stili default browser */
.cdi-view-value select,
.cdi-periodo-select,
.cdi-report-form select {
    width: 100%;
    max-width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    height: 45px;
}

/* Freccia personalizzata */
.cdi-view-value select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23495057' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
}

/* Allineamento testo */
.cdi-view-value select option {
    padding: 10px 15px;
    line-height: 1.5;
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    min-height: 40px;
}

/* Per risolvere problemi di centratura specifici */
.cdi-view-value select {
    text-align: left;
    text-align-last: left; /* Firefox */
}

/* WebKit browsers (Chrome, Safari, Edge) */
.cdi-view-value select::-webkit-list-box,
.cdi-view-value select::-webkit-dropdown-menu,
.cdi-view-value select::-webkit-select-menu {
    text-align: left;
}

.cdi-view-value select::-webkit-select-placeholder {
    text-align: left;
}

/* Per la selezione trimestrale */
#cdi_periodo_trimestrale,
.cdi-periodo-select {
    font-weight: 500;
    border-color: #0b3a6f;
}

/* Campi in sola lettura */
.cdi-readonly-field {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: left;
    cursor: not-allowed;
    box-sizing: border-box;
    height: 45px;
}

/* Layout grid migliorato */
.cdi-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.cdi-view-item {
    display: flex;
    flex-direction: column;
}

.cdi-view-item label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #343a40;
    font-size: 14px;
}

.cdi-view-value {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Hover e focus states */
.cdi-view-value select:focus {
    border-color: #0b3a6f;
    box-shadow: 0 0 0 0.2rem rgba(11, 58, 111, 0.25);
    outline: 0;
}

.cdi-view-value select:hover:not(:disabled) {
    border-color: #6c757d;
}

/* Disabilitato */
.cdi-view-value select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Per campi piccoli nelle tabelle */
.cdi-action-buttons-small select {
    height: 32px;
    padding: 5px 10px;
    font-size: 13px;
    max-width: 150px;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px;
}

/* ============================================
   CORREZIONI SPECIFICHE PER FORM REPORT
   ============================================ */

#cdiReportForm .cdi-view-value select {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Per i campi con placeholder */
#cdi_periodo_trimestrale option[value=""] {
    color: #6c757d;
    font-style: italic;
}

/* Per i campi dati progetto */
.cdi-detail-section .cdi-view-value input.cdi-readonly-field {
    font-weight: 600;
    color: #0b3a6f;
}

/* ============================================
   CORREZIONI RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .cdi-view-value select,
    .cdi-periodo-select {
        height: 40px;
        padding: 8px 12px;
        font-size: 13px;
        background-position: right 12px center;
        padding-right: 35px;
    }
    
    .cdi-readonly-field {
        height: 40px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .cdi-view-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ============================================
   CORREZIONE ULTIMA SPERANZA
   ============================================ */

/* Forza l'allineamento su tutti i browser */
select {
    text-indent: 0.01px;
    text-overflow: '';
}

/* Rimuove il padding nativo di Firefox */
@-moz-document url-prefix() {
    .cdi-view-value select {
        text-indent: 0;
        padding-left: 15px;
    }
    
    .cdi-view-value select option {
        padding-left: 15px;
    }
}

/* Per iOS Safari */
@supports (-webkit-touch-callout: none) {
    .cdi-view-value select {
        padding-left: 15px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

