/* Phase 5: Animation Utilities */

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide in from bottom */
.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* Slide in from right */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

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

/* Pulse animation */
.pulse {
    animation: pulse 0.6s ease-in-out;
}

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

/* Bounce animation */
.bounce {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-5px);
    }
}

/* Shimmer/loading animation */
.shimmer {
    background: linear-gradient(90deg, 
        var(--mud-palette-background-grey) 25%, 
        var(--mud-palette-action-disabled-background) 50%, 
        var(--mud-palette-background-grey) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Score update flash */
.score-flash-positive {
    animation: flashPositive 0.5s ease-out;
}

.score-flash-negative {
    animation: flashNegative 0.5s ease-out;
}

@keyframes flashPositive {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(76, 175, 80, 0.3);
    }
}

@keyframes flashNegative {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(244, 67, 54, 0.3);
    }
}

/* Spin animation */
.spin {
    animation: spin 1s linear infinite;
}

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

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease;
}

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

/* Scale up on hover */
.scale-hover {
    transition: transform 0.2s ease;
}

.scale-hover:hover {
    transform: scale(1.02);
}

/* Success checkmark animation */
.success-checkmark {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Rotate animation */
.rotate-90 {
    animation: rotate90 0.3s ease;
}

@keyframes rotate90 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(90deg);
    }
}

/* Reduce motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Smooth transitions */
.smooth-transition {
    transition: all 0.3s ease;
}

/* Expand/collapse animation */
.expand {
    animation: expand 0.3s ease-out;
    overflow: hidden;
}

@keyframes expand {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 1000px;
        opacity: 1;
    }
}

.collapse {
    animation: collapse 0.3s ease-in;
    overflow: hidden;
}

@keyframes collapse {
    from {
        max-height: 1000px;
        opacity: 1;
    }
    to {
        max-height: 0;
        opacity: 0;
    }
}
