/*
 * Bulk Operations Animations
 * Animazioni e stili per operazioni bulk ottimizzate
 * Creato: 10 Luglio 2025
 */

/* ==================================================================
   ANIMAZIONI NOTIFICHE
   ================================================================== */

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

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

/* ==================================================================
   STILI NOTIFICHE BULK
   ================================================================== */

.bulk-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
    color: white;
    font-size: 14px;
    line-height: 1.4;
}

.bulk-notification-success {
    background: #28a745;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.bulk-notification-error {
    background: #dc3545;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.bulk-notification-info {
    background: #17a2b8;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

/* ==================================================================
   ANIMAZIONI RIGHE TABELLA
   ================================================================== */

/* Stato eliminazione in corso */
.list-table tbody tr.deleting {
    opacity: 0.5;
    transition: opacity 0.3s ease-out;
    background-color: rgba(220, 53, 69, 0.05);
    pointer-events: none;
}

.list-table tbody tr.deleting td {
    text-decoration: line-through;
    color: #999;
}

/* Stato download in corso */
.list-table tbody tr.downloading {
    background-color: rgba(40, 167, 69, 0.1);
    transition: background-color 0.3s ease;
    animation: downloadPulse 2s ease-in-out infinite;
}

@keyframes downloadPulse {
    0%, 100% {
        background-color: rgba(40, 167, 69, 0.1);
    }
    50% {
        background-color: rgba(40, 167, 69, 0.2);
    }
}

.list-table tbody tr.downloading .document-checkbox {
    pointer-events: none;
    opacity: 0.7;
}

/* Animazione rimozione riga */
@keyframes rowSlideOut {
    to {
        transform: translateX(-100%);
        opacity: 0;
        height: 0;
        padding: 0;
        margin: 0;
    }
}

.list-table tbody tr.removing {
    animation: rowSlideOut 0.3s ease-out forwards;
    overflow: hidden;
}

/* ==================================================================
   FEEDBACK VISIVO CHECKBOX
   ================================================================== */

.document-checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.list-table tbody tr.deleting .document-checkbox {
    pointer-events: none;
    opacity: 0.3;
}

/* ==================================================================
   PULSANTI DURANTE OPERAZIONE
   ================================================================== */

.toolbar-btn.loading {
    position: relative;
    color: transparent;
}

.toolbar-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================================================================
   CONTATORI ANIMATI
   ================================================================== */

.documents-info .text-primary {
    transition: all 0.3s ease;
}

.documents-info .text-primary.updating {
    transform: scale(1.2);
    color: #28a745 !important;
}

/* ==================================================================
   MOBILE OPTIMIZATIONS
   ================================================================== */

@media (max-width: 768px) {
    .bulk-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
        padding: 10px 16px;
    }
    
    @keyframes slideIn {
        from {
            transform: translateY(-100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    @keyframes slideOut {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(-100%);
            opacity: 0;
        }
    }
}

/* ==================================================================
   PERFORMANCE - GPU ACCELERATION
   ================================================================== */

.list-table tbody tr {
    will-change: opacity, transform;
}

.bulk-notification {
    will-change: transform, opacity;
}

/* ==================================================================
   DARK MODE SUPPORT
   ================================================================== */

@media (prefers-color-scheme: dark) {
    .list-table tbody tr.deleting {
        background-color: rgba(220, 53, 69, 0.1);
    }
    
    .bulk-notification {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}