/* Spello Animations */

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

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

@keyframes slideUp {
    from {
        transform: translateY(20px);
    }
    to {
        transform: translateY(0);
    }
}

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

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

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

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

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(0, 212, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 12px rgba(0, 212, 255, 0.5), 0 0 20px rgba(0, 212, 255, 0.2);
    }
}

@keyframes glow-cycle {
    0%, 100% {
        box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
    }
    33% {
        box-shadow: 0 0 8px rgba(187, 68, 255, 0.4);
    }
    66% {
        box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
    }
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes star-burst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes level-up {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.3);
        filter: brightness(1.5);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes xp-gain {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px) scale(1.2);
        opacity: 0;
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease forwards;
}

.animate-slide-up {
    animation: slideUp var(--transition-normal) ease forwards;
}

.animate-slide-down {
    animation: slideDown var(--transition-normal) ease forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-normal) ease forwards;
}

.animate-slide-in-left {
    animation: slideInLeft var(--transition-normal) ease forwards;
}

.animate-scale-in {
    animation: scaleIn var(--transition-bounce) forwards;
}

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

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

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

.animate-wiggle {
    animation: wiggle 0.5s ease;
}

.animate-pop {
    animation: pop 0.3s ease;
}

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

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

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

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

/* Mascot Animations */
.mascot-idle {
    animation: float 3s ease-in-out infinite;
}

.mascot-happy {
    animation: bounce 0.5s ease;
}

.mascot-thinking {
    animation: wiggle 2s ease-in-out infinite;
}

.mascot-excited {
    animation: pop 0.3s ease, wiggle 0.3s ease 0.3s;
}

.mascot-sad {
    animation: shake 0.5s ease;
    filter: grayscale(0.3);
}

/* Success Celebration */
.celebrate {
    animation: pop 0.3s ease;
}

.celebrate-big {
    animation: level-up 0.6s ease;
}

/* XP Gain Animation */
.xp-float {
    position: absolute;
    pointer-events: none;
    font-weight: bold;
    color: var(--color-xp);
    animation: xp-gain 1s ease forwards;
}

/* Confetti Piece */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease forwards;
}

/* Star Burst */
.star-burst {
    position: absolute;
    font-size: 24px;
    animation: star-burst 0.6s ease forwards;
}

/* Streak Fire Animation */
.streak-fire {
    animation: pulse 0.5s ease infinite, float 1s ease-in-out infinite;
}

/* Level Up Screen */
.level-up-display {
    animation: scaleIn 0.5s ease forwards;
}

.level-up-number {
    animation: level-up 0.6s ease;
}

/* Screen Transitions */
.screen-enter {
    animation: slideInRight var(--transition-normal) ease forwards;
}

.screen-exit {
    animation: fadeOut var(--transition-fast) ease forwards;
}

/* Button Press Effect */
.btn:active {
    animation: pop 0.15s ease;
}

/* Correct Answer Effect */
.correct-effect {
    animation: pop 0.3s ease, glow-cycle 1s ease;
}

/* Wrong Answer Effect */
.wrong-effect {
    animation: shake 0.5s ease;
}

/* Badge Unlock */
.badge-unlock {
    animation: scaleIn 0.5s ease forwards, glow-cycle 2s ease-in-out 0.5s infinite;
}

/* Staggered List Animation */
.stagger-item {
    animation: slideUp var(--transition-normal) ease both;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

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