/* Animations pour le PDF merger */

/* Animations de base */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(2px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes progress {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Applications des animations */
.pdf-file-item {
    animation: fadeInUp 0.3s ease;
}

.pdf-file-item:nth-child(2n) {
    animation-delay: 0.1s;
}

.pdf-file-item:nth-child(3n) {
    animation-delay: 0.2s;
}

.pdf-merger-container {
    animation: fadeIn 0.5s ease;
}

.upload-sidebar {
    animation: slideInRight 0.4s ease;
}

.instructions-sidebar {
    animation: slideInRight 0.5s ease;
}

.pdf-list-board {
    animation: slideInLeft 0.4s ease;
}

.control-panel {
    animation: fadeInDown 0.3s ease;
}

/* Animations d'interaction */
.pdf-file-item:hover {
    animation: none;
    transition: all 0.3s ease;
}

.upload-trigger:hover {
    animation: pulse 0.6s ease infinite;
}

.button.is-loading::after {
    animation: spin 0.5s linear infinite;
}

/* Animations de drag & drop */
.pdf-file-item.sortable-ghost {
    opacity: 0.4;
    animation: none;
}

.pdf-file-item.sortable-drag {
    animation: shake 0.5s ease;
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
}

.upload-drop-zone.drag-over {
    animation: pulse 1s ease infinite;
}

.trash-zone.drag-over {
    animation: bounce 0.6s ease;
}

/* Animations de notification */
.notification {
    animation: slideInRight 0.3s ease;
}

.notification.fade-out {
    animation: fadeInUp 0.3s ease reverse;
}

/* Animations de progression */
.merge-progress {
    animation: fadeIn 0.3s ease;
}

.progress::-webkit-progress-bar {
    background-color: #ecf0f1;
    border-radius: 4px;
}

.progress::-webkit-progress-value {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress::-moz-progress-bar {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border-radius: 4px;
}

/* Animations de chargement */
@keyframes loadingDots {
    0%, 20% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    80%, 100% {
        opacity: 0;
    }
}

.loading-dots::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Animations d'erreur */
.error-shake {
    animation: shake 0.5s ease;
}

.success-bounce {
    animation: bounce 0.8s ease;
}

/* Transitions personnalisées */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fast-transition {
    transition: all 0.15s ease;
}

.slow-transition {
    transition: all 0.5s ease;
}

/* Animation de suppression */
@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.pdf-file-item.removing {
    animation: slideOutRight 0.3s ease forwards;
}

/* Animation d'ajout */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pdf-file-item.adding {
    animation: scaleIn 0.4s ease;
}

/* Préférences pour les animations réduites */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
