/* Unified Animation System */
/* Consolidates animations from multiple sources and prepares for cinematic system */

/* Core Animation Variables */
:root {
    --animation-duration-fast: 0.2s;
    --animation-duration-normal: 0.3s;
    --animation-duration-slow: 0.5s;
    --animation-duration-cinematic: 2s;
    
    --animation-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
    --animation-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
    --animation-ease-sharp: cubic-bezier(0.4, 0, 0.6, 1);
    --animation-ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* HUD System Animations (from hud-layout.css) */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Enhanced HUD Animations */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToBottom {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

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

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

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

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

/* Loading Screen Animations (from loading-screen.css) */
@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.1); 
    }
}

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

/* Button and Interactive Element Animations */
@keyframes buttonHover {
    from {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    to {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px currentColor;
    }
    50% {
        box-shadow: 0 0 20px currentColor;
    }
}

/* Notification Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Educational Content Animations */
@keyframes educationalReveal {
    0% {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    50% {
        transform: translateY(-5px) scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes tabSwitchFade {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 3D Scene and Object Animations */
@keyframes objectSpawn {
    0% {
        transform: scale(0) rotateY(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotateY(90deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes objectDespawn {
    0% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.1) rotateY(-90deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(0) rotateY(-180deg);
        opacity: 0;
    }
}

@keyframes levelTransition {
    0% {
        transform: scale(1);
        filter: blur(0px);
        opacity: 1;
    }
    50% {
        transform: scale(0.8);
        filter: blur(5px);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        filter: blur(0px);
        opacity: 1;
    }
}

/* Cinematic System Preparation Animations */
@keyframes cinematicZoom {
    0% {
        transform: scale(1) translateZ(0);
    }
    50% {
        transform: scale(1.1) translateZ(10px);
    }
    100% {
        transform: scale(1.2) translateZ(20px);
    }
}

@keyframes dataStreamFlow {
    0% {
        transform: translateX(-50px) scale(0.5);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: scale(1);
    }
    80% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        transform: translateX(300px) scale(0.5);
        opacity: 0;
    }
}

@keyframes storyMomentHighlight {
    0% {
        transform: scale(1);
        filter: brightness(1) saturate(1);
        box-shadow: 0 0 0 rgba(247, 147, 26, 0);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.3) saturate(1.2);
        box-shadow: 0 0 30px rgba(247, 147, 26, 0.6);
    }
    100% {
        transform: scale(1);
        filter: brightness(1) saturate(1);
        box-shadow: 0 0 0 rgba(247, 147, 26, 0);
    }
}

/* Animation Utility Classes */
.animate-slide-in-right {
    animation: slideInFromRight var(--animation-duration-normal) var(--animation-ease-decelerate);
}

.animate-slide-in-left {
    animation: slideInFromLeft var(--animation-duration-normal) var(--animation-ease-decelerate);
}

.animate-slide-in-top {
    animation: slideInFromTop var(--animation-duration-normal) var(--animation-ease-decelerate);
}

.animate-slide-in-bottom {
    animation: slideInFromBottom var(--animation-duration-normal) var(--animation-ease-decelerate);
}

.animate-fade-in {
    animation: fadeIn var(--animation-duration-normal) var(--animation-ease-standard);
}

.animate-fade-in-up {
    animation: fadeInUp var(--animation-duration-normal) var(--animation-ease-decelerate);
}

.animate-fade-out {
    animation: fadeOut var(--animation-duration-normal) var(--animation-ease-standard);
}

.animate-scale-in {
    animation: scaleIn var(--animation-duration-normal) var(--animation-ease-bounce);
}

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

.animate-educational-reveal {
    animation: educationalReveal var(--animation-duration-slow) var(--animation-ease-decelerate);
}

.animate-object-spawn {
    animation: objectSpawn 1s var(--animation-ease-bounce);
}

.animate-level-transition {
    animation: levelTransition var(--animation-duration-cinematic) var(--animation-ease-standard);
}

.animate-story-highlight {
    animation: storyMomentHighlight 3s var(--animation-ease-standard);
}

.animate-data-flow {
    animation: dataStreamFlow 4s linear infinite;
}

/* Performance Optimizations */
.animate-gpu {
    transform: translateZ(0);
    will-change: transform, opacity;
}

.animate-composite {
    will-change: transform, opacity, filter;
}

/* Pause and Resume Animation States */
.animations-paused,
.animations-paused * {
    animation-play-state: paused !important;
}

.animations-resumed,
.animations-resumed * {
    animation-play-state: running !important;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    :root {
        --animation-duration-fast: 0.1s;
        --animation-duration-normal: 0.15s;
        --animation-duration-slow: 0.2s;
        --animation-duration-cinematic: 0.3s;
    }
    
    .animate-slide-in-right,
    .animate-slide-in-left,
    .animate-slide-in-top,
    .animate-slide-in-bottom,
    .animate-scale-in,
    .animate-bounce-in,
    .animate-educational-reveal,
    .animate-object-spawn,
    .animate-level-transition,
    .animate-story-highlight,
    .animate-data-flow {
        animation-duration: var(--animation-duration-fast);
        animation-timing-function: linear;
    }
    
    /* Disable complex animations entirely for reduced motion */
    .animate-bounce-in,
    .animate-object-spawn,
    .animate-story-highlight,
    .animate-data-flow {
        animation: fadeIn var(--animation-duration-fast) linear;
    }
}

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