/* ================================
   Advanced Animations & Effects
   ================================ */

/* Floating Elements Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(1deg);
    }
    50% {
        transform: translateY(-10px) translateX(-5px) rotate(-1deg);
    }
    75% {
        transform: translateY(-15px) translateX(5px) rotate(0.5deg);
    }
}

/* Glowing Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 122, 255, 0.5),
                    0 0 40px rgba(0, 122, 255, 0.3),
                    0 0 60px rgba(0, 122, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 122, 255, 0.7),
                    0 0 50px rgba(0, 122, 255, 0.5),
                    0 0 70px rgba(0, 122, 255, 0.3);
    }
}

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

.shimmer {
    animation: shimmer 3s infinite linear;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
}

/* Wave Animation */
@keyframes wave {
    0%, 100% {
        transform: translateY(0) scaleY(1);
    }
    50% {
        transform: translateY(-10px) scaleY(0.95);
    }
}

/* Slide In Animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

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

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

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

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

/* Typing Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0;
    }
}

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

.gradient-animated {
    background: linear-gradient(
        -45deg,
        #007AFF,
        #FF9500,
        #FF453A,
        #32D74B
    );
    background-size: 400% 400%;
    animation: gradientFlow 15s ease infinite;
}

/* Particle Effect Classes */
.particle {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    animation: particleFloat 8s infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(80vh) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(0.5);
    }
}

/* Line Draw Animation */
@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.line-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 3s ease-in-out forwards;
}

/* Reveal Animation */
@keyframes reveal {
    from {
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* Zoom Animations */
@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.5);
        opacity: 0;
    }
}

/* Flip Animation */
@keyframes flipX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes flipY {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

/* Spin Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes spinReverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

/* Elastic Animation */
@keyframes elastic {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.25);
    }
    40% {
        transform: scale(0.75);
    }
    60% {
        transform: scale(1.15);
    }
    80% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Heartbeat Animation */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20% {
        transform: scale(1.15);
    }
}

/* Jello Animation */
@keyframes jello {
    0%, 100% {
        transform: skewX(0deg) skewY(0deg);
    }
    30% {
        transform: skewX(-12.5deg) skewY(-12.5deg);
    }
    40% {
        transform: skewX(6.25deg) skewY(6.25deg);
    }
    50% {
        transform: skewX(-3.125deg) skewY(-3.125deg);
    }
    65% {
        transform: skewX(1.5625deg) skewY(1.5625deg);
    }
    75% {
        transform: skewX(-0.78125deg) skewY(-0.78125deg);
    }
    85% {
        transform: skewX(0.390625deg) skewY(0.390625deg);
    }
    95% {
        transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
    }
}

/* Background Pattern Animation */
@keyframes backgroundScroll {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 100px 100px;
    }
}

/* Smooth Color Transition */
@keyframes colorCycle {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(180deg);
    }
}

/* Text Shadow Pulse */
@keyframes textShadowPulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 122, 255, 0.8),
                     0 0 30px rgba(0, 122, 255, 0.6),
                     0 0 40px rgba(0, 122, 255, 0.4);
    }
}

/* Utility Classes for Animations */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

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

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

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

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

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

.animate-elastic {
    animation: elastic 1s;
}

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

.animate-jello {
    animation: jello 1s;
}

/* Hover Animation Triggers */
.hover-float:hover {
    animation: float 2s ease-in-out infinite;
}

.hover-glow:hover {
    animation: glow 1s ease-in-out infinite;
}

.hover-shake:hover {
    animation: shake 0.5s;
}

.hover-bounce:hover {
    animation: bounce 1s;
}

/* Scroll-triggered Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger Animation Classes */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-animation > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-animation > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-animation > *:nth-child(9) { animation-delay: 0.9s; }

/* Loading Animation */
@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-dots {
    display: inline-flex;
    gap: 5px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0; }

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

.progress-animated {
    animation: progressBar 2s ease-in-out;
}

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

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

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%) scale(0);
    animation: ripple 0.6s ease-out;
}