/**
 * Advanced Animation System CSS - Côte d'Ivoire Development Showcase
 * GPU-accelerated animations with performance optimizations and accessibility support
 */

/* GPU Acceleration Base Classes */
.animate-gpu {
    transform: translateZ(0);
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

.animate-gpu-transform {
    will-change: transform;
    transform: translateZ(0);
}

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

/* Core Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-bounce {
    animation: scaleBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-slide-left {
    animation: slideLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-stagger-children > * {
    opacity: 0;
    transform: translateY(20px) translateZ(0);
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.animate-stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.animate-stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.animate-stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.animate-stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.animate-stagger-children > *:nth-child(6) { animation-delay: 500ms; }
.animate-stagger-children > *:nth-child(7) { animation-delay: 600ms; }
.animate-stagger-children > *:nth-child(8) { animation-delay: 700ms; }

.animate-parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Enhanced POI Marker Animations */
.poi-marker-enhanced {
    transform: translateZ(0);
    will-change: transform, opacity;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.poi-marker-appear {
    animation: poiMarkerAppear 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.poi-marker-hover {
    animation: poiMarkerHover 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.poi-marker-click {
    animation: poiMarkerClick 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.poi-marker-pulse {
    animation: poiMarkerPulse 2s ease-in-out infinite;
}

.poi-marker-active {
    animation: poiMarkerActive 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Storytelling Overlay Animations */
.storytelling-slide-in {
    animation: storytellingSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.storytelling-slide-out {
    animation: storytellingSlideOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.storytelling-text-reveal {
    animation: textReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.storytelling-parallax-bg {
    animation: parallaxBackground 1s ease-out forwards;
}

/* Navigation Control Animations */
.nav-button-hover {
    animation: navButtonHover 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.nav-button-click {
    animation: navButtonClick 0.15s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.nav-progress-update {
    animation: progressUpdate 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.nav-loading {
    animation: navLoading 1.2s ease-in-out infinite;
}

/* Enhanced Micro-Interactions */
.micro-bounce {
    animation: microBounce 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.micro-scale {
    animation: microScale 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.micro-shake {
    animation: microShake 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.micro-glow {
    animation: microGlow 0.6s ease-in-out;
}

.micro-ripple {
    position: relative;
    overflow: hidden;
}

.micro-ripple::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%);
    animation: rippleEffect 0.6s ease-out;
}

/* Simple Loading State Animations */
.loading-spinner {
    animation: spinnerRotate 1s linear infinite;
}

.loading-dots > span {
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots > span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots > span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots > span:nth-child(3) { animation-delay: 0s; }

/* Shimmer Effects */
.shimmer-effect {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmerMove 0.8s ease-out;
}

.shimmer-gold {
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.4), transparent);
}

.shimmer-blue {
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.4), transparent);
}

/* Keyframe Definitions */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(0);
        filter: blur(1px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
        filter: blur(0);
    }
}

@keyframes scaleBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) translateZ(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateZ(0);
    }
    70% {
        transform: scale(0.95) translateZ(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(-30px) translateZ(0);
        filter: blur(1px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateZ(0);
        filter: blur(0);
    }
}

@keyframes poiMarkerAppear {
    0% {
        opacity: 0;
        transform: scale(0) translateZ(0);
    }
    60% {
        opacity: 1;
        transform: scale(1.2) translateZ(0);
    }
    80% {
        transform: scale(0.9) translateZ(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

@keyframes poiMarkerHover {
    0% {
        transform: scale(1) translateZ(0);
    }
    100% {
        transform: scale(1.15) translateZ(0);
        filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    }
}

@keyframes poiMarkerClick {
    0% {
        transform: scale(1.15) translateZ(0);
    }
    50% {
        transform: scale(0.95) translateZ(0);
    }
    100% {
        transform: scale(1.1) translateZ(0);
    }
}

@keyframes poiMarkerPulse {
    0%, 100% {
        transform: scale(1) translateZ(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.05) translateZ(0);
        opacity: 0.8;
    }
}

@keyframes poiMarkerActive {
    0% {
        transform: scale(1) translateZ(0);
        filter: hue-rotate(0deg);
    }
    100% {
        transform: scale(1.2) translateZ(0);
        filter: hue-rotate(45deg) brightness(1.2);
    }
}

@keyframes storytellingSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

@keyframes storytellingSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) translateZ(0);
    }
}

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(10px) translateZ(0);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
        filter: blur(0);
    }
}

@keyframes parallaxBackground {
    from {
        transform: translateY(0) translateZ(0);
    }
    to {
        transform: translateY(-10px) translateZ(0);
    }
}

@keyframes navButtonHover {
    0% {
        transform: translateY(0) translateZ(0);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: translateY(-2px) translateZ(0);
        box-shadow: 0 8px 16px rgba(14, 165, 233, 0.3);
    }
}

@keyframes navButtonClick {
    0% {
        transform: translateY(-2px) translateZ(0);
    }
    50% {
        transform: translateY(0) translateZ(0);
    }
    100% {
        transform: translateY(-1px) translateZ(0);
    }
}

@keyframes progressUpdate {
    from {
        transform: scaleX(0) translateZ(0);
        opacity: 0;
    }
    to {
        transform: scaleX(1) translateZ(0);
        opacity: 1;
    }
}

@keyframes navLoading {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes microBounce {
    0%, 100% {
        transform: translateY(0) translateZ(0);
    }
    50% {
        transform: translateY(-4px) translateZ(0);
    }
}

@keyframes microScale {
    0%, 100% {
        transform: scale(1) translateZ(0);
    }
    50% {
        transform: scale(1.05) translateZ(0);
    }
}

@keyframes microShake {
    0%, 100% {
        transform: translateX(0) translateZ(0);
    }
    25% {
        transform: translateX(-2px) translateZ(0);
    }
    75% {
        transform: translateX(2px) translateZ(0);
    }
}

@keyframes microGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(14, 165, 233, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(14, 165, 233, 0.6);
    }
}

@keyframes rippleEffect {
    to {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}


@keyframes spinnerRotate {
    from {
        transform: rotate(0deg) translateZ(0);
    }
    to {
        transform: rotate(360deg) translateZ(0);
    }
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0) translateZ(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1) translateZ(0);
        opacity: 1;
    }
}

@keyframes shimmerMove {
    0% {
        transform: translateX(-100%) skewX(-12deg);
    }
    100% {
        transform: translateX(200%) skewX(-12deg);
    }
}

/* Phase 2: Infrastructure-Specific Layer Transition Animations */
@keyframes layerFadeInInfrastructure {
    0% {
        opacity: 0;
        transform: scale(0.98) translateZ(0);
        filter: blur(0.5px);
    }
    100% {
        opacity: 0.8;
        transform: scale(1) translateZ(0);
        filter: blur(0);
    }
}

@keyframes layerFadeInTransport {
    0% {
        opacity: 0;
        transform: scaleX(0.95) translateZ(0);
        filter: blur(0.5px);
    }
    100% {
        opacity: 0.8;
        transform: scaleX(1) translateZ(0);
        filter: blur(0);
    }
}

@keyframes layerFadeInPOI {
    0% {
        opacity: 0;
        transform: scale(0.8) translateZ(0);
        filter: blur(1px);
    }
    60% {
        opacity: 1;
        transform: scale(1.05) translateZ(0);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(0);
        filter: blur(0);
    }
}

@keyframes layerFadeOut {
    0% {
        opacity: 0.8;
        transform: scale(1) translateZ(0);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.98) translateZ(0);
        filter: blur(0.5px);
    }
}

/* Infrastructure-Specific Animation Classes */
.layer-transition-infrastructure {
    animation: layerFadeInInfrastructure 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.layer-transition-transport {
    animation: layerFadeInTransport 0.35s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

.layer-transition-poi {
    animation: layerFadeInPOI 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.layer-transition-out {
    animation: layerFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Optimized GPU Layer Classes for 60fps Performance */
.layer-gpu-optimized {
    will-change: opacity, transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.layer-batch-animation {
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Staggered Layer Animations for Smooth Transitions */
.layer-stagger-1 { animation-delay: 0ms; }
.layer-stagger-2 { animation-delay: 50ms; }
.layer-stagger-3 { animation-delay: 100ms; }
.layer-stagger-4 { animation-delay: 150ms; }
.layer-stagger-5 { animation-delay: 200ms; }
.layer-stagger-6 { animation-delay: 250ms; }
.layer-stagger-7 { animation-delay: 300ms; }
.layer-stagger-8 { animation-delay: 350ms; }
.layer-stagger-9 { animation-delay: 400ms; }
.layer-stagger-10 { animation-delay: 450ms; }
.layer-stagger-11 { animation-delay: 500ms; }

/* Animation Delay Utilities */
.delay-75 { animation-delay: 75ms; }
.delay-100 { animation-delay: 100ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* Animation Duration Utilities */
.duration-75 { animation-duration: 75ms; }
.duration-100 { animation-duration: 100ms; }
.duration-150 { animation-duration: 150ms; }
.duration-200 { animation-duration: 200ms; }
.duration-300 { animation-duration: 300ms; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }
.duration-1000 { animation-duration: 1000ms; }

/* Easing Utilities */
.ease-linear { animation-timing-function: linear; }
.ease-in { animation-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-out { animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in-out { animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.ease-bounce { animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.ease-elastic { animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }

/* Phase 2: Infrastructure-Specific Timing Curves */
.ease-infrastructure { animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.ease-transport { animation-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53); }
.ease-poi { animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.ease-overlay { animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.ease-camera { animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); }

/* 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;
    }
    
    .animate-fade-in-up,
    .animate-scale-bounce,
    .animate-slide-left,
    .animate-stagger-children > *,
    .poi-marker-appear,
    .poi-marker-hover,
    .poi-marker-click,
    .poi-marker-pulse,
    .poi-marker-active,
    .storytelling-slide-in,
    .storytelling-slide-out,
    .storytelling-text-reveal,
    .nav-button-hover,
    .nav-button-click,
    .micro-bounce,
    .micro-scale,
    .micro-shake,
    .micro-glow,
    .layer-transition-infrastructure,
    .layer-transition-transport,
    .layer-transition-poi,
    .layer-transition-out {
        animation: none !important;
        transform: none !important;
        transition: none !important;
    }
    
    .shimmer-effect {
        display: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .poi-marker-enhanced {
        border: 2px solid currentColor;
    }
    
    .shimmer-effect {
        background: linear-gradient(90deg, transparent, currentColor, transparent);
        opacity: 0.3;
    }
}

/* Print Media - Disable Animations */
@media print {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}