/* Animations and Interactive Effects */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Shine Effect */
@keyframes shine {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Glow Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Apply animations to elements */
.hero-content {
    animation: fadeInLeft 1s ease-out;
}

.hero-image {
    animation: fadeInRight 1s ease-out 0.3s both;
}

.feature-card {
    animation: fadeIn 0.8s ease-out;
    animation-fill-mode: both;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.3s; }
.feature-card:nth-child(3) { animation-delay: 0.5s; }

.game-category {
    animation: slideInUp 0.8s ease-out;
    animation-fill-mode: both;
}

.game-category:nth-child(1) { animation-delay: 0.1s; }
.game-category:nth-child(2) { animation-delay: 0.3s; }
.game-category:nth-child(3) { animation-delay: 0.5s; }

/* Hover Effects */
.btn:hover {
    animation: pulse 0.6s ease-in-out;
}

.feature-card:hover {
    animation: scaleIn 0.3s ease-out;
}

.game-category:hover {
    animation: bounce 0.6s ease-in-out;
}

/* Interactive Elements */
.nav-logo h1:hover {
    animation: glow 2s ease-in-out infinite;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%);
    animation: shine 1.5s ease-in-out;
    background-size: 200% auto;
}

/* Loading States */
.loading {
    animation: rotate 1s linear infinite;
}

/* Scroll-triggered animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.scroll-animate.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax Effect */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus animations for accessibility */
.btn:focus {
    animation: pulse 0.3s ease-in-out;
}

.nav-link:focus {
    animation: glow 1s ease-in-out;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Performance optimizations */
.feature-card,
.game-category,
.btn {
    will-change: transform;
}

/* GPU acceleration */
.hero-image img,
.feature-card,
.game-category {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Smooth transitions for all interactive elements */
a, button, .feature-card, .game-category {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover state improvements */
.feature-card:hover,
.game-category:hover {
    transform: translateY(-10px) scale(1.02);
}

.btn:hover {
    transform: translateY(-2px) scale(1.05);
}

/* Active state animations */
.btn:active {
    transform: translateY(0) scale(0.98);
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 215, 0, 0.3);
    border-top: 4px solid var(--gold-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Success animation */
.success-checkmark {
    animation: scaleIn 0.5s ease-out;
}

/* Error shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.error-shake {
    animation: shake 0.6s ease-in-out;
}
