/**
 * DASHCUBE - Animation Styles
 * Keyframes and Animation Utilities
 */

/* ============================================
   FADE ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* ============================================
   SLIDE ANIMATIONS
   ============================================ */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

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

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

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

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ============================================
   NEON & GLOW ANIMATIONS
   ============================================ */
@keyframes neonPulse {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--primary),
            0 0 10px var(--primary),
            0 0 20px var(--primary-glow);
    }
    50% {
        box-shadow: 
            0 0 10px var(--primary),
            0 0 20px var(--primary),
            0 0 40px var(--primary-glow);
    }
}

@keyframes neonPulseSecondary {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--secondary),
            0 0 10px var(--secondary),
            0 0 20px var(--secondary-glow);
    }
    50% {
        box-shadow: 
            0 0 10px var(--secondary),
            0 0 20px var(--secondary),
            0 0 40px var(--secondary-glow);
    }
}

@keyframes neonPulseAccent {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--accent),
            0 0 10px var(--accent),
            0 0 20px var(--accent-glow);
    }
    50% {
        box-shadow: 
            0 0 10px var(--accent),
            0 0 20px var(--accent),
            0 0 40px var(--accent-glow);
    }
}

@keyframes glow {
    0%, 100% {
        filter: drop-shadow(0 0 5px var(--primary)) drop-shadow(0 0 10px var(--primary-glow));
    }
    50% {
        filter: drop-shadow(0 0 10px var(--primary)) drop-shadow(0 0 20px var(--primary-glow));
    }
}

@keyframes glowText {
    0%, 100% {
        text-shadow: 0 0 10px var(--primary-glow);
    }
    50% {
        text-shadow: 0 0 20px var(--primary), 0 0 30px var(--primary-glow);
    }
}

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

/* ============================================
   FLOATING ANIMATIONS
   ============================================ */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes floatX {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(10px);
    }
}

/* ============================================
   ROTATE ANIMATIONS
   ============================================ */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

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

/* ============================================
   BOUNCE ANIMATIONS
   ============================================ */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

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

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

/* ============================================
   CHART DRAWING ANIMATIONS
   ============================================ */
@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

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

@keyframes growBar {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */
@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes loadingBar {
    0% {
        left: -40%;
    }
    100% {
        left: 100%;
    }
}

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

/* ============================================
   RIPPLE ANIMATIONS
   ============================================ */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   HEARTBEAT ANIMATIONS
   ============================================ */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* ============================================
   BLINK ANIMATIONS
   ============================================ */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   WAVE ANIMATIONS
   ============================================ */
@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(5px);
    }
}

/* ============================================
   FLIP ANIMATIONS
   ============================================ */
@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

@keyframes flipInX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateX(0);
        opacity: 1;
    }
}

/* ============================================
   ZOOM ANIMATIONS
   ============================================ */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    50% {
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
    }
    50% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    to {
        opacity: 0;
    }
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */
@keyframes glitch {
    0% {
        clip-path: inset(40% 0 61% 0);
        transform: translate(-2px, 2px);
    }
    20% {
        clip-path: inset(92% 0 1% 0);
        transform: translate(2px, -2px);
    }
    40% {
        clip-path: inset(43% 0 1% 0);
        transform: translate(-2px, 2px);
    }
    60% {
        clip-path: inset(25% 0 58% 0);
        transform: translate(2px, -2px);
    }
    80% {
        clip-path: inset(54% 0 7% 0);
        transform: translate(-2px, 2px);
    }
    100% {
        clip-path: inset(58% 0 43% 0);
        transform: translate(2px, -2px);
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */
.animate {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.animate-fast {
    animation-duration: 0.3s;
}

.animate-slow {
    animation-duration: 0.8s;
}

.animate-slower {
    animation-duration: 1.2s;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Animation Types */
.animate-fadeIn { animation-name: fadeIn; }
.animate-fadeOut { animation-name: fadeOut; }
.animate-fadeInUp { animation-name: fadeInUp; }
.animate-fadeInDown { animation-name: fadeInDown; }
.animate-fadeInLeft { animation-name: fadeInLeft; }
.animate-fadeInRight { animation-name: fadeInRight; }
.animate-fadeInScale { animation-name: fadeInScale; }

.animate-slideInUp { animation-name: slideInUp; }
.animate-slideInDown { animation-name: slideInDown; }
.animate-slideInLeft { animation-name: slideInLeft; }
.animate-slideInRight { animation-name: slideInRight; }

.animate-scaleIn { animation-name: scaleIn; }
.animate-scaleOut { animation-name: scaleOut; }

.animate-bounce { animation-name: bounce; }
.animate-bounceIn { animation-name: bounceIn; }

.animate-pulse { animation-name: pulse; }
.animate-pulse-ring { animation-name: pulse-ring; }

.animate-shake { animation-name: shake; }

.animate-rotate { animation-name: rotate; }
.animate-spin { animation-name: spin; }

.animate-float { animation-name: float; }
.animate-float-slow { animation-name: floatSlow; }

.animate-glow { animation-name: glow; }
.animate-glow-text { animation-name: glowText; }

.animate-neon { animation-name: neonPulse; }
.animate-neon-secondary { animation-name: neonPulseSecondary; }
.animate-neon-accent { animation-name: neonPulseAccent; }

.animate-gradient { 
    animation-name: gradientShift; 
    animation-duration: 3s;
    background-size: 200% 200%;
}

.animate-flip { animation-name: flip; }
.animate-flipInX { animation-name: flipInX; }

.animate-zoomIn { animation-name: zoomIn; }
.animate-zoomOut { animation-name: zoomOut; }

.animate-heartbeat { animation-name: heartbeat; }
.animate-blink { animation-name: blink; }

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

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

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 30px var(--primary-glow);
}

.hover-rotate {
    transition: transform var(--transition-fast);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Stagger Children Animation */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Card Hover Effects */
.card-hover {
    transition: all var(--transition-base);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        var(--shadow-xl),
        0 0 40px var(--primary-glow);
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* Neon Border Animation */
.neon-border {
    position: relative;
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.neon-border:hover::before {
    opacity: 1;
    animation: gradientRotate 3s linear infinite;
}

/* Scanline Effect */
.scanlines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    color: var(--secondary);
    animation: glitch 2s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
    color: var(--accent);
    animation: glitch 3s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

/* Loading States */
.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-elevated) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Progress Animation */
.progress-animate {
    position: relative;
    overflow: hidden;
}

.progress-animate::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: loadingBar 1.5s infinite;
}
