/* Componenti riutilizzabili: bottoni, badge, alert, card, tab, ecc. */

/* === BOTTONI UNIFICATI === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem; /* 10px 20px */
    font-size: 0.9375rem; /* 15px */
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden; /* Per effetto ripple/shine */
    white-space: nowrap;
    gap: 0.5rem; /* Spazio tra icona e testo */
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}
.btn:disabled, .btn.disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.btn svg { /* Stile per icone SVG dentro i bottoni */
    width: 1em; /* Relativo al font-size del bottone */
    height: 1em;
    vertical-align: middle; /* Miglior allineamento */
}

/* Varianti colore bottoni */
.btn-primary { background-color: var(--primary-color); color: var(--text-white); border-color: var(--primary-color); }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary { background-color: var(--secondary-color); color: var(--text-white); border-color: var(--secondary-color); }
.btn-secondary:hover:not(:disabled) { background-color: color-mix(in srgb, var(--secondary-color) 85%, black); border-color: color-mix(in srgb, var(--secondary-color) 85%, black); }

.btn-success { background-color: var(--success); color: var(--text-white); border-color: var(--success); }
.btn-success:hover:not(:disabled) { background-color: color-mix(in srgb, var(--success) 85%, black); border-color: color-mix(in srgb, var(--success) 85%, black); }

.btn-danger { background-color: var(--danger); color: var(--text-white); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background-color: color-mix(in srgb, var(--danger) 85%, black); border-color: color-mix(in srgb, var(--danger) 85%, black); }

.btn-warning { background-color: var(--warning); color: var(--text-primary); border-color: var(--warning); } /* Testo scuro per contrasto */
.btn-warning:hover:not(:disabled) { background-color: color-mix(in srgb, var(--warning) 85%, black); border-color: color-mix(in srgb, var(--warning) 85%, black); }

.btn-info { background-color: var(--info); color: var(--text-white); border-color: var(--info); }
.btn-info:hover:not(:disabled) { background-color: color-mix(in srgb, var(--info) 85%, black); border-color: color-mix(in srgb, var(--info) 85%, black); }

/* Bottoni Outline */
.btn-outline-primary { color: var(--primary-color); border-color: var(--primary-color); background-color: transparent; }
.btn-outline-primary:hover:not(:disabled) { background-color: var(--primary-color); color: var(--text-white); }
/* Aggiungere altre varianti outline se necessario */
.btn-outline-secondary { color: var(--secondary-color); border-color: var(--secondary-color); background-color: transparent; }
.btn-outline-secondary:hover:not(:disabled) { background-color: var(--secondary-color); color: var(--text-white); }

/* Dimensioni bottoni */
.btn-sm { padding: 0.375rem 0.75rem; /* 6px 12px */ font-size: 0.8125rem; /* 13px */ border-radius: var(--border-radius-sm); }
.btn-lg { padding: 0.875rem 1.75rem; /* 14px 28px */ font-size: 1.0625rem; /* 17px */ }

/* === BADGE E STATI === */
.badge {
    display: inline-block;
    padding: 0.3em 0.6em; /* Spaziatura relativa al font-size */
    font-size: 0.8em; /* Più piccolo del testo normale */
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--border-radius-sm);
    color: var(--text-white); /* Default per la maggior parte dei badge */
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* === PHOTO GALLERY SYSTEM === */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    padding: 0;
}

/* Versione thumbnail per le pagine di dettaglio - Stili più forti */
.photo-gallery.thumbnail-mode {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 0.75rem !important;
}

/* Force thumbnail sizing to be more evident */
.photo-gallery.thumbnail-mode .photo-item {
    border-radius: var(--border-radius);
    cursor: pointer !important;
    max-width: 150px !important; /* Forza dimensione massima */
}

/* Ensure thumbnails are small and uniform - Stili più forti */
.photo-gallery.thumbnail-mode .photo-item img {
    height: 80px !important;
    max-height: 80px !important;
    min-height: 80px !important;
    object-fit: cover !important;
    width: 100% !important;
    display: block !important;
}

/* Stili aggiuntivi per garantire il funzionamento */
body .detail-view .photo-gallery.thumbnail-mode .photo-item img {
    height: 80px !important;
    max-height: 80px !important;
    min-height: 80px !important;
    object-fit: cover !important;
    width: 100% !important;
}

.photo-item {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-fast);
    border: 1px solid var(--bg-tertiary);
}

/* Stili specifici per thumbnail già integrati sopra */

.photo-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.photo-item a {
    display: block;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    transition: var(--transition-fast);
    display: block;
    border-radius: 0;
}

/* Thumbnail dimensions handled above in thumbnail-mode section */

.photo-item a:hover img {
    transform: scale(1.05);
}

.photo-item p {
    padding: 0.75rem;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Padding ridotto per thumbnail */
.photo-gallery.thumbnail-mode .photo-item p {
    padding: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.3;
}

.photo-item small {
    padding: 0 0.75rem 0.75rem;
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.photo-gallery.thumbnail-mode .photo-item small {
    padding: 0 0.5rem 0.5rem;
    font-size: 0.7rem;
}

/* Responsive per schermi piccoli */
@media (max-width: 768px) {
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }
    .photo-item img {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .photo-gallery {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .photo-item img {
        max-height: 100px;
    }
    .photo-item p {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    .photo-item small {
        padding: 0 0.5rem 0.5rem;
    }
}

/* Style per foto nei form (fotografie esistenti) */
.photo-item.form-photo {
    position: relative;
}

.foto-delete-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.foto-delete-label:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.foto-delete-text {
    user-select: none;
}

/* Stili specifici per form ODS (compatibilità con stili inline esistenti) */
.photo-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
    margin: 0;
}

.photo-item label:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.photo-item input[type="checkbox"] {
    margin: 0;
    margin-right: 0.5rem;
}

/* Migliori stili per didascalie foto con override degli stili inline */
.photo-item p[style*="font-size:0.8em"] {
    font-size: 0.875rem !important;
    margin-bottom: 0 !important;
    padding: 0.75rem !important;
    line-height: 1.4 !important;
}

/* Zoom indicator per le immagini cliccabili */
.photo-item a::after {
    content: '🔍';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    opacity: 0;
    transition: var(--transition-fast);
    pointer-events: none;
}

.photo-item:hover a::after {
    opacity: 1;
}

/* Fallback per layout quando CSS Grid non è supportato */
@supports not (display: grid) {
    .photo-gallery {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .photo-item {
        flex: 0 1 calc(25% - 0.75rem);
        min-width: 200px;
    }
}

/* Loading state per immagini */
.photo-item img {
    background: var(--bg-secondary);
    background-image: linear-gradient(45deg, transparent 25%, rgba(255,255,255,.1) 25%, rgba(255,255,255,.1) 75%, transparent 75%, transparent),
                      linear-gradient(45deg, transparent 25%, rgba(255,255,255,.1) 25%, rgba(255,255,255,.1) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* === LIGHTBOX MODAL SYSTEM === */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
    box-sizing: border-box;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.lightbox-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.lightbox-info {
    padding: 1rem;
    background: var(--bg-card);
    border-top: 1px solid var(--bg-tertiary);
}

.lightbox-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}

.lightbox-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition-fast);
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.lightbox-navigation {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition-fast);
    z-index: 10001;
}

.lightbox-navigation:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

/* Hide navigation when there's only one image */
.lightbox-modal[data-total="1"] .lightbox-navigation {
    display: none;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .lightbox-modal {
        padding: 1rem;
    }
    
    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .lightbox-image {
        max-height: 70vh;
    }
    
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 35px;
        height: 35px;
    }
    
    .lightbox-navigation {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-prev {
        left: 0.5rem;
    }
    
    .lightbox-next {
        right: 0.5rem;
    }
}

/* === ALERT SYSTEM === */
.alert {
    padding: 1rem 1.25rem; /* 16px 20px */
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem; /* 20px */
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start; /* Allinea icona e testo in alto */
    gap: 0.75rem; /* 12px */
    box-shadow: var(--shadow-sm);
}
.alert-icon {
    font-size: 1.25rem; /* 20px */
    flex-shrink: 0; /* Non si restringe */
    line-height: 1.4; /* Per allineare meglio con il testo */
}
.alert-content {
    flex-grow: 1;
}
.alert-message {
    margin: 0;
    line-height: 1.5;
    font-size: 0.9375rem; /* 15px */
}
.alert-dismissible { /* Per alert con pulsante chiusura */
    position: relative;
    padding-right: 3rem; /* Spazio per il pulsante */
}
.alert .btn-close { /* Pulsante chiusura alert */
    position: absolute;
    top: 0.75rem; /* 12px */
    right: 1rem; /* 16px */
    background: none;
    border: none;
    padding: 0.25rem; /* 4px */
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition-fast);
    color: inherit; /* Eredita colore dal parent alert */
}
.alert .btn-close:hover { opacity: 1; transform: scale(1.1); }
.alert .btn-close svg { width: 18px; height: 18px; }

/* Varianti colore Alert */
.alert-success { background-color: var(--success-light); border-color: color-mix(in srgb, var(--success) 40%, transparent); color: color-mix(in srgb, var(--success) 80%, black); }
.alert-danger  { background-color: var(--danger-light);  border-color: color-mix(in srgb, var(--danger) 40%, transparent);  color: color-mix(in srgb, var(--danger) 80%, black); }
.alert-warning { background-color: var(--warning-light); border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: color-mix(in srgb, var(--warning) 80%, black); }
.alert-info    { background-color: var(--info-light);    border-color: color-mix(in srgb, var(--info) 40%, transparent);    color: color-mix(in srgb, var(--info) 80%, black); }

/* === CARDS === */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--bg-tertiary);
    margin-bottom: 1.5rem; /* Spazio standard sotto le card */
    overflow: hidden; /* Per angoli arrotondati su header/footer */
    height: 100%; /* Occupa tutta l'altezza della cella */
}
.card-header {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem; /* 16px 20px */
    border-bottom: 1px solid var(--bg-tertiary);
    font-weight: 600;
    font-size: 1.125rem; /* 18px */
    color: var(--text-primary);
}
.card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6 {
    margin-bottom: 0; /* Rimuove margine dai titoli nell'header card */
}
.card-body {
    padding: 1.25rem; /* 20px */
}
.card-footer {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem; /* 16px 20px */
    border-top: 1px solid var(--bg-tertiary);
}

/* === TABS (Mantenendo stile moderno da impostazioni.html come base) === */
.modern-tabs { /* Classe usata in impostazioni.html */
    margin-bottom: 0;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.tabs-nav { /* Classe usata in impostazioni.html */
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--primary-light) var(--bg-tertiary); /* Firefox */
    border-bottom: 1px solid var(--bg-tertiary);
}
.tabs-nav::-webkit-scrollbar { height: 6px; }
.tabs-nav::-webkit-scrollbar-track { background: var(--bg-tertiary); border-radius: 3px; }
.tabs-nav::-webkit-scrollbar-thumb { background-color: var(--primary-light); border-radius: 3px; }

.tab-button { /* Classe usata in impostazioni.html */
    background: transparent;
    border: none;
    padding: 1rem 1.5rem; /* 16px 24px */
    cursor: pointer;
    font-size: 0.9375rem; /* 15px */
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px */
}
.tab-button:hover {
    color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent);
}
.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
    font-weight: 600;
}
.tab-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.modern-tab-content { /* Classe usata in impostazioni.html */
    background: var(--bg-card);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--bg-tertiary);
    border-top: none;
    min-height: 400px; /* Altezza minima per il contenuto dei tab */
}
.tab-panel { /* Classe usata in impostazioni.html */
    display: none;
    padding: 1.5rem; /* 24px */
    animation: fadeInUp 0.3s ease-out;
}
.tab-panel.active {
    display: block;
}

/* === STORICO MODIFICHE TOGGLE === */
.storico-sezione {
    margin-top: 2rem;
}

#toggle-storico-btn {
    transition: all 0.3s ease;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-width: 150px;
}

#toggle-storico-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

#toggle-storico-btn:active {
    transform: translateY(0);
}

#storico-icon {
    transition: transform 0.3s ease;
}

#storico-content {
    overflow: hidden;
    transition: all 0.4s ease;
}

#storico-content.showing {
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === STATISTICS GRID - RESPONSIVE LAYOUT === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 0 0 1.5rem auto; /* Allinea a destra */
    padding: 0;
    width: 100%;
    max-width: none; /* Rimuove limitazione di larghezza */
    box-sizing: border-box;
    justify-content: flex-end; /* Allinea a destra */
}

/* Enhanced desktop layout for larger screens */
@media screen and (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
        max-width: none; /* Rimuove limitazione di larghezza */
        margin: 0 0 2rem auto; /* Allinea a destra */
        justify-items: end; /* Allinea elementi a destra */
    }
}

/* Extra large screens - Controlled spacing */
@media screen and (min-width: 1600px) {
    .stats-grid {
        gap: 2rem;
        max-width: none; /* Rimuove limitazione di larghezza */
    }
}

/* === MOBILE RESPONSIVE BREAKPOINTS (MAINTAINED) === */

/* Force mobile layout on smaller screens */
@media screen and (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
}

@media screen and (max-width: 479px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-xs);
    min-height: 70px;
    max-height: 85px; /* Limita l'altezza massima */
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    height: auto; /* Auto invece di 100% */
}

/* Enhanced desktop stat card styling */
@media screen and (min-width: 1200px) {
    .stat-card {
        padding: 1.25rem 1rem;
        gap: 1rem;
        min-height: 80px;
        max-height: 95px; /* Altezza contenuta */
        border-radius: calc(var(--border-radius-lg) + 2px);
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

/* Enhanced desktop icon styling */
@media screen and (min-width: 1200px) {
    .stat-icon {
        font-size: 1.75rem;
        width: 2.75rem;
        height: 2.75rem;
    }
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.125rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1.2;
}

/* Enhanced desktop text styling */
@media screen and (min-width: 1200px) {
    .stat-number {
        font-size: 1.6rem;
        margin-bottom: 0.25rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
        letter-spacing: 0.05em;
    }
}

/* Tablet optimizations - FORCE 2x2 GRID */
@media screen and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .stat-card {
        padding: 0.75rem !important;
        gap: 0.5rem !important;
        min-height: 60px !important;
        flex-direction: row !important;
        text-align: left !important;
    }
    
    .stat-icon {
        font-size: 1.5rem !important;
        width: 2rem !important;
        height: 2rem !important;
        flex-shrink: 0 !important;
    }
    
    .stat-number {
        font-size: 1.25rem !important;
        font-weight: 700 !important;
    }
    
    .stat-label {
        font-size: 0.75rem !important;
        font-weight: 500 !important;
    }
}

/* Compact mode for mobile phones - FORCE 2x2 COMPACT */
@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .stat-card {
        flex-direction: column !important;
        text-align: center !important;
        padding: 0.625rem 0.5rem !important;
        gap: 0.25rem !important;
        min-height: 65px !important;
    }
    
    .stat-icon {
        font-size: 1.125rem !important;
        width: 1.5rem !important;
        height: 1.5rem !important;
        margin: 0 auto 0.125rem auto !important;
    }
    
    .stat-number {
        font-size: 1rem !important;
        font-weight: 800 !important;
        margin-bottom: 0 !important;
    }
    
    .stat-label {
        font-size: 0.625rem !important;
        line-height: 1.1 !important;
        font-weight: 600 !important;
    }
}

/* Ultra-compact mode for very small screens */
@media (max-width: 360px) {
    .stats-grid {
        gap: 0.375rem;
    }
    
    .stat-card {
        padding: 0.5rem 0.375rem;
        min-height: 55px;
    }
    
    .stat-icon {
        font-size: 1rem;
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .stat-number {
        font-size: 0.875rem;
    }
    
    .stat-label {
        font-size: 0.5625rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 640px) and (max-height: 480px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.375rem;
        margin-bottom: 0.75rem;
    }
    
    .stat-card {
        padding: 0.375rem;
        min-height: 45px;
        flex-direction: row;
        text-align: left;
        gap: 0.25rem;
    }
    
    .stat-icon {
        font-size: 0.875rem;
        width: 1rem;
        height: 1rem;
        margin: 0;
    }
    
    .stat-number {
        font-size: 0.8125rem;
    }
    
    .stat-label {
        font-size: 0.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .stat-card {
        background: var(--bg-secondary);
        border-color: var(--bg-tertiary);
    }
    
    .stat-icon {
        background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .stat-card {
        border-width: 2px;
        border-color: var(--text-primary);
    }
    
    .stat-icon {
        border: 2px solid var(--text-primary);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .stat-card,
    .stat-card::before {
        transition: none;
    }
    
    .stat-card:hover {
        transform: none;
    }
}

/* === BADGE MODERNI === */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px; /* Completamente arrotondato */
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.modern-badge {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 12px;
    font-weight: 500;
    letter-spacing: 0.025em;
    display: inline-block !important;
    text-align: center !important;
    white-space: nowrap !important;
}

/* === BADGE URGENZA === */
.urgenza_basso, .badge.urgenza_basso {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #34d399 !important;
}

.urgenza_medio, .badge.urgenza_medio {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #f59e0b !important;
}

.urgenza_alto, .badge.urgenza_alto {
    background-color: #fed7aa !important;
    color: #c2410c !important;
    border: 1px solid #fb923c !important;
}

.urgenza_critico, .badge.urgenza_critico {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #f87171 !important;
}

/* === BADGE STATO SEGNALAZIONI === */
.stato_aperta, .badge.stato_aperta {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #60a5fa !important;
}

.stato_in_valutazione, .badge.stato_in_valutazione {
    background-color: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #8b5cf6 !important;
}

.stato_approvata_per_ods, .badge.stato_approvata_per_ods {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #34d399 !important;
}

.stato_respinta, .badge.stato_respinta {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #f87171 !important;
}

.stato_risolta_senza_ods, .badge.stato_risolta_senza_ods {
    background-color: #ecfdf5 !important;
    color: #047857 !important;
    border: 1px solid #10b981 !important;
}

.stato_chiusa, .badge.stato_chiusa {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #9ca3af !important;
}

/* === BADGE STATO ODS === */
.stato_creato {
    background-color: #fef9c3;
    color: #92400e;
    border: 1px solid #fde68a;
}

.stato_assegnato {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}

.stato_in_lavorazione {
    background-color: #fed7aa;
    color: #c2410c;
    border: 1px solid #fb923c;
}

.stato_sospeso {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #94a3b8;
}

.stato_completato {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.stato_in_verifica {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #8b5cf6;
}

/* === BADGE STATO RELAZIONI TECNICHE === */
.stato_bozza {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #9ca3af;
}

.stato_pubblicata {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

/* === BADGE STATO PREVENTIVI === */
.stato_inviato {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}

.stato_accettato {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.stato_rifiutato {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #f87171;
}

.stato_annullato {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

/* Hover effects per badge interattivi */
.badge:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

/* === MOBILE STATS - OVERRIDE ALL CONFLICTS === */
/* Force 2x2 grid layout on mobile devices */
@media screen and (max-width: 767.98px) {
    .page-header .stats-grid,
    header .stats-grid,
    .modern-header .stats-grid,
    div.stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: auto !important;
        gap: 0.75rem !important;
        width: 100% !important;
        margin-bottom: 1.5rem !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    .page-header .stats-grid .stat-card,
    header .stats-grid .stat-card,
    .modern-header .stats-grid .stat-card,
    div.stats-grid .stat-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        padding: 0.75rem !important;
        gap: 0.5rem !important;
        min-height: 60px !important;
        max-height: none !important;
        width: auto !important;
        box-sizing: border-box !important;
    }
}

/* Ultra compact for very small screens */
@media screen and (max-width: 479.98px) {
    .page-header .stats-grid,
    header .stats-grid,
    .modern-header .stats-grid,
    div.stats-grid {
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .page-header .stats-grid .stat-card,
    header .stats-grid .stat-card,
    .modern-header .stats-grid .stat-card,
    div.stats-grid .stat-card {
        flex-direction: column !important;
        text-align: center !important;
        padding: 0.625rem 0.5rem !important;
        gap: 0.25rem !important;
        min-height: 65px !important;
    }
    
    .page-header .stats-grid .stat-icon,
    header .stats-grid .stat-icon,
    .modern-header .stats-grid .stat-icon,
    div.stats-grid .stat-icon {
        margin: 0 auto 0.125rem auto !important;
        font-size: 1.25rem !important;
        width: 2rem !important;
        height: 2rem !important;
    }
    
    .page-header .stats-grid .stat-number,
    header .stats-grid .stat-number,
    .modern-header .stats-grid .stat-number,
    div.stats-grid .stat-number {
        font-size: 1rem !important;
        font-weight: 700 !important;
        margin-bottom: 0.125rem !important;
    }
    
    .page-header .stats-grid .stat-label,
    header .stats-grid .stat-label,
    .modern-header .stats-grid .stat-label,
    div.stats-grid .stat-label {
        font-size: 0.75rem !important;
        font-weight: 500 !important;
        line-height: 1.2 !important;
    }
}

/* === DASHBOARD COMPONENTS === */

/* Dashboard container base styles */
.dashboard-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    min-height: calc(100vh - var(--header-height));
}

/* Welcome section */
.welcome-section {
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
    color: white;
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 6px 24px rgba(99,102,241,0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.welcome-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.welcome-text h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.welcome-text p {
    font-size: 1.15rem;
    opacity: 0.95;
}

.welcome-actions {
    margin-top: 0.5rem;
}

/* Stats row */
.stats-row.stats-desktop-right {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.5rem;
    width: 600px;
    max-width: 100%;
}

.stat-item {
    background: rgba(255, 255, 255, 0.95);
    color: #312e81;
    border-radius: 1.125rem;
    padding: 2rem 1rem;
    min-width: 140px;
    min-height: 120px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(99,102,241,0.07);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 8px 32px rgba(99,102,241,0.15);
}

.stat-icon {
    font-size: 1.875rem;
    margin-bottom: 0.75rem;
    display: block;
}

.stat-details {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #312e81;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Quick actions */
.quick-actions {
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--bg-tertiary);
}

.quick-actions h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border-radius: 1rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: var(--bg-card);
    border: 1px solid var(--bg-tertiary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.action-card:hover::before {
    transform: scaleX(1);
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    text-decoration: none;
}

.action-card.primary {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    border: none;
}

.action-card.secondary {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border: none;
}

.action-card.info {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    border: none;
}

.action-card.success {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: white;
    border: none;
}

.action-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.action-content {
    flex-grow: 1;
}

.action-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: inherit;
}

.action-content p {
    font-size: 0.9375rem;
    margin: 0;
    opacity: 0.9;
    color: inherit;
}

.action-arrow {
    font-size: 1.5rem;
    opacity: 0.7;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.action-card:hover .action-arrow {
    transform: translateX(4px);
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: var(--bg-card);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-link {
    font-size: 0.9375rem;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.card-link:hover {
    color: var(--primary-dark);
    transform: translateX(2px);
}

/* Analytics section */
.analytics-section {
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--bg-tertiary);
}

.analytics-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--bg-tertiary);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.metric-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.metric-icon.success { color: var(--success); }
.metric-icon.warning { color: var(--warning); }
.metric-icon.info { color: var(--info); }
.metric-icon.primary { color: var(--primary-color); }

.metric-content {
    text-align: center;
}

.metric-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.metric-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.metric-trend {
    font-size: 0.8125rem;
    font-weight: 500;
}

.metric-trend.positive {
    color: var(--success);
}

.metric-trend.neutral {
    color: var(--text-muted);
}

/* === CACHE STATUS INDICATOR === */
.cache-status-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    background: var(--bg-card);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    backdrop-filter: blur(10px);
}

/* Cache States */
.cache-status-indicator.cache-active {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.cache-status-indicator.cache-updating {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    animation: pulse-update 2s infinite;
}

.cache-status-indicator.cache-error {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    animation: shake 0.5s ease-in-out;
}

.cache-status-indicator.cache-offline {
    border-color: var(--text-muted);
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.1), rgba(107, 114, 128, 0.05));
}

/* Cache Icon States */
.cache-status-indicator .cache-icon {
    font-size: 20px;
    transition: all 0.3s ease;
}

.cache-status-indicator.cache-active .cache-icon {
    color: var(--success);
}

.cache-status-indicator.cache-updating .cache-icon {
    color: var(--warning);
    animation: spin 2s linear infinite;
}

.cache-status-indicator.cache-error .cache-icon {
    color: var(--danger);
}

.cache-status-indicator.cache-offline .cache-icon {
    color: var(--text-muted);
}

/* Hover Effects */
.cache-status-indicator:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.cache-status-indicator:active {
    transform: scale(0.95);
}

/* Cache Tooltip */
.cache-status-indicator::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 50%;
    left: 60px;
    transform: translateY(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--bg-tertiary);
}

.cache-status-indicator:hover::before {
    opacity: 1;
    visibility: visible;
    left: 65px;
}

/* Cache Update Notification */
.cache-update-notification {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9998;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--info);
    max-width: 300px;
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.3s ease;
}

.cache-update-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.cache-update-notification .notification-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.cache-update-notification .notification-icon {
    color: var(--info);
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.cache-update-notification .notification-text {
    flex: 1;
}

.cache-update-notification .notification-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.cache-update-notification .notification-message {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.cache-update-notification .notification-actions {
    display: flex;
    gap: 0.5rem;
}

.cache-update-notification .btn-notification {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.cache-update-notification .btn-primary {
    background: var(--primary-color);
    color: white;
}

.cache-update-notification .btn-primary:hover {
    background: var(--primary-dark);
}

.cache-update-notification .btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--bg-tertiary);
}

.cache-update-notification .btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* Cache Statistics Badge */
.cache-stats-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.cache-stats-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* Animations */
@keyframes pulse-update {
    0%, 100% {
        transform: scale(1);
        box-shadow: var(--shadow-md);
    }
    50% {
        transform: scale(1.05);
        box-shadow: var(--shadow-lg);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .cache-status-indicator {
        width: 40px;
        height: 40px;
        top: 16px;
        left: 16px;
    }
    
    .cache-status-indicator .cache-icon {
        font-size: 18px;
    }
    
    .cache-status-indicator::before {
        left: 50px;
        font-size: 0.75rem;
    }
    
    .cache-status-indicator:hover::before {
        left: 55px;
    }
    
    .cache-update-notification {
        top: 70px;
        left: 16px;
        right: 16px;
        max-width: none;
    }
    
    .cache-stats-badge {
        width: 18px;
        height: 18px;
        font-size: 0.625rem;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .cache-status-indicator,
    .cache-status-indicator .cache-icon,
    .cache-update-notification,
    .cache-stats-badge {
        animation: none !important;
        transition: none !important;
    }
    
    .cache-status-indicator:hover {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cache-status-indicator {
        border-width: 3px;
    }
    
    .cache-update-notification {
        border: 2px solid var(--text-primary);
    }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .cache-status-indicator {
        background: rgba(31, 41, 55, 0.9);
        backdrop-filter: blur(15px);
    }
    
    .cache-update-notification {
        background: rgba(31, 41, 55, 0.95);
        backdrop-filter: blur(15px);
    }
}

/* === COMBINAZIONI BADGE MODERNI CON URGENZA === */
.modern-badge.urgenza_basso {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #34d399 !important;
}

.modern-badge.urgenza_medio {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #f59e0b !important;
}

.modern-badge.urgenza_alto {
    background-color: #fed7aa !important;
    color: #c2410c !important;
    border: 1px solid #fb923c !important;
}

.modern-badge.urgenza_critico {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #f87171 !important;
}

/* === COMBINAZIONI BADGE MODERNI CON STATO === */
.modern-badge.stato_aperta {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #60a5fa !important;
}

.modern-badge.stato_in_valutazione {
    background-color: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #8b5cf6 !important;
}

.modern-badge.stato_approvata_per_ods {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #34d399 !important;
}

.modern-badge.stato_respinta {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #f87171 !important;
}

.modern-badge.stato_risolta_senza_ods {
    background-color: #ecfdf5 !important;
    color: #047857 !important;
    border: 1px solid #10b981 !important;
}

.modern-badge.stato_chiusa {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #9ca3af !important;
}

/* === REGOLE GENERALI PER ASSICURARE VISIBILITÀ === */
.badge, .modern-badge {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Assicuriamoci che non ci sia colore trasparente o ereditato */
.badge:not([style*="color"]), .modern-badge:not([style*="color"]) {
    color: inherit !important;
}
