/**
 * Quran Quest - Animations
 * Keyframes, transitions, and interactive animations
 */

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

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

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

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

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

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

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

/* Logo Animation */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px); 
    }
    50% { 
        transform: translateY(-20px); 
    }
}

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

/* Loading Animations */
@keyframes spin {
    0% { 
        transform: rotate(0deg); 
    }
    100% { 
        transform: rotate(360deg); 
    }
}

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

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

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

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

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

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--gold);
    }
    50% {
        box-shadow: 0 0 20px var(--gold), 0 0 30px var(--gold);
    }
}

/* Success/Error Animations */
@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes zoomIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.5);
        opacity: 0;
    }
}

/* Gem Collection Animation */
@keyframes gemCollect {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) translateY(-50px);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5) translateY(-100px);
        opacity: 0;
    }
}

@keyframes gemSparkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.8;
    }
    25% {
        transform: scale(1.2) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.1) rotate(180deg);
        opacity: 0.9;
    }
    75% {
        transform: scale(1.3) rotate(270deg);
        opacity: 1;
    }
}

/* Progress Animation */
@keyframes progressFill {
    0% {
        width: 0%;
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

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

/* Text Animations */
@keyframes typewriter {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px var(--gold);
    }
    50% {
        text-shadow: 0 0 20px var(--gold), 0 0 30px var(--gold);
    }
}

@keyframes arabicFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Animations */
@keyframes modalOpen {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalClose {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
}

@keyframes overlayFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Button Hover Effects */
@keyframes buttonHover {
    0% {
        transform: translateY(0);
        box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
    }
    100% {
        transform: translateY(-2px);
        box-shadow: 0 12px 25px rgba(139, 92, 246, 0.4);
    }
}

@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Card Animations */
@keyframes cardHover {
    0% {
        transform: translateY(0);
        background: rgba(30, 41, 59, 0.8);
    }
    100% {
        transform: translateY(-2px);
        background: rgba(30, 41, 59, 0.95);
    }
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0);
    }
    50% {
        transform: rotateY(-90deg);
    }
    100% {
        transform: rotateY(0);
    }
}

/* Audio Visualizations */
@keyframes soundWave {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.5);
    }
}

@keyframes audioRipple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Achievement Unlock */
@keyframes achievementPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(-90deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes starBurst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(2) rotate(360deg);
        opacity: 0;
    }
}

/* Utility Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease forwards;
}

.animate-slide-out {
    animation: slideOut 0.3s ease forwards;
}

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

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

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

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

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

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

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

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

.animate-scale-in {
    animation: scaleIn 0.5s ease forwards;
}

.animate-zoom-in {
    animation: zoomIn 0.3s ease forwards;
}

.animate-gem-collect {
    animation: gemCollect 1s ease forwards;
}

.animate-gem-sparkle {
    animation: gemSparkle 2s ease-in-out infinite;
}

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

.animate-arabic-fade {
    animation: arabicFade 0.5s ease forwards;
}

.animate-achievement {
    animation: achievementPop 0.8s ease forwards;
}

/* Pause Animations */
.animate-paused {
    animation-play-state: paused;
}

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

/* Duration Classes */
.animate-fast { animation-duration: 0.15s; }
.animate-slow { animation-duration: 0.5s; }
.animate-slower { animation-duration: 1s; }
.animate-slowest { animation-duration: 2s; }

/* Easing Classes */
.animate-ease-in { animation-timing-function: ease-in; }
.animate-ease-out { animation-timing-function: ease-out; }
.animate-ease-in-out { animation-timing-function: ease-in-out; }
.animate-linear { animation-timing-function: linear; }

/* Fill Mode Classes */
.animate-fill-forwards { animation-fill-mode: forwards; }
.animate-fill-backwards { animation-fill-mode: backwards; }
.animate-fill-both { animation-fill-mode: both; }

/* Direction Classes */
.animate-reverse { animation-direction: reverse; }
.animate-alternate { animation-direction: alternate; }
.animate-alternate-reverse { animation-direction: alternate-reverse; }

/* Iteration Classes */
.animate-once { animation-iteration-count: 1; }
.animate-twice { animation-iteration-count: 2; }
.animate-infinite { animation-iteration-count: infinite; }

/* Performance Optimizations */
.will-change-auto { will-change: auto; }
.will-change-scroll { will-change: scroll-position; }
.will-change-contents { will-change: contents; }
.will-change-transform { will-change: transform; }

/* Hardware Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}