/* ========================================
   HealthMetric Dashboard - Animations
   Flying File Names, Transitions, Keyframes
   ======================================== */

/* Flying File Names Animation */
.flying-item {
    position: absolute;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--accent-green);
    opacity: 0.8;
    pointer-events: none;
    user-select: none;
    z-index: 10;
    transition: all 0.3s ease-out;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.flying-item:hover {
    opacity: 1;
    transform: scale(1.1);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
}

/* Ghost Hovering Animation */
@keyframes ghostFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-10px) rotate(1deg);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-5px) rotate(-1deg);
        opacity: 0.7;
    }
    75% {
        transform: translateY(-15px) rotate(0.5deg);
        opacity: 0.9;
    }
}

@keyframes ghostFloatRandom {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.4;
    }
    25% {
        transform: translate(20px, -30px) rotate(5deg);
        opacity: 0.7;
    }
    50% {
        transform: translate(-15px, -20px) rotate(-3deg);
        opacity: 0.5;
    }
    75% {
        transform: translate(25px, -40px) rotate(2deg);
        opacity: 0.8;
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.4;
    }
}

@keyframes ghostFollowMouse {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(var(--mouse-x, 0), var(--mouse-y, 0)) scale(1.2);
        opacity: 0.9;
    }
    100% {
        transform: translate(var(--mouse-x, 0), var(--mouse-y, 0)) scale(1);
        opacity: 0.7;
    }
}

/* Flying Item States */
.flying-item.random {
    animation: ghostFloatRandom 8s ease-in-out infinite;
}

.flying-item.following {
    animation: ghostFollowMouse 2s ease-out infinite;
    opacity: 0.9;
}

.flying-item.attracted {
    animation: ghostFloat 3s ease-in-out infinite;
    opacity: 1;
    transform: scale(1.1);
}

/* Retro Video Game Transition */
@keyframes screenWipe {
    0% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
    }
    50% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    }
}

@keyframes screenWipeReverse {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    }
    50% {
        clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
    }
    100% {
        clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
    }
}

.screen-wipe {
    animation: screenWipe 1.5s ease-in-out;
}

.screen-wipe-reverse {
    animation: screenWipeReverse 1.5s ease-in-out;
}

/* Glitch Effect for Retro Feel */
@keyframes glitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
    20% {
        transform: translate(-2px, 2px);
        filter: hue-rotate(90deg);
    }
    40% {
        transform: translate(-2px, -2px);
        filter: hue-rotate(180deg);
    }
    60% {
        transform: translate(2px, 2px);
        filter: hue-rotate(270deg);
    }
    80% {
        transform: translate(2px, -2px);
        filter: hue-rotate(360deg);
    }
    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

.glitch {
    animation: glitch 0.3s ease-in-out;
}

/* Pulse Animation for Metrics */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

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

/* Glow Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--accent-green);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-green), 0 0 30px var(--accent-green);
    }
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Slide In Animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

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

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.5s ease-out;
}

.slide-in-down {
    animation: slideInDown 0.5s ease-out;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

.bounce {
    animation: bounce 1s ease-in-out;
}

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

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate {
    animation: rotate 1s linear infinite;
}

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.fade-out {
    animation: fadeOut 0.5s ease-in-out;
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

.scale-out {
    animation: scaleOut 0.3s ease-out;
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: var(--accent-green);
    }
}

.typing {
    overflow: hidden;
    border-right: 2px solid var(--accent-green);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

/* Matrix Rain Effect */
@keyframes matrixRain {
    0% {
        transform: translateY(-100vh);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.matrix-rain {
    animation: matrixRain 3s linear infinite;
}

/* Particle System */
@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

.particle {
    animation: particleFloat 4s linear infinite;
}

/* Hover Effects */
.hover-lift {
    transition: transform var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px var(--accent-green);
}

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

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

/* Loading Spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

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

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

/* Stagger Animation Delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }
.stagger-9 { animation-delay: 0.9s; }
.stagger-10 { animation-delay: 1s; }
