/* ============================================
   HealthGenie Website - Advanced Animations
   Performance Optimized
   ============================================ */

/* Performance optimizations */
* {
    /* Enable hardware acceleration for transforms */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fade-in Animations (GPU accelerated) */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0); /* Use translate3d for GPU */
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translate3d(-30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translate3d(30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}

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

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

/* Slide Animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

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

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

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

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

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

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(98, 0, 238, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(98, 0, 238, 0);
    }
}

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

@keyframes gradientRotate {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

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

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

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(98, 0, 238, 0.5),
                    0 0 10px rgba(98, 0, 238, 0.3),
                    0 0 15px rgba(98, 0, 238, 0.1);
    }
    50% {
        box-shadow: 0 0 10px rgba(98, 0, 238, 0.8),
                    0 0 20px rgba(98, 0, 238, 0.5),
                    0 0 30px rgba(98, 0, 238, 0.3);
    }
}

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

/* Ripple Animation */
@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(98, 0, 238, 0.4),
                    0 0 0 0 rgba(98, 0, 238, 0.4);
    }
    40% {
        box-shadow: 0 0 0 20px rgba(98, 0, 238, 0),
                    0 0 0 0 rgba(98, 0, 238, 0.4);
    }
    80% {
        box-shadow: 0 0 0 20px rgba(98, 0, 238, 0),
                    0 0 0 40px rgba(98, 0, 238, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(98, 0, 238, 0),
                    0 0 0 40px rgba(98, 0, 238, 0);
    }
}

/* Blink Animation */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Wobble Animation */
@keyframes wobble {
    0%, 100% {
        transform: translateX(0);
    }
    15% {
        transform: translateX(-25px) rotate(-5deg);
    }
    30% {
        transform: translateX(20px) rotate(3deg);
    }
    45% {
        transform: translateX(-15px) rotate(-3deg);
    }
    60% {
        transform: translateX(10px) rotate(2deg);
    }
    75% {
        transform: translateX(-5px) rotate(-1deg);
    }
}

/* Utility Classes - Optimized */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
    will-change: opacity;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
    will-change: opacity, transform;
}

.animate-fade-in-down {
    animation: fadeInDown 0.5s ease-out;
    will-change: opacity, transform;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.5s ease-out;
    will-change: opacity, transform;
}

.animate-fade-in-right {
    animation: fadeInRight 0.5s ease-out;
    will-change: opacity, transform;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease-out;
    will-change: transform, opacity;
}

.animate-bounce-in {
    animation: bounceIn 0.7s ease-out; /* Slightly faster */
    will-change: transform, opacity;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
    will-change: transform;
}

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

.animate-glow {
    animation: glow 2s ease-in-out infinite;
    will-change: box-shadow;
}

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

/* AOS (Animate On Scroll) Alternative - GPU Accelerated */
[data-aos] {
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out; /* Faster transitions */
    will-change: opacity, transform;
}

[data-aos].aos-animate {
    opacity: 1;
    will-change: auto; /* Remove after animation */
}

[data-aos="fade-up"] {
    transform: translate3d(0, 30px, 0);
}

[data-aos="fade-up"].aos-animate {
    transform: translate3d(0, 0, 0);
}

[data-aos="fade-down"] {
    transform: translate3d(0, -30px, 0);
}

[data-aos="fade-down"].aos-animate {
    transform: translate3d(0, 0, 0);
}

[data-aos="fade-left"] {
    transform: translate3d(-30px, 0, 0);
}

[data-aos="fade-left"].aos-animate {
    transform: translate3d(0, 0, 0);
}

[data-aos="fade-right"] {
    transform: translate3d(30px, 0, 0);
}

[data-aos="fade-right"].aos-animate {
    transform: translate3d(0, 0, 0);
}

[data-aos="scale-in"] {
    transform: scale(0.9);
}

[data-aos="scale-in"].aos-animate {
    transform: scale(1);
}

[data-aos="zoom-in"] {
    transform: scale(0.8);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* Delay Classes */
[data-aos-delay="0"] {
    transition-delay: 0ms;
}

[data-aos-delay="100"] {
    transition-delay: 100ms;
}

[data-aos-delay="200"] {
    transition-delay: 200ms;
}

[data-aos-delay="300"] {
    transition-delay: 300ms;
}

[data-aos-delay="400"] {
    transition-delay: 400ms;
}

[data-aos-delay="500"] {
    transition-delay: 500ms;
}

/* Duration Classes */
[data-aos-duration="300"] {
    transition-duration: 300ms;
}

[data-aos-duration="400"] {
    transition-duration: 400ms;
}

[data-aos-duration="500"] {
    transition-duration: 500ms;
}

[data-aos-duration="600"] {
    transition-duration: 600ms;
}

[data-aos-duration="800"] {
    transition-duration: 800ms;
}

[data-aos-duration="1000"] {
    transition-duration: 1000ms;
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(98, 0, 238, 0.2);
    border-top-color: #6200EE;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCaret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: currentColor;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid;
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s 1 normal both,
               blinkCaret 0.75s step-end infinite;
}

/* Confetti Animation */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    animation: confetti-fall 3s linear infinite;
}

/* Heart Beat */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.9);
    }
    20%, 40% {
        transform: scale(1.1);
    }
}

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

/* Text Focus In */
@keyframes textFocusIn {
    0% {
        filter: blur(12px);
        opacity: 0;
    }
    100% {
        filter: blur(0);
        opacity: 1;
    }
}

.text-focus-in {
    animation: textFocusIn 1s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}

/* Slide Rotate */
@keyframes slideRotate {
    0% {
        transform: translateX(-100%) rotate(-360deg);
        opacity: 0;
    }
    100% {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}

.slide-rotate {
    animation: slideRotate 0.6s ease-out;
}

/* Flip */
@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

.flip {
    animation: flip 0.6s ease-in-out;
}

/* Jello */
@keyframes jello {
    0%, 100% {
        transform: scale3d(1, 1, 1);
    }
    30% {
        transform: scale3d(1.25, 0.75, 1);
    }
    40% {
        transform: scale3d(0.75, 1.25, 1);
    }
    50% {
        transform: scale3d(1.15, 0.85, 1);
    }
    65% {
        transform: scale3d(0.95, 1.05, 1);
    }
    75% {
        transform: scale3d(1.05, 0.95, 1);
    }
}

.jello {
    animation: jello 0.9s;
}

/* Slide Bounce */
@keyframes slideBounce {
    0% {
        transform: translateX(-100%);
    }
    60% {
        transform: translateX(20px);
    }
    75% {
        transform: translateX(-10px);
    }
    90% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

.slide-bounce {
    animation: slideBounce 0.8s ease-out;
}
