/* Animations and Visual Effects */

/* Keyframe Animations */

/* Entrance Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

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

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

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

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

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

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

@keyframes wobble {
    0% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate(-5deg);
    }
    30% {
        transform: translateX(20%) rotate(3deg);
    }
    45% {
        transform: translateX(-15%) rotate(-3deg);
    }
    60% {
        transform: translateX(10%) rotate(2deg);
    }
    75% {
        transform: translateX(-5%) rotate(-1deg);
    }
    100% {
        transform: translateX(0%);
    }
}

/* Glow Animations */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px currentColor;
    }
    50% {
        box-shadow: 0 0 20px currentColor, 0 0 30px currentColor;
    }
}

@keyframes neonGlow {
    0%, 100% {
        text-shadow:
            0 0 5px currentColor,
            0 0 10px currentColor,
            0 0 15px currentColor;
    }
    50% {
        text-shadow:
            0 0 10px currentColor,
            0 0 20px currentColor,
            0 0 30px currentColor,
            0 0 40px currentColor;
    }
}

@keyframes rainbowGlow {
    0% {
        filter: drop-shadow(0 0 10px #ff0080);
    }
    16.67% {
        filter: drop-shadow(0 0 10px #ff8000);
    }
    33.33% {
        filter: drop-shadow(0 0 10px #ffff00);
    }
    50% {
        filter: drop-shadow(0 0 10px #80ff00);
    }
    66.67% {
        filter: drop-shadow(0 0 10px #00ff80);
    }
    83.33% {
        filter: drop-shadow(0 0 10px #0080ff);
    }
    100% {
        filter: drop-shadow(0 0 10px #8000ff);
    }
}

/* Floating Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes hover {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.02);
    }
}

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

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

@keyframes jiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-2deg);
    }
    75% {
        transform: rotate(2deg);
    }
}

/* Blink Animations */
@keyframes blink {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0;
    }
}

@keyframes slowBlink {
    0%, 90%, 100% {
        opacity: 1;
    }
    95% {
        opacity: 0;
    }
}

/* Particle Effects */
@keyframes particleRise {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Special Game Effects */
@keyframes powerUpCollect {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(2) rotate(180deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes damageFlash {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(3) saturate(2);
    }
}

@keyframes criticalHealth {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(180deg);
    }
}

@keyframes levelUp {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    25% {
        transform: scale(1.2);
        opacity: 0.8;
        filter: brightness(2);
    }
    50% {
        transform: scale(1.5);
        opacity: 0.6;
        filter: brightness(3);
    }
    75% {
        transform: scale(1.2);
        opacity: 0.8;
        filter: brightness(2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
}

/* Transition Effects */
@keyframes zoomIn {
    from {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    to {
        transform: scale(0.3);
        opacity: 0;
    }
}

@keyframes flipIn {
    from {
        transform: perspective(400px) rotateY(-90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateY(-10deg);
    }
    70% {
        transform: perspective(400px) rotateY(10deg);
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes flipOut {
    from {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
    30% {
        transform: perspective(400px) rotateY(-15deg);
        opacity: 1;
    }
    to {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
}

/* Utility Animation Classes */
.animate-fadeIn {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slideInFromTop {
    animation: slideInFromTop 0.6s ease-out forwards;
}

.animate-slideInFromBottom {
    animation: slideInFromBottom 0.6s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-glow {
    animation: glowPulse 2s ease-in-out infinite;
}

.animate-blink {
    animation: blink 1s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-15px);
    }
    70% {
        transform: translateY(-7px);
    }
    90% {
        transform: translateY(-3px);
    }
}

/* Animation timing functions */
.ease-in-quad { animation-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53); }
.ease-in-cubic { animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }
.ease-out-quad { animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.ease-out-cubic { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
.ease-in-out-quad { animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955); }
.ease-in-out-cubic { animation-timing-function: cubic-bezier(0.645, 0.045, 0.355, 1); }

/* Animation delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-500 { animation-delay: 0.5s; }
.delay-700 { animation-delay: 0.7s; }
.delay-1000 { animation-delay: 1s; }

/* Animation durations */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.5s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 2s; }

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-pulse,
    .animate-spin,
    .animate-float,
    .animate-glow,
    .animate-blink,
    .animate-bounce {
        animation: none;
    }
}
