/* ========================================
   ADVANCED VISUAL ENHANCEMENTS
   Parallax, Particles, Animations, Effects
   ======================================== */

/* ===== PARALLAX SCROLLING ===== */
.parallax-section {
    position: relative;
    overflow: hidden;
}

.parallax-bg {
    position: absolute;
    top: -50%;
    left: 0;
    width: 100%;
    height: 200%;
    background-size: cover;
    background-position: center;
    will-change: transform;
    z-index: -1;
}

/* ===== PARTICLE EFFECTS ===== */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(78, 205, 196, 0.6);
    border-radius: 50%;
    animation: float-particle linear infinite;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.8);
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(var(--drift)) scale(1);
        opacity: 0;
    }
}

/* ===== SCROLL ANIMATIONS ===== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 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: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 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: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== 3D TILT EFFECT ===== */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg)) scale(1.02);
}

.tilt-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                rgba(78, 205, 196, 0.2), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: inherit;
    pointer-events: none;
}

.tilt-card:hover::before {
    opacity: 1;
}

/* ===== ANIMATED GRADIENT PROGRESS BARS ===== */
.gradient-progress {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.gradient-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #4ecdc4 0%, 
        #6366f1 25%, 
        #8b5cf6 50%, 
        #ec4899 75%, 
        #4ecdc4 100%);
    background-size: 200% 100%;
    border-radius: 10px;
    animation: gradient-flow 3s linear infinite;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== MICRO-INTERACTIONS ===== */
/* Ripple Effect */
.ripple-btn {
    position: relative;
    overflow: hidden;
}

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

.ripple-btn:active::after {
    width: 300px;
    height: 300px;
}

/* Icon Bounce */
.bounce-icon {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.bounce-icon:hover {
    animation: icon-bounce 0.6s ease;
}

@keyframes icon-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(-7px);
    }
}

/* Button Pulse */
.pulse-btn {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(78, 205, 196, 0);
    }
}

/* ===== CUSTOM LOADING ANIMATION ===== */
.custom-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.custom-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4ecdc4, #6366f1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    animation: logo-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(78, 205, 196, 0.6);
}

@keyframes logo-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(78, 205, 196, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 60px rgba(78, 205, 196, 0.8);
    }
}

.loader-text {
    margin-top: 20px;
    color: #4ecdc4;
    font-size: 1.2rem;
    font-weight: 600;
    animation: text-fade 1.5s ease-in-out infinite;
}

@keyframes text-fade {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

.loader-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.loader-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #6366f1, #8b5cf6);
    background-size: 200% 100%;
    animation: loader-progress 2s ease-in-out infinite;
}

@keyframes loader-progress {
    0% {
        width: 0%;
        background-position: 0% 0%;
    }
    50% {
        width: 100%;
        background-position: 100% 0%;
    }
    100% {
        width: 0%;
        background-position: 200% 0%;
    }
}

/* ===== CURSOR TRAIL EFFECT ===== */
.cursor-trail {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.8), transparent);
    pointer-events: none;
    z-index: 9998;
    mix-blend-mode: screen;
    animation: trail-fade 0.5s ease-out forwards;
}

@keyframes trail-fade {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.cursor-glow {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(78, 205, 196, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    transition: transform 0.15s ease-out;
    mix-blend-mode: screen;
}

/* ===== GLASSMORPHISM CARDS ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(78, 205, 196, 0.3);
    box-shadow: 0 8px 32px rgba(78, 205, 196, 0.2);
    transform: translateY(-5px);
}

.glass-card-strong {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== ANIMATED COUNTERS ===== */
.counter {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4ecdc4, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.counter-wrapper {
    text-align: center;
    padding: 20px;
}

.counter-label {
    font-size: 1rem;
    color: #9ca3af;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ===== STAGGER ANIMATIONS ===== */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: stagger-fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes stagger-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    .tilt-card:hover {
        transform: none;
    }
    
    .cursor-trail,
    .cursor-glow {
        display: none;
    }
    
    .particle {
        width: 2px;
        height: 2px;
    }
    
    .counter {
        font-size: 2rem;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
