/* Enhanced Animations for Nine Belts Program */

/* Enhanced Floating Elements */
@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
        opacity: 0.6;
    }
    25% { 
        transform: translate(-20px, -30px) rotate(90deg); 
        opacity: 0.8;
    }
    50% { 
        transform: translate(30px, -20px) rotate(180deg); 
        opacity: 1;
    }
    75% { 
        transform: translate(-10px, 10px) rotate(270deg); 
        opacity: 0.7;
    }
}

@keyframes floatLarge {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg) scale(1); 
    }
    33% { 
        transform: translate(-40px, -40px) rotate(120deg) scale(1.1); 
    }
    66% { 
        transform: translate(40px, -30px) rotate(240deg) scale(0.9); 
    }
}

@keyframes pulse {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(1.05);
    }
}

@keyframes gridMove {
    0% { 
        transform: translate(0, 0); 
        opacity: 0.3;
    }
    50% {
        opacity: 0.5;
    }
    100% { 
        transform: translate(50px, 50px); 
        opacity: 0.3;
    }
}

/* Particle System */
.floating-element:nth-child(1) {
    animation: float 25s infinite linear;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.04) 0%, rgba(191, 90, 242, 0.02) 70%, transparent 100%);
}

.floating-element:nth-child(2) {
    animation: floatLarge 30s infinite linear;
    background: radial-gradient(circle, rgba(48, 209, 88, 0.03) 0%, rgba(255, 159, 10, 0.02) 70%, transparent 100%);
    animation-delay: -5s;
}

.floating-element:nth-child(3) {
    animation: pulse 35s infinite ease-in-out;
    background: radial-gradient(circle, rgba(255, 69, 58, 0.03) 0%, rgba(255, 214, 10, 0.02) 70%, transparent 100%);
    animation-delay: -10s;
}

.floating-element:nth-child(4) {
    animation: float 28s infinite linear reverse;
    background: radial-gradient(circle, rgba(191, 90, 242, 0.04) 0%, rgba(0, 122, 255, 0.02) 70%, transparent 100%);
    animation-delay: -15s;
}

.floating-element:nth-child(5) {
    animation: floatLarge 22s infinite linear;
    background: radial-gradient(circle, rgba(255, 159, 10, 0.03) 0%, rgba(48, 209, 88, 0.02) 70%, transparent 100%);
    animation-delay: -20s;
}

/* Enhanced Grid Animation */
.grid-overlay {
    animation: gridMove 40s linear infinite;
    background-image: 
        linear-gradient(rgba(0, 122, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 122, 255, 0.02) 1px, transparent 1px),
        radial-gradient(circle at 25% 25%, rgba(191, 90, 242, 0.01) 2px, transparent 3px),
        radial-gradient(circle at 75% 75%, rgba(48, 209, 88, 0.01) 2px, transparent 3px);
    background-size: 50px 50px, 50px 50px, 100px 100px, 150px 150px;
}

/* Text Animation Effects */
@keyframes textShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.shimmer-text {
    background: linear-gradient(
        90deg,
        var(--primary-text) 0%,
        rgba(0, 122, 255, 0.8) 50%,
        var(--primary-text) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShimmer 3s ease-in-out infinite;
}

/* Card Hover Animations */
@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(0.5deg);
    }
}

@keyframes cardGlow {
    0%, 100% {
        box-shadow: 
            0 10px 15px rgba(0, 0, 0, 0.1),
            0 4px 6px rgba(0, 0, 0, 0.05),
            0 0 0 rgba(0, 122, 255, 0);
    }
    50% {
        box-shadow: 
            0 20px 25px rgba(0, 0, 0, 0.15),
            0 8px 10px rgba(0, 0, 0, 0.04),
            0 0 20px rgba(0, 122, 255, 0.1);
    }
}

.overview-card:hover {
    animation: cardFloat 2s ease-in-out infinite, cardGlow 2s ease-in-out infinite;
}

.belt-card:hover {
    animation: cardFloat 2.5s ease-in-out infinite;
}

/* Button Animations */
@keyframes buttonPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
    }
    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(0, 122, 255, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

.btn-primary:hover {
    animation: buttonPulse 1.5s ease-in-out;
}

/* Navigation Animation */
@keyframes navSlide {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar {
    animation: navSlide 0.8s ease-out;
}

/* Icon Rotation */
@keyframes iconRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.nav-icon:hover {
    animation: iconRotate 1s ease-in-out;
}

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

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

/* Metric Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stat-number {
    animation: countUp 1s ease-out;
}

.metric-value {
    animation: countUp 1.2s ease-out;
}

/* Timeline Animation */
@keyframes timelineSlide {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-item:nth-child(odd) .timeline-content {
    animation: timelineSlide 0.8s ease-out;
}

.timeline-item:nth-child(even) .timeline-content {
    animation: timelineSlide 0.8s ease-out reverse;
}

/* Scroll-triggered Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Classes for JavaScript */
.animate-slide-up {
    animation: slideInUp 0.8s ease-out forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Stagger Animation Delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

/* Belt Reveal Animation */
@keyframes beltReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) rotateX(-15deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}

.belt-card {
    animation: beltReveal 0.8s ease-out forwards;
}

/* Metric Animation */
@keyframes metricHighlight {
    0%, 100% {
        background-color: rgba(255, 255, 255, 0.05);
    }
    50% {
        background-color: rgba(0, 122, 255, 0.1);
    }
}

.metric-item:hover {
    animation: metricHighlight 1s ease-in-out;
}

/* Hero Particles */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 122, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(191, 90, 242, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(48, 209, 88, 0.03) 0%, transparent 50%);
    pointer-events: none;
    animation: heroParticles 20s ease-in-out infinite alternate;
}

@keyframes heroParticles {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.6;
    }
    100% {
        transform: translateY(-20px) rotate(2deg);
        opacity: 0.8;
    }
}

/* Section Reveal */
.section-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.section-reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .floating-element {
        width: 100px;
        height: 100px;
        animation-duration: 15s !important;
    }
    
    .grid-overlay {
        background-size: 30px 30px, 30px 30px, 60px 60px, 90px 90px;
    }
    
    /* Reduce animation intensity on mobile */
    .overview-card:hover,
    .belt-card:hover {
        animation: none;
        transform: translateY(-3px);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-element,
    .grid-overlay {
        animation: none !important;
    }
}

/* Performance Optimizations */
.floating-element,
.grid-overlay,
.overview-card,
.belt-card,
.timeline-marker {
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* High DPI Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .floating-element {
        background-size: 100px 100px;
    }
}