/* =================================================================
   MODERN ANIMATIONS - Advanced site-wide animations
   ================================================================= */

/* =================================================================
   CSS CUSTOM PROPERTIES - Animation Variables
   ================================================================= */
:root {
    /* Custom Easing Functions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Animation Durations */
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;
    --duration-slow: 0.6s;
    --duration-slower: 0.8s;
    
    /* Stagger Delays */
    --stagger-delay: 0.1s;
    --stagger-delay-sm: 0.05s;
    
    /* Hover Effects */
    --hover-lift: -8px;
    --hover-lift-sm: -4px;
    --hover-scale: 1.05;
}

/* =================================================================
   PAGE LOADER - Enhanced with blur effect
   ================================================================= */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--duration-slower) var(--ease-out-expo), 
                visibility var(--duration-slower) var(--ease-out-expo),
                backdrop-filter var(--duration-slower) var(--ease-out-expo);
    backdrop-filter: blur(0px);
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(20px);
}

.loader-content {
    text-align: center;
    animation: blurToFocus 1s var(--ease-out-expo);
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #ECF0F1;
    border-top: 4px solid #F39C12;
    border-radius: 50%;
    animation: spinSmooth 0.8s var(--ease-in-out-circ) infinite;
    margin: 0 auto 20px;
    box-shadow: 0 4px 20px rgba(243, 156, 18, 0.2);
}

.loader-text {
    color: #F39C12;
    font-size: 1.1rem;
    font-weight: 600;
    animation: pulseGlow 1.5s ease infinite;
}

/* =================================================================
   MODERN KEYFRAME ANIMATIONS
   ================================================================= */

/* Smooth Spin with easing */
@keyframes spinSmooth {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Pulse with glow */
@keyframes pulseGlow {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* Blur to Focus - Cinematic entrance */
@keyframes blurToFocus {
    0% {
        opacity: 0;
        filter: blur(20px);
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        filter: blur(0px);
        transform: scale(1);
    }
}

/* Slide In From Top - Spring effect */
@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Up - Smooth entrance */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In - Simple opacity */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale In - Bounce effect */
@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In Left */
@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Rotate In - 3D effect */
@keyframes rotateIn {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateY(-20deg);
    }
    100% {
        opacity: 1;
        transform: perspective(1000px) rotateY(0deg);
    }
}

/* Float - Subtle levitation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* Enhanced Shimmer - Smoother gradient */
@keyframes shimmerEnhanced {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Glow Pulse - Breathing light */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(243, 156, 18, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(243, 156, 18, 0.6),
                    0 0 60px rgba(243, 156, 18, 0.4);
    }
}

/* Ripple Wave - Enhanced ripple */
@keyframes rippleWave {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Skeleton Loading - Pulse effect */
@keyframes skeletonLoading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

/* Bounce In - Spring entrance */
@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);
    }
}

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

/* =================================================================
   HELPER CLASSES - Reusable animation utilities
   ================================================================= */

/* Scroll Animations */
.animate-on-scroll {
    opacity: 0;
    transition: opacity var(--duration-slow) var(--ease-out-expo),
                transform var(--duration-slow) var(--ease-out-expo);
    will-change: opacity, transform;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) !important;
}

/* Entrance Animations */
.fade-in {
    animation: fadeIn var(--duration-slow) var(--ease-out-expo);
}

.fade-in-up {
    animation: fadeInUp var(--duration-slow) var(--ease-out-expo);
}

.slide-in-top {
    animation: slideInFromTop var(--duration-slow) var(--ease-out-back);
}

.slide-in-left {
    animation: slideInLeft var(--duration-slow) var(--ease-out-expo);
}

.slide-in-right {
    animation: slideInRight var(--duration-slow) var(--ease-out-expo);
}

.scale-in {
    animation: scaleIn var(--duration-slow) var(--ease-out-back);
}

.blur-to-focus {
    animation: blurToFocus var(--duration-slower) var(--ease-out-expo);
}

.rotate-in {
    animation: rotateIn var(--duration-slow) var(--ease-out-expo);
}

.bounce-in {
    animation: bounceIn var(--duration-slow) var(--ease-out-back);
}

/* Stagger Delays */
.stagger-1 { animation-delay: calc(var(--stagger-delay) * 1); }
.stagger-2 { animation-delay: calc(var(--stagger-delay) * 2); }
.stagger-3 { animation-delay: calc(var(--stagger-delay) * 3); }
.stagger-4 { animation-delay: calc(var(--stagger-delay) * 4); }
.stagger-5 { animation-delay: calc(var(--stagger-delay) * 5); }

/* =================================================================
   BUTTON EFFECTS - Enhanced interactions
   ================================================================= */

/* Ripple Effect - Enhanced */
.btn-ripple {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-ripple::before {
    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 var(--duration-slow) var(--ease-out-expo),
                height var(--duration-slow) var(--ease-out-expo);
}

.btn-ripple:hover::before {
    width: 300px;
    height: 300px;
}

.btn-ripple .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: rippleWave 0.6s var(--ease-out-expo);
    pointer-events: none;
}

/* Magnetic Hover - Cursor attraction */
.magnetic-hover {
    transition: transform var(--duration-normal) var(--ease-out-expo);
    will-change: transform;
}

.magnetic-hover:hover {
    transform: translateY(var(--hover-lift));
}

/* Lift Effect */
.hover-lift {
    transition: transform var(--duration-normal) var(--ease-out-expo),
                box-shadow var(--duration-normal) var(--ease-out-expo);
    will-change: transform, box-shadow;
}

.hover-lift:hover {
    transform: translateY(var(--hover-lift-sm));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Scale Hover */
.hover-scale {
    transition: transform var(--duration-normal) var(--ease-out-back);
    will-change: transform;
}

.hover-scale:hover {
    transform: scale(var(--hover-scale));
}

/* Glow Hover */
.hover-glow {
    transition: box-shadow var(--duration-normal) var(--ease-out-expo);
    will-change: box-shadow;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(243, 156, 18, 0.5),
                0 0 60px rgba(243, 156, 18, 0.3);
}

/* =================================================================
   LOADING STATES - Skeleton screens
   ================================================================= */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 2em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
    border-radius: 12px;
}

/* =================================================================
   GLASSMORPHISM - Modern blur effects
   ================================================================= */

.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: backdrop-filter var(--duration-normal) var(--ease-out-expo);
}

.glass:hover {
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
}

/* =================================================================
   3D TRANSFORMS - Depth effects
   ================================================================= */

.tilt-3d {
    transform-style: preserve-3d;
    transition: transform var(--duration-normal) var(--ease-out-expo);
    will-change: transform;
}

.tilt-3d:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* =================================================================
   ACCESSIBILITY - Respect user preferences
   ================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
    }
}
