/* Advanced Animations & Effects */

/* Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

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

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

@keyframes shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

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

@keyframes slideInRotate {
    from {
        opacity: 0;
        transform: translateY(50px) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4),
                    0 0 0 0 rgba(0, 122, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(0, 122, 255, 0),
                    0 0 0 0 rgba(0, 122, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(0, 122, 255, 0),
                    0 0 0 40px rgba(0, 122, 255, 0);
    }
}

/* Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transition: none;
}

.animate-on-scroll.animated {
    animation-duration: 0.8s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-up.animated { animation-name: fadeInUp; }
.fade-down.animated { animation-name: fadeInDown; }
.fade-left.animated { animation-name: fadeInLeft; }
.fade-right.animated { animation-name: fadeInRight; }
.scale-in.animated { animation-name: scaleIn; }

/* Stagger animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* Continuous animations */
.float-animation {
    animation: float 6s ease-in-out infinite;
}

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

/* Hover effects */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-12px);
}

.hover-glow {
    position: relative;
    overflow: hidden;
}

.hover-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.hover-glow:hover::before {
    left: 100%;
}

/* Gradient animation */
.animated-gradient {
    background: linear-gradient(-45deg, #007AFF, #00C7FF, #34C759, #007AFF);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

/* Loading spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 122, 255, 0.1);
    border-top-color: #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Particle effect */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* Counter animation */
.counter {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #007AFF, #00C7FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glassmorphism effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Morphing blob */
@keyframes morph {
    0%, 100% {
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    }
    25% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    75% {
        border-radius: 70% 30% 50% 50% / 30% 60% 70% 40%;
    }
}

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

/* Progress bar animation */
@keyframes progress {
    from {
        width: 0;
    }
}

.progress-bar {
    animation: progress 2s ease-out forwards;
}

/* Typewriter effect */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    50% { border-color: transparent; }
}

.typewriter {
    overflow: hidden;
    border-right: 3px solid #007AFF;
    white-space: nowrap;
    animation: typing 3s steps(40) 1s forwards,
               blink 0.75s step-end infinite;
}
