/* Stili unificati per form e visualizzazione documenti - VERSIONE OTTIMIZZATA SENZA DUPLICAZIONI */
:root {
    /* Blue Color Palette */
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #1d4ed8;
    /* --blue-hover: #1e40af; */

    /* Gray Color Palette */
    --primary-gray: #9ca3af;
    --secondary-gray: #f3f3f3;
    --light-gray: #9ca3af;
    --lighter-gray: #d1d5db;
    --dark-gray: #1f2937;
    --darker-gray: #111827;
    --white-gray: #f9fafb;
    --border-gray: #e5e7eb;
    
    /* Supporting Colors */
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
    --neutral-gray: #6b7280;
    
    /* Background and Border Colors */
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-light: #e5e7eb;
    --border-focus: var(--secondary-blue);
    
    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Btns Colors */
    --btn-color: var(--secondary-gray);
    --btn-hover-color: var(--primary-gray);
    
    /* Shadows and Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    /* Transitions */
    --transition-base: all 0.2s ease-in-out;
    --transition-fast: all 0.15s ease-in-out;

    /* === APPLE FONT SYSTEM === */
    --apple-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --apple-font-weight-regular: 400;
    --apple-font-weight-medium: 500;
    --apple-font-weight-semibold: 600;
    --apple-font-weight-bold: 700;
    
    /* === APPLE FONT SIZES === */
    --apple-text-xs: 11px;
    --apple-text-sm: 13px;
    --apple-text-base: 15px;
    --apple-text-lg: 17px;
    --apple-text-xl: 19px;
    --apple-text-2xl: 22px;
    --apple-text-3xl: 28px;
    --apple-text-4xl: 34px;
    
    /* === GERARCHIA Z-INDEX GLOBALE === */
    --modal-backdrop-z: 7000;    /* LIVELLO 8: MODAL E DIALOG PRINCIPALI */
    --modal-z: 7100;             /* LIVELLO 8: MODAL E DIALOG PRINCIPALI */
    --modal-overlay-z: 7200;     /* LIVELLO 8: MODAL E DIALOG PRINCIPALI */
    --dropdown-z: 6000;          /* LIVELLO 7: DROPDOWN E MENU CONTESTUALI */
    --dropdown-menu-z: 6100;     /* LIVELLO 7: DROPDOWN E MENU CONTESTUALI */
    --dropdown-open-z: 6200;     /* LIVELLO 7: DROPDOWN APERTI (MASSIMA PRIORITÀ) */
    --tooltip-z: 5000;           /* LIVELLO 6: TOOLTIP E HOVER CONTENT */
    --fixed-z: 4000;             /* LIVELLO 5: FIXED ELEMENTS */
    --floating-z: 3000;          /* LIVELLO 4: FLOATING ELEMENTS */
    --sticky-z: 2000;            /* LIVELLO 3: STICKY ELEMENTS */
    --overlay-z: 1000;           /* LIVELLO 2: OVERLAY LOCALI */
    --table-row-active-z: 500;   /* LIVELLO 1: RIGA TABELLA ATTIVA */
    --table-container-z: 200;    /* LIVELLO 1: CONTAINER TABELLA */
    --elevated-z: 100;           /* LIVELLO 1: CONTENUTO NORMALE ELEVATO */
    --table-row-z: 10;           /* LIVELLO 0: RIGHE TABELLA */
    --base-z: 1;                 /* LIVELLO 0: ELEMENTI BASE */
}


/* ------------ MODAL E DIALOG FIXES ------------ */
/* Ripristina comportamento normale per dialog nativi */
.modal-backdrop {
    z-index: var(--modal-backdrop-z) ;
}

.modal {
    z-index: var(--modal-z) ;
}

/* Bootstrap modal fixes */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out ;
}

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

/* ------------ CORREZIONI PER MODAL E DIALOG NATIVI ------------ */

/* Assicura che i dialog nativi del browser non vengano interferiti */
* {
    /* Non interferire con i dialog nativi del browser */
    -webkit-user-select: auto ;
    user-select: auto ;
}

/* Correzione per Bootstrap Modal z-index hierarchy */
.modal {
    z-index: var(--modal-z) ;
}

.modal-backdrop {
    z-index: var(--modal-backdrop-z) ;
}

/* Assicura che nessun elemento interferisca con i dialog */
body {
    pointer-events: auto ;
}

/* ------------ FINE CORREZIONI MODAL ------------ */

/* ------------ GERARCHIA Z-INDEX OTTIMIZZATA ------------ */
/*
Gerarchia z-index per garantire il corretto posizionamento degli elementi:

1. Modal e overlay: 1050+ (più alti, coprono tutto)
2. Dropdown Bootstrap: 1030-1040 (sopra il contenuto, sotto i modal)
3. Search select dropdown: 1020 (sotto i dropdown Bootstrap)
4. Elementi UI normali: 1-10 (contenuto normale)

Questa gerarchia previene conflitti tra elementi sovrapposti.
*/

/* Regole aggiuntive per assicurare corretto comportamento dropdown */
.dropdown-menu {
    /* Assicura che i dropdown siano sempre clickabili */
    pointer-events: auto ;
}

.dropdown.show .dropdown-menu {
    /* Assicura visibilità quando attivo */
    opacity: 1 ;
    visibility: visible ;
}

/* ------------ FINE GERARCHIA Z-INDEX ------------ */

/* ------------ MODERN BLUE BUTTON STYLES ------------ */

/* Base modern button styling shared properties */
.btn-filter,
.btn-upload,
.btn-file-select,
.btn-action-add,
.btn-manage {
    display: inline-flex ;
    align-items: center ;
    justify-content: center ;
    gap: 0.5rem ;
    font-weight: 600 ;
    border-radius: var(--radius-md) ;
    transition: var(--transition-base) ;
    box-shadow: var(--shadow-sm) ;
    border: none ;
    cursor: pointer ;
    text-decoration: none ;
    white-space: nowrap ;
    width: auto ; /* Override any width: 100% */
    min-width: auto ;
    padding: 0.625rem 1.25rem ;
    font-size: 0.875rem ;
    line-height: 1.25rem ;
}

/* Filter buttons */
.btn-filter {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue)) ;
    color: white ;
}

.btn-filter:hover {
    background: linear-gradient(135deg, var(--dark-blue), var(--primary-blue)) ;
    transform: translateY(-1px) ;
    box-shadow: var(--shadow-md) ;
    color: white ;
}

/* Upload buttons */
.btn-upload {
    background: linear-gradient(135deg, var(--secondary-blue), var(--light-blue)) ;
    color: white ;
}

.btn-upload:hover {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue)) ;
    transform: translateY(-1px) ;
    box-shadow: var(--shadow-md) ;
    color: white ;
}

/* File selection buttons */
.btn-file-select {
    background: linear-gradient(135deg, var(--light-blue), var(--secondary-blue)) ;
    color: white ;
}

.btn-file-select:hover {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue)) ;
    transform: translateY(-1px) ;
    box-shadow: var(--shadow-md) ;
    color: white ;
}

/* Action add buttons */
.btn-action-add {
    background: linear-gradient(135deg, var(--success-green), #059669) ;
    color: white ;
}

.btn-action-add:hover {
    background: linear-gradient(135deg, #059669, #047857) ;
    transform: translateY(-1px) ;
    box-shadow: var(--shadow-md) ;
    color: white ;
}

/* Manage buttons */
.btn-manage {
    background: linear-gradient(135deg, var(--neutral-gray), #4b5563) ;
    color: white ;
}

.btn-manage:hover {
    background: linear-gradient(135deg, #4b5563, #374151) ;
    transform: translateY(-1px) ;
    box-shadow: var(--shadow-md) ;
    color: white ;
}

/* Override Bootstrap's width constraints */
.btn-filter,
.btn-upload,
.btn-file-select,
.btn-action-add,
.btn-manage {
    width: auto ;
    min-width: auto ;
    max-width: none ;
}

/* Remove w-100 class effects on our buttons */
.btn-filter.w-100,
.btn-upload.w-100,
.btn-file-select.w-100,
.btn-action-add.w-100,
.btn-manage.w-100 {
    width: auto ;
}

/* Small size variants */
.btn-filter.btn-sm,
.btn-upload.btn-sm,
.btn-file-select.btn-sm,
.btn-action-add.btn-sm,
.btn-manage.btn-sm {
    padding: 0.5rem 1rem ;
    font-size: 0.8125rem ;
}

/* Large size variants */
.btn-filter.btn-lg,
.btn-upload.btn-lg,
.btn-file-select.btn-lg,
.btn-action-add.btn-lg,
.btn-manage.btn-lg {
    padding: 0.75rem 1.5rem ;
    font-size: 1rem ;
}

/* Disabled states */
.btn-filter:disabled,
.btn-upload:disabled,
.btn-file-select:disabled,
.btn-action-add:disabled,
.btn-manage:disabled {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db) ;
    color: #9ca3af ;
    cursor: not-allowed ;
    transform: none ;
    box-shadow: none ;
}

/* ------------ STILI GENERALI E RESET ------------ */
* {
    box-sizing: border-box;
}

/* ------------ NOTA: Gli stili base per card, pulsanti, icone sono definiti in form-styles.css ------------ */
/* Questo file contiene solo stili specifici per il visualizzatore documenti e componenti non presenti in form-styles.css */

/* ------------ STILI SPECIFICI PER IL VISUALIZZATORE DOCUMENTI ------------ */

/* Stili specifici per la toolbar del visualizzatore */
.viewer-toolbar {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.toolbar-group:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.zoom-level {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    min-width: 4rem;
    text-align: center;
    font-weight: 500;
    color: #495057;
}

/* toolbar-btn styles moved to toolbar-unified.css */

/* ------------ STILI PER LA PAGINAZIONE ------------ */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
}

.pagination-info {
    font-weight: 500;
    color: #495057;
}

.pagination-info .total-count {
    font-weight: 700;
    color: #007bff;
}

/* ------------ STILI PER LA RICERCA NEL VISUALIZZATORE ------------ */
.search-highlight {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 0.25rem;
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0% { background-color: #ffeb3b; }
    100% { background-color: #fff3cd; }
}

/* ------------ RESPONSIVE PER VISUALIZZATORE ------------ */
@media (max-width: 768px) {
    .viewer-toolbar {
        flex-direction: column;
        text-align: center;
    }
    
    .toolbar-group {
        width: 100%;
        justify-content: center;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
}

.btn-action.action-add:hover {
    background-color: #d1e7dd ;
    border-color: #badbcc ;
}

.btn-action.action-toggle {
    color: #0d6efd;
}

.btn-action.action-toggle:hover {
    background-color: transparent !important;
}

/* Bottoni toggle quadrati con centratura perfetta */
button.btn.btn-action.action-toggle {
    padding: 0 !important;
    display: inline-flex!important;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 0px solid transparent !important;
}

button.btn.btn-action.action-toggle i {
    font-size: 20px;
    line-height: 1;
    margin: 0;
    padding: 0;
    display: block;
}

/* Pulsanti di aggiunta - stile unificato */
.add-array-item-header,
.add-array-item {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%) ;
    border-radius: 20px ;
    border: none ;
    color: white ;
    padding: 0.375rem 0.75rem ;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) ;
}

.btn:hover {
    background-color: #0056b3;
    color: var(--btn-hover-color) !important;
    box-shadow: 0 0.375rem 0.75rem rgba(0, 0, 0, 0.12);
    transform: translateY(-2px) translateZ(0);
}

.btn:hover::before {
    width: 100%;
    height: 100%;
}

.btn:active {
    background-color: #004085;
    transform: scale(0.97) translateZ(0);
    color: var(--btn-hover-color) !important;
}

.array-item-controls .btn.move-up-btn:hover,
.array-item-controls .btn.move-down-btn:hover {
    background-color: #5a6268;
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 0.375rem 0.75rem rgba(108, 117, 125, 0.3);
}

.array-item-controls .btn.move-up-btn:hover::before,
.array-item-controls .btn.move-down-btn:hover::before {
    width: 100%;
    height: 100%;
}

.array-item-controls .btn.move-up-btn:active,
.array-item-controls .btn.move-down-btn:active {
    background-color: #545b62;
    transform: scale(0.95) translateZ(0);
}

.array-item-controls .btn.move-up-btn i,
.array-item-controls .btn.move-down-btn i {
    position: relative;
    z-index: 2;
}

/* Badge nell'array */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 20px;
}

.badge.bg-secondary {
    background-color: #f0f3f6 ;
    color: #5d6672 ;
    transition: all 0.2s ease; /* Transizione fluida */
}

/* Messaggio quando array è vuoto */
.array-items:empty::before {
    content: "Nessun elemento. Fare clic su 'Aggiungi elemento' per iniziare.";
    display: block;
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    border: 1px dashed #dee2e6;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    margin: 0.5rem;
}

/* ------------ STILI PER I FORM ------------ */

/* Form groups */
.form-group {
    margin-bottom: 0.75rem; /* Ridotto da 1rem */
    position: relative;
}

/* Forza le label a essere sempre in verticale */
.form-label {
    display: block;
    margin-bottom: 0.25rem; /* Ridotto per migliorare la compattezza */
    font-weight: 500;
    color: #495057;
    text-align: left; /* Assicura l'allineamento a sinistra */
}

/* Adattamento per griglie dinamiche */
.array-item .form-label {
    position: static; /* Rimuove sticky per evitare layout orizzontale */
    margin-bottom: 0.5rem;
}

/* Stili per validazione - posizionamento fuori dalla casella di testo */
.validation-marker {
    position: absolute;
    top: 50%;
    right: -40px; /* Posizionato a destra del campo */
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
    z-index: 5;
}

/* Quando è all'interno di un input-group, adatta il posizionamento */
.input-group + .validation-marker {
    right: -40px;
    top: calc(50% - 10px);
}

/* Stile specifico per l'icona di errore */
.validation-marker.error {
    color: #dc3545;
    animation: pulse 1.5s infinite;
}

/* Pulsazione per attirare l'attenzione */
@keyframes pulse {
    0% { opacity: 0.7; transform: translateY(-50%) scale(0.95); }
    50% { opacity: 1; transform: translateY(-50%) scale(1.05); }
    100% { opacity: 0.7; transform: translateY(-50%) scale(0.95); }
}

.validation-marker.corrected {
    color: #28a745;
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Stili per campi form */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #dde2e5;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

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

/* Campi con errore */
.form-group.has-error .form-label {
    color: #dc3545;
}

.form-group.has-error .form-control {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
}

/* Campi corretti */
.form-group.corrected .form-control {
    border-color: #198754;
}

.form-group.corrected .form-label {
    color: #198754;
}

/* ---------- UNIFICAZIONE LABEL DATE-RANGE ---------- */
.date-range-label,
.date-range-field label,
.date-range-container label {
    /* stessi valori di .form-label */
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #495057;
    text-align: left;
    /* rimuoviamo differenze precedenti */
    text-transform: none;
    letter-spacing: normal;
    font-size: inherit;
}

/* Assicura che negli ambienti di visualizzazione documenti le label mantengano lo stesso stile */
.document-viewer .date-range-label,
.document-viewer .form-label,
.viewer-container .date-range-label,
.viewer-container .form-label {
    /* forza gli stessi stili anche nel contesto del visualizzatore */
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #495057;
    text-align: left;
}
/* ---------- FINE UNIFICAZIONE ---------- */

/* ------------ STILI PER LA RICERCA ------------ */

/* Input group per ricerca */
.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    margin-bottom: 0px !important; /* Ridotto per ottimizzare lo spazio */
}

.input-group-text.search-icon {
    background: white;
    border: 1px solid #ced4da;
    border-left: none;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    color: #6c757d;
    transition: all 0.2s ease;
}

.input-group-text.search-icon:hover {
    background: #f8f9fa;
    color: #0d47a1;
}

/* Stili per il popup di search-select - LIVELLO 7: DROPDOWN */
.search-select-dropdown {
    position: absolute;
    z-index: var(--dropdown-menu-z); /* 6100 - LIVELLO 7: DROPDOWN E MENU CONTESTUALI */
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

.search-select-dropdown.show {
    display: block;
}

/* --- armonizzazione date-range con single date input --- */
.date-range-container {
    /* niente ombre/bordi: appare come un semplice form-group */
    border: 0 ;
    box-shadow: none ;
    padding: 0 ;
    background: transparent ;
    display: flex;
    flex-direction: column;
}

.date-range-container .card-header {       /* rimosso header legacy */
    display: none ;
}

.date-range-field {
    margin-bottom: 0.75rem;
}

.date-range-field:last-child {
    margin-bottom: 0;
}
/* --- fine armonizzazione --- */

/* ------------ STILI PER ANIMAZIONI ------------ */

/* Animazione per toggle */
.toggle-animation {
    transition: transform 0.3s ease-in-out;
    display: inline-block; /* Assicura che la rotazione funzioni correttamente */
}

/* Animazione per nuovi elementi */
@keyframes highlight-new {
    0% { background-color: rgba(25, 135, 84, 0.1); }
    50% { background-color: rgba(25, 135, 84, 0.2); }
    100% { background-color: transparent; }
}

.array-item.new-item {
    animation: highlight-new 1.5s ease;
}

@keyframes highlight-modified {
    0% { background-color: rgba(13, 110, 253, 0.1); }
    50% { background-color: rgba(13, 110, 253, 0.15); }
    100% { background-color: transparent; }
}

.array-item.modified {
    animation: highlight-modified 1.5s ease;
}

/* Migliora l'animazione di espansione/compressione delle card */
.array-item-content {
    transition: all 0.3s ease-in-out;
    overflow: hidden; /* Assicura che il contenuto non fuoriesca durante la transizione */
}

@keyframes attention-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.form-group.attention {
    animation: attention-pulse 0.5s ease-in-out 2;
    background-color: rgba(220, 53, 69, 0.1); /* Rosso chiaro */
}

/* ------------ STILI PER FEEDBACK E LOADER ------------ */

.feedback-container {
    position: fixed;
    top: 30px;  /* Aumentato da 20px a 30px */
    right: 30px;  /* Aumentato da 20px a 30px */
    z-index: 1060; /* Ridotto da 9999 per non interferire con i modal */
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1055; /* Ridotto da 9998 per non interferire con i modal */
    backdrop-filter: blur(5px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Toast di feedback - Versione migliorata */
.feedback-toast {
    background: white;
    border-radius: 12px;  /* Aumentato da 8px a 12px */
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);  /* Ombra più profonda */
    margin-bottom: 1.5rem;  /* Aumentato da 1rem a 1.5rem */
    overflow: hidden;
    width: 400px;
    animation: slideIn 0.3s ease;
    border-left: 5px solid;  /* Bordo sinistro per tipo */
}

.feedback-toast.feedback-success {
    border-color: #28a745;
}

.feedback-toast.feedback-error {
    border-color: #dc3545;
}

.feedback-content {
    display: flex;
    padding: 1.5rem;  /* Aumentato da 1rem a 1.5rem */
    align-items: flex-start;
}

.feedback-icon {
    flex-shrink: 0;
    width: 32px;  /* Aumentato da 24px a 32px */
    height: 32px;  /* Aumentato da 24px a 32px */
    margin-right: 1.25rem;  /* Aumentato da 1rem a 1.25rem */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.feedback-icon i {
    font-size: 1.5rem;  /* Aumentato da 24px */
}

.feedback-success .feedback-icon i {
    color: #28a745;
}

.feedback-error .feedback-icon i {
    color: #dc3545;
}

.feedback-message {
    flex-grow: 1;
    padding-right: 0.5rem;  /* Aggiunto padding a destra */
}

.feedback-title {
    margin: 0 0 0.75rem 0;  /* Aumentato spazio sotto da 0.5rem a 0.75rem */
    font-size: 1.2rem;  /* Aumentato da 1rem a 1.2rem */
    font-weight: 600;
    color: #333;
    letter-spacing: -0.01rem;
    line-height: 1.4;
}

.feedback-details {
    color: #666;
    font-size: 1rem;  /* Aumentato da 0.9rem a 1rem */
    line-height: 1.6;  /* Aumentato line-height */
}

.feedback-details ul {
    padding-left: 1.5rem;
    margin: 0.75rem 0;
    list-style-type: none;
}

.feedback-details ul li {
    padding: 0.375rem 0;  /* Aggiunto padding verticale per gli elementi della lista */
    margin-bottom: 0.5rem;
}

.feedback-success .feedback-details ul li:before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
    margin-right: 0.75rem;
}

.feedback-close {
    background: none;
    border: none;
    padding: 0.35rem;  /* Aumentato da 0.25rem a 0.35rem */
    cursor: pointer;
    color: #999;
    width: 36px;  /* Aumentato da nessuna dimensione specifica */
    height: 36px;  /* Aumentato da nessuna dimensione specifica */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.feedback-close:hover {
    background-color: rgba(0,0,0,0.05);
    color: #333;
}

.feedback-actions {
    padding: 1.25rem 1.5rem;  /* Aumentato padding */
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;  /* Aggiunto gap tra bottoni */
    background-color: #f8f9fa;
}

.feedback-actions .btn {
    padding: 0.65rem 1.25rem;  /* Aumentato padding del bottone */
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.feedback-actions .btn-primary {
    background: linear-gradient(135deg, #0d47a1, #1976d2);
    border: none;
    color: white;
    box-shadow: 0 2px 5px rgba(13, 71, 161, 0.2);
}

.feedback-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 71, 161, 0.3);
}

/* Effetto di loading per il bottone */
.btn-loading {
    position: relative;
    color: transparent ;
}

.btn-loading:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.5);
    border-left-color: white;
    border-radius: 50%;
    top: calc(50% - 8px);
    left: calc(50% - 8px);
    animation: rotate 1s linear infinite;
}

/* Animazioni per il popup */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(10px);
        opacity: 0;
    }
}

/* Classi per animazioni */
.feedback-toast.showing {
    animation: slideIn 0.5s forwards cubic-bezier(0.23, 1, 0.32, 1);
}

.feedback-toast.hiding {
    animation: slideOut 0.3s forwards cubic-bezier(0.23, 1, 0.32, 1);
}

/* ------------ STILI PER IL VISUALIZZATORE DOCUMENTI ------------ */

.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border-radius: 12px 12px 0 0;
    gap: 1rem;
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 1px;
    background: #f1f5f9;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.5);
    flex-grow: 1;
    border: 1px solid rgba(0,0,0,0.03);
    transition: all 0.2s ease;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: space-evenly;
    align-content: stretch;
}

.toolbar-group:hover {
    background: #edf2f7;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.7);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
}

.zoom-level {
    min-width: 64px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0d47a1;
    user-select: none;
    background: white;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), inset 0 -1px 0 rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.toolbar-btn {
    padding: 0.5rem;
    border: none;
    background: #ffffff;
    color: #3b4252;
    border-radius: 8px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    font-size: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0 -1px 0 rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.toolbar-btn:hover {
    background: #eef2ff;
    color: #0d47a1;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1), inset 0 -2px 0 rgba(0,0,0,0.05);
    border-color: rgba(13, 71, 161, 0.15);
}

.toolbar-btn:active {
    transform: translateY(0);
    background: #e0e7ff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.1s ease;
}

.toolbar-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.25);
}

.document-navigation .toolbar-btn {
    background: #ebf5ff;
    color: #1a56db;
}

.document-navigation .toolbar-btn:hover {
    background: #dbeafe;
    color: #1e40af;
}

/* badge styles moved to toolbar-unified.css */

/* ------------ STILI PER LA PAGINAZIONE ------------ */


.pagination-info {
    background-color: #e9ecef;
    color: #495057;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.pagination-info .total-count {
    color: #0d6efd;
    margin-left: 0.25rem;
    font-weight: 600;
}

/* ------------ STILI PER RESPONSIVENESS ------------ */

@media (max-width: 768px) {
    .pagination-controls {
        /* flex-direction: column; */
        /* align-items: flex-start; */
        /* gap: 0.5rem; */
    }
    
    .page-size-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .pagination-info {
        width: 100%;
        justify-content: center;
    }
}

/* Assicurati che i pulsanti disabilitati siano visivamente distinti */
.btn-action.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Correggi eventuali problemi di overflow durante le transizioni */
.array-card {
    overflow: visible;
}

/* Stili per i commenti */
.field-message {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-message.type-error {
    background-color: rgba(220, 53, 69, 0.1); /* Rosso chiaro */
    color: #dc3545; /* Rosso */
    border: 1px solid #dc3545;
}

.field-message.type-warning {
    background-color: rgba(255, 193, 7, 0.1); /* Giallo chiaro */
    color: #ffc107; /* Giallo */
    border: 1px solid #ffc107;
}

.field-message.type-info {
    background-color: rgba(23, 162, 184, 0.1); /* Azzurro chiaro */
    color: #17a2b8; /* Azzurro */
    border: 1px solid #17a2b8;
}

.field-message.type-checked {
    background-color: rgba(40, 167, 69, 0.1); /* Verde chiaro */
    color: #28a745; /* Verde */
    border: 1px solid #28a745;
}

/* Icone nei commenti */
.field-message i {
    font-size: 1rem;
}

/* Stili per la checkbox moderna */
.modern-checkbox {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.modern-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.modern-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: #f1f1f1;
    border: 3px solid #000; /* Aumentato lo spessore del bordo e mantenuto nero */
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}

.modern-checkbox:hover .checkmark {
    background-color: #e2e8f0;
    border-color: #cbd5e0;
}

.modern-checkbox input:checked ~ .checkmark {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.modern-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modern-checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* ========== MIGLIORAMENTI VISIBILITÀ BOTTONI SU SFONDO BIANCO ========== */

/* Bottoni primari con maggiore visibilità */
.btn-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%) ;
    border: 2px solid #3c65d4 ;
    box-shadow: 0 2px 8px rgba(78, 115, 223, 0.25), 
                0 1px 3px rgba(78, 115, 223, 0.15) ;
    font-weight: 600 ;
    color: white ;
    transition: all 0.2s ease-in-out ;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #007aff) ;
    border-color: #2653d4 ;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3) ;
    transform: translateY(-1px) ;
    color: white ;
}

.btn-primary:active {
    transform: scale(0.98) ;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2) ;
}

/* MODERN TRANSFORM EFFECTS - Ispirato da modern-buttons.css archived */
#applyFiltersBtn,
#resetFiltersBtn,
#manageTaskBtn,
.btn-manage,
.btn-action-add {
    position: relative;
    overflow: hidden;
    
    /* Performance optimization - come sync button */
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    transform: translateZ(0);
    
    /* Enhanced modern transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#applyFiltersBtn:hover,
#resetFiltersBtn:hover,
#manageTaskBtn:hover,
.btn-manage:hover,
.btn-action-add:hover {
    /* Modern lift effect con scale sottile */
    transform: translateY(-3px) scale(1.02) translateZ(0);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4) ;
}

#applyFiltersBtn:active,
#resetFiltersBtn:active,
#manageTaskBtn:active,
.btn-manage:active,
.btn-action-add:active {
    /* Sofisticato scale down con micro-bounce */
    transform: translateY(-1px) scale(0.97) translateZ(0);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ADVANCED RIPPLE EFFECT - Material Design 3.0 Style */
#applyFiltersBtn::after,
#resetFiltersBtn::after,
#manageTaskBtn::after,
.btn-manage::after,
.btn-action-add::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.2) 40%, rgba(255,255,255,0.1) 70%, transparent 100%);
    transform: translate(-50%, -50%);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    filter: blur(2px);
    pointer-events: none;
    z-index: 2;
}

#applyFiltersBtn:hover::after,
#resetFiltersBtn:hover::after,
#manageTaskBtn:hover::after,
.btn-manage:hover::after,
.btn-action-add:hover::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    filter: blur(4px);
}

#applyFiltersBtn:active::after,
#resetFiltersBtn:active::after,
#manageTaskBtn:active::after,
.btn-manage:active::after,
.btn-action-add:active::after {
    width: 350px;
    height: 350px;
    opacity: 0.7;
    filter: blur(6px);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-outline-primary {
    background: rgba(78, 115, 223, 0.05) ;
    border: 2px solid #4e73df ;
    box-shadow: 0 1px 4px rgba(78, 115, 223, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.5) ;
    color: #4e73df ;
    font-weight: 500 ;
    transition: all 0.2s ease-in-out ;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #4e73df 0%, #2e59d9 100%) ;
    border-color: #3c65d4 ;
    box-shadow: 0 3px 8px rgba(78, 115, 223, 0.25) ;
    color: white ;
    transform: translateY(-1px) ;
}

.btn-outline-secondary {
    background: rgba(108, 117, 125, 0.05) ;
    border: 2px solid #6c757d ;
    box-shadow: 0 1px 4px rgba(108, 117, 125, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.5) ;
    color: #6c757d ;
    font-weight: 500 ;
    transition: all 0.2s ease-in-out ;
}

.btn-outline-secondary:hover {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%) ;
    border-color: #545b62 ;
    box-shadow: 0 3px 8px rgba(108, 117, 125, 0.25) ;
    color: white ;
    transform: translateY(-1px) ;
}

.btn-outline-success {
    background: rgba(28, 200, 138, 0.05) ;
    border: 2px solid #1cc88a ;
    box-shadow: 0 1px 4px rgba(28, 200, 138, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.5) ;
    color: #1cc88a ;
    font-weight: 500 ;
    transition: all 0.2s ease-in-out ;
}

.btn-outline-success:hover {
    background: linear-gradient(135deg, #1cc88a 0%, #17a673 100%) ;
    border-color: #169b6b ;
    box-shadow: 0 3px 8px rgba(28, 200, 138, 0.25) ;
    color: white ;
    transform: translateY(-1px) ;
}

.btn-outline-danger {
    background: rgba(231, 74, 59, 0.05) ;
    border: 2px solid #e74a3b ;
    box-shadow: 0 1px 4px rgba(231, 74, 59, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.5) ;
    color: #e74a3b ;
    font-weight: 500 ;
    transition: all 0.2s ease-in-out ;
}

.btn-outline-danger:hover {
    background: linear-gradient(135deg, #e74a3b 0%, #c0392b 100%) ;
    border-color: #bd2130 ;
    box-shadow: 0 3px 8px rgba(231, 74, 59, 0.25) ;
    color: white ;
    transform: translateY(-1px) ;
}

/* Bottoni piccoli con maggiore definizione */
.btn-sm {
    border-width: 1.5px ;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 
                0 1px 2px rgba(0, 0, 0, 0.08) ;
    font-weight: 500 ;
}

.btn-sm:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 
                0 1px 3px rgba(0, 0, 0, 0.1) ;
}

/* Miglioramenti specifici per bottoni su card bianche */
.card .btn, .bg-white .btn, .shadow-sm .btn {
    padding: 5px;
    line-height: 1;
    /* box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 
                0 1px 3px rgba(0, 0, 0, 0.05), 
                inset 0 1px 0 rgba(255, 255, 255, 0.4); */
}

.card .btn:hover, .bg-white .btn:hover, .shadow-sm .btn:hover {
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.12), 
                0 0px 0px rgba(0, 0, 0, 0.08) ;
}

/* Focus migliorato per accessibilità */
.btn:focus {
    outline: none ;
    box-shadow: 0 0 0 0px rgba(78, 115, 223, 0.3) ;
}

.btn-success:focus {
    box-shadow: 0 0 0 3px rgba(28, 200, 138, 0.3) ;
}

.btn-secondary:focus {
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.3) ;
}

/* Bottoni con icone - miglioramenti per la visibilità */
.btn i {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) ;
}

/* Separatori visivi per gruppi di bottoni */
.btn-group .btn {
    border-right-width: 1px ;
}

.btn-group .btn:not(:last-child) {
    border-right-color: rgba(255, 255, 255, 0.3) ;
}

/* Stati disabilitati con maggiore chiarezza */
.btn:disabled,
.btn.disabled {
    background: #f8f9fa ;
    border-color: #dee2e6 ;
    color: #6c757d ;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) ;
    opacity: 0.65 ;
}

.btn:disabled:hover,
.btn.disabled:hover {
    transform: none ;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) ;
}

/* Stili per bottoni icona specifici */
.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #495057;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 
                0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-icon:hover {
    background-color: #e9ecef;
    color: #212529;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 
                0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.btn-icon:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    border-color: #dee2e6;
}

.btn-icon:disabled:hover {
    background-color: #e9ecef;
    color: #6c757d;
    transform: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-icon i {
    font-size: 1rem;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* Badge per il contatore con maggiore visibilità */
.badge-count {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), 
                0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ========== BOTTONI FUNZIONALI UNIFICATI ========== */

/* Bottoni di azione principale (Applica Filtri, Carica, etc.) */
.btn-action-primary {
    background: linear-gradient(135deg, #1cc88a 0%, #17a673 100%) ;
    border: 2px solid #169b6b ;
    color: white ;
    font-weight: 600 ;
    box-shadow: 0 3px 8px rgba(28, 200, 138, 0.3), 
                0 1px 3px rgba(28, 200, 138, 0.2) ;
    transition: all 0.2s ease-in-out ;
    text-transform: uppercase ;
    letter-spacing: 0.5px ;
    font-size: 0.875rem ;
}

.btn-action-primary:hover {
    background: linear-gradient(135deg, #17a673 0%, #149063 100%) ;
    border-color: #138f5a ;
    color: white ;
    box-shadow: 0 5px 15px rgba(28, 200, 138, 0.4), 
                0 3px 8px rgba(28, 200, 138, 0.25) ;
    transform: translateY(-2px) ;
}

.btn-action-primary:active {
    transform: translateY(0) ;
    box-shadow: 0 2px 4px rgba(28, 200, 138, 0.25) ;
}

/* Bottoni di selezione/preparazione (Seleziona File, etc.) */
.btn-action-select {
    background: rgba(78, 115, 223, 0.08) ;
    border: 2px dashed #4e73df ;
    color: #4e73df ;
    font-weight: 500 ;
    box-shadow: 0 2px 6px rgba(78, 115, 223, 0.15), 
                inset 0 1px 0 rgba(255, 255, 255, 0.6) ;
    transition: all 0.2s ease-in-out ;
    border-radius: 8px ;
}

.btn-action-select:hover {
    background: rgba(78, 115, 223, 0.12) ;
    border-color: #2e59d9 ;
    border-style: solid ;
    color: #2e59d9 ;
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.2), 
                inset 0 1px 0 rgba(255, 255, 255, 0.8) ;
    transform: translateY(-1px) ;
}

/* Bottoni di aggiunta/creazione */
.btn-action-add {
    background: linear-gradient(135deg, #fd7e14, #e65100) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(253, 126, 20, 0.3);
}

.btn-action-add:hover {
    background: linear-gradient(135deg, #e65100, #bf360c) ;
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(253, 126, 20, 0.4);
    color: white ;
}

/* Bottone Gestisci Task */
.btn-manage {
    background: linear-gradient(135deg, #6c757d, #495057) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(108, 117, 125, 0.3);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-manage:hover {
    background: linear-gradient(135deg, #495057, #343a40) ;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(108, 117, 125, 0.4);
    color: white ;
    text-decoration: none;
}

/* Assicura che tutti i bottoni non abbiano sfondo bianco di default */
.btn-filter,
.btn-upload,
.btn-file-select,
.btn-action-add,
.btn-manage {
    background-color: transparent ;
}

/* ------------ STILI SPECIFICI PER I BOTTONI DI AZIONE ------------ */

/* Bottone Applica Filtri */
.btn-filter {
    background: linear-gradient(135deg, #28a745, #20c997) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(40, 167, 69, 0.3);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.btn-filter:hover {
    background: linear-gradient(135deg, #20c997, #198754) ;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(40, 167, 69, 0.4);
    color: white ;
}

.btn-filter:active {
    transform: translateY(0);
    box-shadow: 0 0.25rem 0.5rem rgba(40, 167, 69, 0.3);
}

.btn-filter:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

/* Bottone Carica/Upload Documenti */
.btn-upload {
    background: linear-gradient(135deg, #007bff, #0056b3) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 123, 255, 0.3);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.btn-upload:hover {
    background: linear-gradient(135deg, #0056b3, #004085) ;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 123, 255, 0.4);
    color: white ;
}

.btn-upload:active {
    transform: translateY(0);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 123, 255, 0.3);
}

.btn-upload:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.btn-upload:disabled {
    background: linear-gradient(135deg, #94a3b8, #64748b) ;
    cursor: not-allowed ;
    transform: none ;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) ;
    opacity: 0.7 ;
}

/* Bottone per la selezione file */
.btn-file-select {
    background: linear-gradient(135deg, #6f42c1, #5a32a3) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(111, 66, 193, 0.3);
}

.btn-file-select:hover {
    background: linear-gradient(135deg, #5a32a3, #4c2a85) ;
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(111, 66, 193, 0.4);
    color: white ;
}

/* Bottoni di azione per static forms */
.btn-action-add {
    background: linear-gradient(135deg, #fd7e14, #e65100) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(253, 126, 20, 0.3);
}

.btn-action-add:hover {
    background: linear-gradient(135deg, #e65100, #bf360c) ;
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(253, 126, 20, 0.4);
    color: white ;
}

/* Bottone Gestisci Task */
.btn-manage {
    background: linear-gradient(135deg, #6c757d, #495057) ;
    border: none ;
    color: white ;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(108, 117, 125, 0.3);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-manage:hover {
    background: linear-gradient(135deg, #495057, #343a40) ;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(108, 117, 125, 0.4);
    color: white ;
    text-decoration: none;
}

/* ========== SISTEMA BADGE UNIFICATO PER TUTTI I BOTTONI ==================== */

/* 
 * Sistema di badge completamente riscritto per gestire correttamente
 * tutti i tipi di bottoni senza sovrapposizioni o fuoriuscite
 */

/* 1. CONTENITORI BADGE - Assicura che tutti i bottoni possano contenere badge */
.btn,
.btn-icon,
.btn-filter,
.btn-upload,
.btn-file-select,
.btn-action-add,
.btn-manage,
.btn-navigation,
.btn-remove,
.toolbar-btn,
.btn-with-badge,
#massiveDeleteBtn,
#massiveDownloadBtn {
    position: relative;
    overflow: visible; /* Importante: permette ai badge di essere visibili fuori dal bottone */
}

/* 2. STILI BASE BADGE - Applicati a tutti i badge */
.badge-count,
.error-count,
.warning-count,
.info-count,
.success-count {
    /* Posizionamento assoluto */
    position: absolute ;
    top: -10px ;
    right: -10px ;
    
    /* Dimensioni e forma */
    min-width: 20px ;
    height: 20px ;
    padding: 0 6px ;
    border-radius: 10px ;
    
    /* Tipografia */
    font-size: 0.7rem ;
    font-weight: 700 ;
    line-height: 20px ;
    text-align: center ;
    white-space: nowrap ;
    
    /* Layout flex per centrare il contenuto */
    display: none ; /* Nascosto di default */
    align-items: center ;
    justify-content: center ;
    
    /* Effetti visivi */
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.25),
        0 1px 2px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) ;
    border: 1px solid #ffffff ;
    
    /* Impedisce interazioni */
    pointer-events: none ;
    user-select: none ;
    
    /* Transizioni fluide */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) ;
}

/* 3. STATO VISIBILE - Quando il badge deve essere mostrato */
.badge-count.show,
.error-count.show,
.warning-count.show,
.info-count.show,
.success-count.show {
    display: flex ;
    animation: badgeAppear 0.3s ease-out ;
}

/* 4. COLORI SPECIFICI PER TIPO DI BADGE */
.badge-count,
.info-count {
    background: linear-gradient(135deg, #007bff, #0056b3) ;
    color: #ffffff ;
}

.error-count {
    background: linear-gradient(135deg, #dc3545, #bd2130) ;
    color: #ffffff ;
}

.warning-count {
    background: linear-gradient(135deg, #ffc107, #e0a800) ;
    color: #212529 ;
}

.success-count {
    background: linear-gradient(135deg, #28a745, #1e7e34) ;
    color: #ffffff ;
}

/* 5. DIMENSIONI SPECIFICHE PER TIPO DI BOTTONE */

/* Bottoni toolbar - badge più piccoli */
.toolbar-btn .badge-count,
.toolbar-btn .error-count,
.toolbar-btn .warning-count,
.toolbar-btn .info-count,
.toolbar-btn .success-count {
    top: -8px ;
    right: -8px ;
    min-width: 18px ;
    height: 18px ;
    font-size: 0.65rem ;
    line-height: 18px ;
    border-radius: 9px ;
    padding: 0 4px ;
}

/* Bottoni icon - badge medi */
.btn-icon .badge-count,
.btn-icon .error-count,
.btn-icon .warning-count,
.btn-icon .info-count,
.btn-icon .success-count {
    top: -6px ;
    right: -6px ;
    min-width: 16px ;
    height: 16px ;
    font-size: 0.6rem ;
    line-height: 16px ;
    border-radius: 8px ;
    padding: 0 3px ;
}

/* Bottoni normali - badge standard */
.btn:not(.btn-icon):not(.toolbar-btn) .badge-count,
.btn:not(.btn-icon):not(.toolbar-btn) .error-count,
.btn:not(.btn-icon):not(.toolbar-btn) .warning-count,
.btn:not(.btn-icon):not(.toolbar-btn) .info-count,
.btn:not(.btn-icon):not(.toolbar-btn) .success-count {
    top: -10px ;
    right: -10px ;
    min-width: 20px ;
    height: 20px ;
    font-size: 0.7rem ;
    line-height: 20px ;
    border-radius: 10px ;
    padding: 0 6px ;
}

/* 6. STATI SPECIALI DEI BOTTONI CON ERRORI */
.btn.has-errors,
.toolbar-btn.has-errors,
.btn-icon.has-errors {
    border-color: rgba(220, 53, 69, 0.3) ;
}

.btn.has-errors:not(.btn-danger),
.toolbar-btn.has-errors,
.btn-icon.has-errors:not(.btn-danger) {
    background: rgba(220, 53, 69, 0.05) ;
}

.btn.has-errors:hover:not(.btn-danger),
.toolbar-btn.has-errors:hover,
.btn-icon.has-errors:hover:not(.btn-danger) {
    background: rgba(220, 53, 69, 0.1) ;
    border-color: rgba(220, 53, 69, 0.5) ;
}

/* === APPLE FONT SYSTEM TYPOGRAPHY === */
body {
    font-family: var(--apple-font-family);
    font-size: var(--apple-text-base);
    font-weight: var(--apple-font-weight-regular);
    line-height: 1.47;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography hierarchy */
h1 {
    font-size: var(--apple-text-4xl);
    font-weight: var(--apple-font-weight-bold);
    line-height: 1.2;
}

h2 {
    font-size: var(--apple-text-3xl);
    font-weight: var(--apple-font-weight-bold);
    line-height: 1.25;
}

h3 {
    font-size: var(--apple-text-2xl);
    font-weight: var(--apple-font-weight-semibold);
    line-height: 1.3;
}

h4 {
    font-size: var(--apple-text-lg);
    font-weight: var(--apple-font-weight-semibold);
    line-height: 1.35;
}

h5 {
    font-size: var(--apple-text-base);
    font-weight: var(--apple-font-weight-medium);
    line-height: 1.47;
}

/* === H6 CONTEXTUAL STYLING BASED ON SEMANTIC IMPORTANCE === */

/* Base h6 styling (lowest priority) */
h6 {
    font-size: var(--apple-text-sm);
    font-weight: var(--apple-font-weight-medium);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

/* Card headers - Higher importance for main content sections */
.card h6,
.shadow-sm h6,
.bg-white h6,
#scanFilters h6,
#uploadForm h6 {
    font-size: var(--apple-text-base);
    font-weight: var(--apple-font-weight-semibold);
    color: var(--apple-text-primary, #1d1d1f);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scroll-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    text-align: center;
    z-index: 1;
    color: #fff;
    background: rgba(90,92,105,.5);
    line-height: 46px
}