/* ==========================================
   ADVANCED ANIMATIONS & EFFECTS
   ========================================== */

/* Ensure all content is above particles and effects */
section,
.navbar,
footer {
    position: relative;
    z-index: 10;
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Cursor Trail Effect */
.cursor-trail {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-color), transparent);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    mix-blend-mode: screen;
}

/* Floating Particles Background */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: floatParticle 20s infinite ease-in-out;
}

@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-100px) translateX(50px) scale(1.5);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-200px) translateX(-30px) scale(1);
        opacity: 0.3;
    }
    75% {
        transform: translateY(-100px) translateX(-50px) scale(1.5);
        opacity: 0.6;
    }
}

/* Magnetic Button Effect */
.btn, .cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 20px 40px rgba(139, 95, 191, 0.4);
}

/* Text Gradient Animation */
.gradient-text {
    background: linear-gradient(90deg, 
        var(--primary-color), 
        var(--accent-purple), 
        var(--primary-light),
        var(--primary-color)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Card Hover Effects - 3D Tilt */
.service-card,
.testimonial-card,
.integration-card,
.process-card {
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    position: relative;
}

.service-card::before,
.testimonial-card::before,
.integration-card::before,
.process-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(75, 0, 130, 0.85), 
        rgba(107, 70, 193, 0.85)
    );
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.service-card:hover::before,
.testimonial-card:hover::before,
.integration-card:hover::before,
.process-card:hover::before {
    opacity: 1;
}

.service-card:hover,
.testimonial-card:hover,
.integration-card:hover,
.process-card:hover {
    transform: translateY(-15px) rotateX(5deg);
    box-shadow: 
        0 30px 60px rgba(139, 95, 191, 0.25),
        0 0 40px rgba(151, 104, 246, 0.15);
}

/* Ensure text is visible on hover with deep violet background */
.service-card:hover,
.testimonial-card:hover,
.integration-card:hover,
.process-card:hover {
    color: #FFFFFF;
}

.service-card:hover *,
.testimonial-card:hover *,
.integration-card:hover *,
.process-card:hover * {
    position: relative;
    z-index: 1;
    color: #FFFFFF;
}

.service-card:hover h3,
.testimonial-card:hover h3,
.integration-card:hover h3,
.process-card:hover h3 {
    color: #FFFFFF;
}

.service-card:hover p,
.testimonial-card:hover p,
.integration-card:hover p,
.process-card:hover p {
    color: rgba(255, 255, 255, 0.9);
}

.service-card:hover .service-icon,
.integration-card:hover .integration-icon {
    filter: brightness(1.2);
}

/* Service Card Icon Animation - Same as Integration Tools */
.service-card .service-icon {
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.service-card:hover .service-icon {
    animation: iconPulseRotate 0.8s ease-in-out;
    transform: scale(1.2);
}

.service-card:hover .service-icon svg,
.service-card:hover .service-icon i {
    filter: drop-shadow(0 0 20px currentColor) brightness(1.3);
    animation: iconBounceGlow 0.6s ease-in-out;
}

/* Testimonial Card Quote Icon/Avatar Animation */
.testimonial-card .testimonial-author img,
.testimonial-card .quote-icon {
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.testimonial-card:hover .testimonial-author img {
    animation: iconPulseRotate 0.8s ease-in-out;
    transform: scale(1.15);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
}

.testimonial-card:hover .quote-icon {
    animation: iconBounceGlow 0.6s ease-in-out;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5)) brightness(1.3);
}

/* Glowing Border Animation */
.glow-border {
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.glow-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--primary-color),
        var(--accent-purple),
        var(--primary-light),
        var(--primary-color)
    );
    border-radius: inherit;
    z-index: -1;
    background-size: 400% 400%;
    animation: glowBorder 6s ease infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-border:hover::before {
    opacity: 1;
}

@keyframes glowBorder {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Typing Effect for Hero */
.typing-effect {
    border-right: 3px solid var(--primary-color);
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    50% { border-color: transparent; }
}

/* Parallax Scroll Effect */
.parallax-section {
    position: relative;
    overflow: hidden;
}

.parallax-bg {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-size: cover;
    background-position: center;
    transform: translateZ(0);
    will-change: transform;
}

/* Number Counter Animation */
.stat-number {
    font-weight: 800;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: counterPulse 2s ease infinite;
}

@keyframes counterPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Scroll Reveal Animations */
.reveal-fade-up {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-fade-up.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-fade-left {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-fade-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-fade-right {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-fade-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 1;
    transform: scale(1);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Animation Delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* Hero Background Gradient Animation */
.hero {
    position: relative;
    background: linear-gradient(135deg, 
        var(--bg-gradient-start) 0%,
        var(--bg-gradient-middle) 50%,
        var(--bg-gradient-end) 100%
    );
    background-size: 400% 400%;
    animation: gradientBackground 15s ease infinite;
}

@keyframes gradientBackground {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Floating Animation for Hero Elements */
.hero-circle-1,
.hero-circle-2,
.hero-circle-3 {
    animation: float 6s ease-in-out infinite;
}

.hero-circle-2 {
    animation-delay: 2s;
    animation-duration: 8s;
}

.hero-circle-3 {
    animation-delay: 4s;
    animation-duration: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.1);
    }
}

/* Shimmer Effect for Cards */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmerMove 3s infinite;
}

@keyframes shimmerMove {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* Ripple Effect on Click */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: rippleAnimation 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleAnimation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Navbar Glass Morphism */
.navbar {
    background: rgba(15, 15, 35, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(139, 95, 191, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(139, 95, 191, 0.2);
}

/* Smooth Page Transitions */
body {
    animation: none;
}

@keyframes pageLoad {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo Spin on Hover */
.logo-image {
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.logo:hover .logo-image {
    transform: rotate(360deg) scale(1.1);
}

/* Nav Link Underline Animation */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-purple));
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Icon Bounce Animation */
.icon-bounce {
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Form Input Focus Effect */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 95, 191, 0.1),
                0 0 20px rgba(139, 95, 191, 0.2);
    transform: translateY(-2px);
}

/* Social Icons Hover */
.social-link {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.social-link:hover {
    transform: translateY(-5px) rotate(360deg) scale(1.2);
    color: var(--primary-color);
}

/* Integration Card Logo Animation */
.integration-card .integration-icon {
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.integration-card:hover .integration-icon {
    animation: iconPulseRotate 0.8s ease-in-out;
    transform: scale(1.2);
}

@keyframes iconPulseRotate {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.3) rotate(-10deg);
    }
    50% { 
        transform: scale(1.1) rotate(10deg);
    }
    75% {
        transform: scale(1.3) rotate(-5deg);
    }
}

/* Alternative: Integration Icon Bounce and Glow */
.integration-card:hover .integration-logo,
.integration-card:hover svg {
    filter: drop-shadow(0 0 20px currentColor) brightness(1.3);
    animation: iconBounceGlow 0.6s ease-in-out;
}

@keyframes iconBounceGlow {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-15px) scale(1.15);
    }
    50% {
        transform: translateY(0) scale(1.05);
    }
    75% {
        transform: translateY(-8px) scale(1.1);
    }
}

/* Text Reveal Animation */
.text-reveal {
    overflow: visible;
    display: inline-block;
}

.text-reveal span {
    display: inline-block;
    animation: none;
    opacity: 1;
    transform: translateY(0);
}

@keyframes textSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulsing Glow Effect */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(139, 95, 191, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(139, 95, 191, 0.8),
                    0 0 60px rgba(151, 104, 246, 0.6);
    }
}

/* Skeleton Loading Animation */
@keyframes skeleton {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Smooth Scroll Snap */
.scroll-snap-container {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

.scroll-snap-section {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* Performance Optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
