/* ========================================
   Scroll Animations - Professional & Smooth
   أنيميشن احترافية عند السكرول
   ======================================== */

/* Base Animation Class */
.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate.active {
    opacity: 1;
    transform: translateY(0);
}

/* Card Specific Animations */
.scroll-animate-card {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-animate-card.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Stagger Effect - تأخير متدرج */
.scroll-animate:nth-child(1) { transition-delay: 0.1s; }
.scroll-animate:nth-child(2) { transition-delay: 0.2s; }
.scroll-animate:nth-child(3) { transition-delay: 0.3s; }
.scroll-animate:nth-child(4) { transition-delay: 0.4s; }
.scroll-animate:nth-child(5) { transition-delay: 0.5s; }
.scroll-animate:nth-child(6) { transition-delay: 0.6s; }
.scroll-animate:nth-child(7) { transition-delay: 0.7s; }
.scroll-animate:nth-child(8) { transition-delay: 0.8s; }

/* Fade In from Left */
.scroll-fade-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease-out;
}

.scroll-fade-left.active {
    opacity: 1;
    transform: translateX(0);
}

/* Fade In from Right */
.scroll-fade-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease-out;
}

.scroll-fade-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* Fade In from Bottom (Simple) */
.scroll-fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s ease-out;
}

.scroll-fade-up.active {
    opacity: 1;
    transform: translateY(0);
}

/* Scale In Animation */
.scroll-scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-scale-in.active {
    opacity: 1;
    transform: scale(1);
}

/* Rotate & Fade In */
.scroll-rotate-in {
    opacity: 0;
    transform: rotate(-5deg) scale(0.95);
    transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-rotate-in.active {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Blur to Clear Animation */
.scroll-blur-in {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
    transition: all 0.8s ease-out;
}

.scroll-blur-in.active {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

/* Package Cards - Special Animation */
.package-card-animate {
    opacity: 0;
    transform: translateY(60px) rotateX(20deg) scale(0.95);
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.package-card-animate.active {
    opacity: 1;
    transform: translateY(0) rotateX(0) scale(1);
}

/* إضافة تأثير عند الخروج من Viewport */
.package-card-animate:not(.active) {
    pointer-events: none;
}

/* Featured Card - Extra Special */
.featured-card-animate {
    opacity: 0;
    transform: translateY(80px) scale(0.9) rotateX(15deg);
    box-shadow: 0 0 0 rgba(79, 0, 140, 0);
    transition: all 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity, box-shadow;
}

.featured-card-animate.active {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0);
    box-shadow: 0 20px 60px rgba(79, 0, 140, 0.3);
}

/* تأثير إضافي عند الظهور */
.featured-card-animate.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #84cc16, #a855f7);
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.2; }
}

/* Section Headings Animation */
.section-heading-animate {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.6s ease-out;
}

.section-heading-animate.active {
    opacity: 1;
    transform: translateY(0);
}

/* Icon Animation */
.icon-animate {
    opacity: 0;
    transform: scale(0) rotate(180deg);
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-animate.active {
    opacity: 1;
    transform: scale(1) rotate(0);
}

/* Progress Bar Animation */
.progress-animate {
    opacity: 0;
    transform: scaleX(0);
    transform-origin: right;
    transition: all 0.8s ease-out;
}

.progress-animate.active {
    opacity: 1;
    transform: scaleX(1);
}

/* Counter Animation Ready */
.counter-ready {
    font-variant-numeric: tabular-nums;
}

/* Testimonial Cards */
.testimonial-animate {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: all 0.7s ease-out;
}

.testimonial-animate.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Feature Items */
.feature-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s ease-out;
}

.feature-animate.active {
    opacity: 1;
    transform: translateY(0);
}

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

.scroll-animate.active .wave-on-scroll {
    animation: wave 2s ease-in-out infinite;
}

/* Glow on Scroll */
.glow-on-scroll {
    transition: all 0.6s ease-out;
}

.glow-on-scroll.active {
    box-shadow: 0 0 30px rgba(132, 204, 22, 0.3);
}

/* Text Reveal Animation */
.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    transform: translateX(-100%);
    transition: transform 0.8s;
}

.text-reveal.active::before {
    transform: translateX(100%);
}

/* Smooth Entry for All Elements */
.smooth-entry {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.smooth-entry.active {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .scroll-animate,
    .scroll-animate-card,
    .package-card-animate {
        transform: translateY(30px);
    }
    
    .scroll-fade-left,
    .scroll-fade-right {
        transform: translateY(30px);
    }
    
    .scroll-animate:nth-child(n) {
        transition-delay: 0.1s;
    }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    .scroll-animate,
    .scroll-animate-card,
    .scroll-fade-left,
    .scroll-fade-right,
    .scroll-fade-up,
    .scroll-scale-in,
    .scroll-rotate-in,
    .scroll-blur-in,
    .package-card-animate,
    .featured-card-animate {
        transition: opacity 0.3s ease-out;
        transform: none;
    }
}

/* Prevent Flash of Unstyled Content */
.no-js .scroll-animate,
.no-js .scroll-animate-card {
    opacity: 1;
    transform: none;
}
