/* ==========================================
   IQ PWA - Modern Animations
   Premium Mobile App Animations
   ========================================== */

/* Smooth Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        filter: blur(5px);
    }
    to {
        opacity: 1;
        filter: blur(0px);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        filter: blur(0px);
    }
    to {
        opacity: 0;
        filter: blur(5px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

/* Slide Animations */
@keyframes slideInRight {
    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 slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

/* 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 scalePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

@keyframes rotateIn {
    from {
        transform: rotate(-90deg);
        opacity: 0;
    }
    to {
        transform: rotate(0deg);
        opacity: 1;
    }
}

@keyframes swing {
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

/* Bounce Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

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

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer-effect {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Glow Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8),
                    0 0 30px rgba(255, 193, 7, 0.6);
    }
}

@keyframes glow-text {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
    }
    50% {
        text-shadow: 0 0 10px rgba(255, 193, 7, 0.8),
                     0 0 20px rgba(255, 193, 7, 0.6);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Wave Effect */
@keyframes wave {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-100px) translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Float Effect */
@keyframes float-up {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes float-horizontal {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(10px);
    }
}

/* Progress Bar Animation */
@keyframes progress-fill {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Gradient Animation */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

/* Coin Flip Animation */
@keyframes coin-flip {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* Wheel Spin Animation */
@keyframes wheel-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(3600deg);
    }
}

/* Harvest Pulse Animation */
@keyframes harvest-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 187, 106, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(102, 187, 106, 0);
    }
}

/* Gold Sparkle Animation */
@keyframes gold-sparkle {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.8) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

/* Animation Classes */
.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-fadeOut { animation: fadeOut 0.3s ease; }
.animate-fadeInUp { animation: fadeInUp 0.4s ease; }
.animate-fadeInDown { animation: fadeInDown 0.4s ease; }

.animate-slideInRight { animation: slideInRight 0.3s ease; }
.animate-slideInLeft { animation: slideInLeft 0.3s ease; }
.animate-slideUp { animation: slideUp 0.3s ease; }
.animate-slideDown { animation: slideDown 0.3s ease; }

.animate-scaleIn { animation: scaleIn 0.3s ease; }
.animate-scaleOut { animation: scaleOut 0.3s ease; }
.animate-scalePulse { animation: scalePulse 2s ease infinite; }

.animate-rotate { animation: rotate 1s linear infinite; }
.animate-rotateIn { animation: rotateIn 0.4s ease; }
.animate-swing { animation: swing 1s ease; }

.animate-bounce { animation: bounce 2s ease infinite; }
.animate-bounceIn { animation: bounceIn 0.6s ease; }

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

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

.animate-wave { animation: wave 2s linear infinite; }

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

.animate-coin-flip { animation: coin-flip 1s ease; }
.animate-wheel-spin { animation: wheel-spin 4s cubic-bezier(0.17, 0.67, 0.83, 0.67); }

.animate-harvest-pulse { animation: harvest-pulse 2s ease infinite; }
.animate-gold-sparkle { animation: gold-sparkle 3s ease infinite; }

/* Animation Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Animation Speed */
.animation-slow { animation-duration: 2s !important; }
.animation-fast { animation-duration: 0.3s !important; }
.animation-faster { animation-duration: 0.2s !important; }

/* Transition Utilities */
.transition-all { transition: all 0.3s ease; }
.transition-fast { transition: all 0.2s ease; }
.transition-slow { transition: all 0.5s ease; }

.transition-opacity { transition: opacity 0.3s ease; }
.transition-transform { transition: transform 0.3s ease; }
.transition-colors { transition: color 0.3s ease, background-color 0.3s ease; }

/* Hover Effects */
.hover-scale:hover { transform: scale(1.05); }
.hover-scale-sm:hover { transform: scale(1.02); }
.hover-scale-lg:hover { transform: scale(1.1); }

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

.hover-lift:hover { transform: translateY(-4px); }
.hover-sink:hover { transform: translateY(2px); }

.hover-shadow:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); }
.hover-glow:hover { box-shadow: 0 0 20px rgba(255, 193, 7, 0.4); }

/* Disabled State */
.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(50%);
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--gold-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* Skeleton Loading */
.skeleton-box {
    height: 100%;
    width: 100%;
    border-radius: var(--radius-md);
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #f5f5f5 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Success/Error States */
.success-pulse {
    animation: success-pulse 1s ease;
}

@keyframes success-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.error-shake {
    animation: shake 0.5s ease;
    border-color: var(--error-red) !important;
}

/* Modern Premium Animations */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 193, 7, 0.6);
    }
}

@keyframes morphing {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

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

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) rotate(720deg);
        opacity: 0;
    }
}

/* Utility Classes for Premium Effects */
.shimmer-effect {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

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

.morph-shape {
    animation: morphing 8s ease-in-out infinite;
}

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientFlow 4s ease infinite;
}

.particle-effect {
    animation: particleFloat 10s linear infinite;
}

/* 3D Transform Utilities */
.rotate-3d {
    transform-style: preserve-3d;
    animation: rotate3d 10s linear infinite;
}

@keyframes rotate3d {
    from {
        transform: rotateX(0) rotateY(0) rotateZ(0);
    }
    to {
        transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
    }
}

.flip-3d {
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.flip-3d:hover {
    transform: rotateY(180deg);
}

/* Smooth Page Transitions */
.page-enter {
    animation: pageEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.page-exit {
    animation: pageExit 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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