/**
 * SpeedSight Animations
 * Animation keyframes and transitions
 */

/* ========================================
   LOADING ANIMATIONS
   ======================================== */

@keyframes logo-scale-in {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes logo-glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px var(--color-accent-glow));
    }
    50% {
        filter: drop-shadow(0 0 16px var(--color-accent));
    }
}

@keyframes loading-dots {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   GLOW ANIMATIONS
   ======================================== */

@keyframes corner-glow-pulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(0, 194, 255, 0.5);
        opacity: 0.6;
    }
    50% {
        box-shadow: 0 0 24px rgba(0, 194, 255, 0.8);
        opacity: 1;
    }
}

@keyframes border-glow-expand {
    0% {
        box-shadow: 0 0 1px var(--color-accent-glow);
    }
    50% {
        box-shadow: 0 0 6px var(--color-accent-glow);
    }
    100% {
        box-shadow: 0 0 1px var(--color-accent-glow);
    }
}

/* ========================================
   WORD TRANSITION ANIMATIONS
   ======================================== */

@keyframes word-enter {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes word-exit {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.98);
        opacity: 0;
    }
}

@keyframes word-punctuation-hold {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes word-swap {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    45% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    55% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */

@keyframes button-tap {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
}

@keyframes button-bounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.05);
    }
}

@keyframes play-pause-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   MODAL ANIMATIONS
   ======================================== */

@keyframes modal-slide-up {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modal-slide-down {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes modal-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes modal-scale-in {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   TOAST ANIMATIONS
   ======================================== */

@keyframes toast-slide-up {
    0% {
        transform: translateY(100px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toast-slide-down {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100px);
        opacity: 0;
    }
}

/* ========================================
   PROCESSING ANIMATIONS
   ======================================== */

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

@keyframes processing-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes progress-bar-fill {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

@keyframes stage-indicator-active {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--color-accent-glow);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px transparent;
    }
}

/* ========================================
   CARD ANIMATIONS
   ======================================== */

@keyframes card-slide-in {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* ========================================
   CONFETTI ANIMATION
   ======================================== */

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

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

/* ========================================
   RIPPLE EFFECT
   ======================================== */

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ========================================
   SHIMMER EFFECT
   ======================================== */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ========================================
   SKELETON LOADING
   ======================================== */

@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* ========================================
   FADE ANIMATIONS
   ======================================== */

@keyframes fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes fade-out {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ========================================
   SLIDE ANIMATIONS
   ======================================== */

@keyframes slide-in-right {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes slide-out-right {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes slide-in-left {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes slide-out-left {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* ========================================
   ZOOM ANIMATIONS
   ======================================== */

@keyframes zoom-in {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes zoom-out {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(0);
    }
}

/* ========================================
   ROTATION ANIMATIONS
   ======================================== */

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

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

/* ========================================
   BOUNCE ANIMATIONS
   ======================================== */

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* ========================================
   SHAKE ANIMATION
   ======================================== */

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

/* ========================================
   UTILITY ANIMATION CLASSES
   ======================================== */

.animate-fade-in {
    animation: fade-in var(--duration-base) var(--ease-out);
}

.animate-slide-up {
    animation: modal-slide-up var(--duration-slow) var(--ease-out-cubic);
}

.animate-scale-in {
    animation: modal-scale-in var(--duration-slow) var(--ease-out-cubic);
}

.animate-bounce {
    animation: bounce var(--duration-slower) ease-in-out infinite;
}

.animate-spin {
    animation: rotate-clockwise 1s linear infinite;
}

.animate-pulse {
    animation: processing-pulse 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 0%,
        var(--color-border-primary) 50%,
        var(--color-bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ========================================
   TRANSITION UTILITIES
   ======================================== */

.transition-all {
    transition: all var(--transition-base);
}

.transition-transform {
    transition: transform var(--transition-base);
}

.transition-opacity {
    transition: opacity var(--transition-base);
}

.transition-colors {
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

/* ========================================
   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;
    }
}

/* ========================================
   HOVER LIFT EFFECT
   ======================================== */

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.hover-lift:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* ========================================
   GLASSMORPHISM EFFECT
   ======================================== */

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

[data-theme="dark"] .glass-effect {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   INTERACTIVE STATES
   ======================================== */

.interactive {
    position: relative;
    overflow: hidden;
}

.interactive::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-base), height var(--duration-base);
}

.interactive:active::before {
    width: 200px;
    height: 200px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-primary);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: rotate-clockwise 0.8s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border-width: 4px;
}
