/* Background Animation Styles */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* Floating Shapes Animation */
.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.floating-shapes::before,
.floating-shapes::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s infinite linear;
}

.floating-shapes::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.floating-shapes::after {
    top: 60%;
    right: 15%;
    animation-delay: 10s;
    animation-duration: 30s;
}

/* Additional floating elements */
.floating-shapes::before {
    box-shadow: 
        200px 300px 0 0 rgba(139, 92, 246, 0.1),
        400px 100px 0 0 rgba(99, 102, 241, 0.1),
        600px 400px 0 0 rgba(245, 158, 11, 0.1),
        800px 200px 0 0 rgba(16, 185, 129, 0.1),
        100px 500px 0 0 rgba(239, 68, 68, 0.1);
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.1;
    }
    25% {
        opacity: 0.3;
    }
    50% {
        transform: translateY(-100px) rotate(180deg);
        opacity: 0.1;
    }
    75% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(0px) rotate(360deg);
        opacity: 0.1;
    }
}

/* Particle System */
.particle-system {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.6;
    animation: particle-float 15s infinite linear;
}

.particle:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
    animation-duration: 20s;
}

.particle:nth-child(2) {
    top: 30%;
    right: 25%;
    animation-delay: 5s;
    animation-duration: 25s;
}

.particle:nth-child(3) {
    bottom: 20%;
    left: 30%;
    animation-delay: 10s;
    animation-duration: 18s;
}

.particle:nth-child(4) {
    bottom: 40%;
    right: 40%;
    animation-delay: 15s;
    animation-duration: 22s;
}

.particle:nth-child(5) {
    top: 50%;
    left: 50%;
    animation-delay: 8s;
    animation-duration: 16s;
}

@keyframes particle-float {
    0% {
        transform: translateY(0px) translateX(0px);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-200px) translateX(100px);
        opacity: 0.8;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-400px) translateX(200px);
        opacity: 0;
    }
}

/* Glowing Orbs */
.glow-orb {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow-pulse 8s ease-in-out infinite;
}

.glow-orb:nth-child(1) {
    top: 15%;
    left: 5%;
    animation-delay: 0s;
}

.glow-orb:nth-child(2) {
    bottom: 25%;
    right: 10%;
    animation-delay: 4s;
}

@keyframes glow-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.2;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.4;
    }
}

/* Animated Grid */
.animated-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-move 30s linear infinite;
}

@keyframes grid-move {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Card Hover Animations */
.feature-card,
.game-card,
.step,
.contact-method,
.faq-item,
.link-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before,
.game-card::before,
.step::before,
.contact-method::before,
.faq-item::before,
.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.5s ease;
}

.feature-card:hover::before,
.game-card:hover::before,
.step:hover::before,
.contact-method:hover::before,
.faq-item:hover::before,
.link-card:hover::before {
    left: 100%;
}

/* Button Hover Effects */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Text Animation */
.hero-title,
.section-title {
    animation: text-glow 3s ease-in-out infinite alternate;
}

@keyframes text-glow {
    0% {
        text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    }
    100% {
        text-shadow: 0 0 30px rgba(99, 102, 241, 0.8), 0 0 40px rgba(139, 92, 246, 0.6);
    }
}

/* Fade In Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Stagger Animation for Cards */
.feature-card:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.1s both; }
.feature-card:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.2s both; }
.feature-card:nth-child(3) { animation: fadeInUp 0.6s ease-out 0.3s both; }

.game-card:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.1s both; }
.game-card:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.2s both; }
.game-card:nth-child(3) { animation: fadeInUp 0.6s ease-out 0.3s both; }

.step:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.1s both; }
.step:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.2s both; }
.step:nth-child(3) { animation: fadeInUp 0.6s ease-out 0.3s both; }
.step:nth-child(4) { animation: fadeInUp 0.6s ease-out 0.4s both; }

/* Loading Animation */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Bounce Animation */
.bounce {
    animation: bounce 2s infinite;
}

@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);
    }
}

/* Shake Animation */
.shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Slide In Animations */
.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-up {
    animation: slideInUp 0.8s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Lift Effect */
.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.3);
}

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    padding: 2px;
    background: var(--gradient-primary);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: gradient-rotate 3s linear infinite;
}

@keyframes gradient-rotate {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* Responsive Animation Adjustments */
@media (prefers-reduced-motion: reduce) {
    .background-animation,
    .floating-shapes,
    .particle-system,
    .glow-orb,
    .animated-grid {
        animation: none;
    }
    
    .feature-card,
    .game-card,
    .step,
    .contact-method,
    .faq-item,
    .link-card {
        transition: none;
    }
    
    .btn::before {
        display: none;
    }
}

@media (max-width: 768px) {
    .floating-shapes::before,
    .floating-shapes::after {
        width: 60px;
        height: 60px;
    }
    
    .particle {
        width: 3px;
        height: 3px;
    }
    
    .glow-orb {
        width: 100px;
        height: 100px;
    }
}

/* Performance Optimizations */
.background-animation {
    will-change: transform;
    transform: translateZ(0);
}

.floating-shapes::before,
.floating-shapes::after,
.particle,
.glow-orb {
    will-change: transform;
    transform: translateZ(0);
}

/* Smooth Scrolling Enhancement */
html {
    scroll-behavior: smooth;
}

/* Focus Visible Enhancement */
.btn:focus-visible,
.nav-link:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}
