/* ===== Animation Styles ===== */

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

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

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

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

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Focus Training Animations */
@keyframes focusNear {
    from {
        transform: scale(1) translateZ(0);
        filter: blur(2px);
    }
    to {
        transform: scale(3.3) translateZ(100px);
        filter: blur(0);
    }
}

@keyframes focusFar {
    from {
        transform: scale(3.3) translateZ(100px);
        filter: blur(0);
    }
    to {
        transform: scale(1) translateZ(0);
        filter: blur(2px);
    }
}

/* Breath Animation for Relaxation */
@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

/* Gradient Shift Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Color Wave Animation */
@keyframes colorWave {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* Blink Animation */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(76, 175, 80, 0.8);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Wave Animation */
@keyframes wave {
    0% {
        d: path('M 0 50 Q 25 25, 50 50 T 100 50');
    }
    50% {
        d: path('M 0 50 Q 25 75, 50 50 T 100 50');
    }
    100% {
        d: path('M 0 50 Q 25 25, 50 50 T 100 50');
    }
}

/* Blur Focus Animation */
@keyframes blurFocus {
    0%, 100% {
        filter: blur(0px);
    }
    50% {
        filter: blur(5px);
    }
}

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

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-30px);
    }
}

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

/* Utility Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

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

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

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

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

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

.float {
    animation: float 3s ease-in-out infinite;
}

.bounce {
    animation: bounce 1s ease infinite;
}

.shake {
    animation: shake 0.5s ease;
}

.blink {
    animation: blink 1.5s ease-in-out infinite;
}

/* Animation Timing Functions */
.ease-smooth {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.ease-slow {
    transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

.ease-fast {
    transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

/* Focus Training Object */
.focus-object {
    will-change: transform;
    transition: transform 2s ease-in-out, filter 2s ease-in-out;
}

/* Relaxation Gradient */
.relax-gradient {
    background: linear-gradient(45deg, #FFE0B2, #FFCC80, #FFA726, #FF9800);
    background-size: 400% 400%;
    animation: gradientShift 10s ease infinite;
}

/* Blink Reminder Dot */
.blink-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #FF9800;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Track Path */
.track-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawPath 3s linear forwards;
}

@keyframes drawPath {
    to {
        stroke-dashoffset: 0;
    }
}

/* Moving Object on Path */
.moving-object {
    offset-path: path('M 50 50 m -40 0 a 40 40 0 1 0 80 0 a 40 40 0 1 0 -80 0');
    offset-distance: 0%;
    animation: movePath 5s linear infinite;
}

@keyframes movePath {
    to {
        offset-distance: 100%;
    }
}

/* Depth Change Effect */
.depth-layer {
    transition: filter 2s ease-in-out;
}

.depth-layer.focused {
    filter: blur(0px);
}

.depth-layer.blurred {
    filter: blur(8px);
}

/* Color Diffusion Effect */
.color-diffusion {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,152,0,0.8) 0%, rgba(255,152,0,0) 70%);
    animation: ripple 3s ease-out infinite;
}

/* Eye Exercise Hint */
.exercise-hint {
    animation: fadeIn 0.5s ease-in-out, fadeOut 0.5s ease-in-out 2.5s;
}

/* Success Feedback */
.success-feedback {
    animation: scaleUp 0.3s ease-in-out, pulse 0.5s ease-in-out 0.3s 2;
}

/* Warning Feedback */
.warning-feedback {
    animation: shake 0.5s ease;
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

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

.gpu-accelerate {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
