/* ============================================
   🎮 ANIMATIONS & EFFECTS
   Advanced CSS Animations for Kids Game
   ============================================ */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Gentle Float */
@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(2deg);
    }
    50% {
        transform: translateY(-15px) rotate(0deg);
    }
    75% {
        transform: translateY(-8px) rotate(-2deg);
    }
}

/* Wiggle */
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* Pop In */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide Up Fade */
@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Down Fade */
@keyframes slideDownFade {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse Glow */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.4);
    }
}

/* Rainbow Shift */
@keyframes rainbowShift {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

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

/* Heartbeat */
@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); }
}

/* Confetti Fall */
@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Star Burst */
@keyframes starBurst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Bubble Float */
@keyframes bubbleFloat {
    0% {
        transform: translateY(100%) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* Zoom Bounce */
@keyframes zoomBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Rotate 3D */
@keyframes rotate3D {
    0% {
        transform: perspective(500px) rotateY(0deg);
    }
    100% {
        transform: perspective(500px) rotateY(360deg);
    }
}

/* Wave */
@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(14deg);
    }
    40% {
        transform: rotate(-8deg);
    }
    60% {
        transform: rotate(14deg);
    }
    80% {
        transform: rotate(-4deg);
    }
}

/* Jelly */
@keyframes jelly {
    0%, 100% {
        transform: scale(1, 1);
    }
    25% {
        transform: scale(0.95, 1.05);
    }
    50% {
        transform: scale(1.05, 0.95);
    }
    75% {
        transform: scale(0.95, 1.05);
    }
}

/* Swing */
@keyframes swing {
    0%, 100% {
        transform: rotate(0deg);
        transform-origin: top center;
    }
    25% {
        transform: rotate(15deg);
    }
    50% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Fade In Scale */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */

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

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

.animate-pop {
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-slide-up {
    animation: slideUpFade 0.6s ease-out forwards;
}

.animate-slide-down {
    animation: slideDownFade 0.6s ease-out forwards;
}

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

.animate-rainbow {
    animation: rainbowShift 5s linear infinite;
}

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

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

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

.animate-zoom-bounce {
    animation: zoomBounce 0.6s ease-out forwards;
}

.animate-wave {
    animation: wave 2.5s ease-in-out infinite;
}

.animate-jelly {
    animation: jelly 0.8s ease-in-out;
}

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

.animate-fade-in-scale {
    animation: fadeInScale 0.4s ease-out forwards;
}

/* ============================================
   TRANSITION CLASSES
   ============================================ */

.transition-all {
    transition: all 0.3s ease;
}

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

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

.transition-bounce {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   HOVER EFFECTS
   ============================================ */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.hover-grow {
    transition: transform 0.3s ease;
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px currentColor;
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(10deg);
}

.hover-shake:hover {
    animation: shake 0.4s ease-in-out;
}

.hover-wiggle:hover {
    animation: wiggle 0.5s ease-in-out;
}

.hover-jelly:hover {
    animation: jelly 0.5s ease-in-out;
}

/* ============================================
   CLICK/TAP EFFECTS
   ============================================ */

.click-shrink:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.click-pop:active {
    animation: popIn 0.3s ease;
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

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

/* ============================================
   CONFETTI ELEMENTS
   ============================================ */

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s linear forwards;
}

.confetti:nth-child(odd) {
    border-radius: 50%;
}

.confetti:nth-child(even) {
    border-radius: 2px;
}

.confetti.red { background: #ff6b6b; }
.confetti.blue { background: #4ecdc4; }
.confetti.yellow { background: #ffe66d; }
.confetti.green { background: #95e1d3; }
.confetti.purple { background: #a66cff; }
.confetti.pink { background: #ff69b4; }
.confetti.orange { background: #ff9f43; }

/* ============================================
   PARTICLE EFFECTS
   ============================================ */

.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

.particle-star {
    background: radial-gradient(circle at 30% 30%, #fff, #ffd700);
    box-shadow: 0 0 10px #ffd700;
}

.particle-bubble {
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.particle-heart {
    background: none;
}

.particle-heart::before {
    content: '❤️';
    font-size: inherit;
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

/* Glow Effect */
.glow {
    position: relative;
}

.glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: inherit;
    filter: blur(15px);
    opacity: 0.5;
    z-index: -1;
    border-radius: inherit;
}

/* Shine Effect */
.shine {
    position: relative;
    overflow: hidden;
}

.shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.shine:hover::before {
    left: 100%;
}

/* Gradient Border */
.gradient-border {
    position: relative;
    background: var(--bg-primary);
    border-radius: 16px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #f5576c);
    border-radius: inherit;
    z-index: -1;
    animation: rotate3D 10s linear infinite;
}

/* ============================================
   STAGGER ANIMATIONS
   ============================================ */

.stagger-children > * {
    opacity: 0;
    animation: slideUpFade 0.5s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children > *:nth-child(10) { animation-delay: 1s; }

/* ============================================
   REDUCED MOTION
   ============================================ */

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