/* ================================
   COMFYUI NOISE - ANIMATIONS
   Node-specific visual animations
   ================================ */

/* COMMON ANIMATION KEYFRAMES */
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

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

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

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--accent-color); }
    50% { box-shadow: 0 0 15px var(--accent-color), 0 0 25px var(--accent-color); }
}

/* ================================
   NOISE GENERATOR ANIMATIONS
   ================================ */

/* Waveform lines animation */
.waveform {
    animation: wave 1.2s ease-in-out infinite;
}

.waveform:nth-child(1) { animation-delay: 0s; }
.waveform:nth-child(2) { animation-delay: 0.2s; }
.waveform:nth-child(3) { animation-delay: 0.4s; }
.waveform:nth-child(4) { animation-delay: 0.6s; }
.waveform:nth-child(5) { animation-delay: 0.8s; }

/* Signal circle pulse */
.signal-circle {
    animation: pulse 2s ease-in-out infinite;
}

/* Frequency bars animation */
.frequency-bars .bar {
    animation: wave 0.8s ease-in-out infinite;
}

.frequency-bars .bar:nth-child(1) { animation-delay: 0s; }
.frequency-bars .bar:nth-child(2) { animation-delay: 0.1s; }
.frequency-bars .bar:nth-child(3) { animation-delay: 0.2s; }
.frequency-bars .bar:nth-child(4) { animation-delay: 0.3s; }
.frequency-bars .bar:nth-child(5) { animation-delay: 0.4s; }
.frequency-bars .bar:nth-child(6) { animation-delay: 0.5s; }
.frequency-bars .bar:nth-child(7) { animation-delay: 0.6s; }

/* ================================
   PERLIN NOISE ANIMATIONS
   ================================ */

/* Organic layers flow */
.organic-layer {
    animation: organicFlow 8s ease-in-out infinite;
}

.organic-layer:nth-child(1) { animation-delay: 0s; }
.organic-layer:nth-child(2) { animation-delay: 2s; }
.organic-layer:nth-child(3) { animation-delay: 4s; }

@keyframes organicFlow {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(0.8) rotate(0deg);
    }
    25% { 
        opacity: 0.6;
        transform: scale(1.2) rotate(90deg);
    }
    50% { 
        opacity: 0.4;
        transform: scale(0.9) rotate(180deg);
    }
    75% { 
        opacity: 0.7;
        transform: scale(1.1) rotate(270deg);
    }
}

/* Fractal center pulse */
.fractal-center {
    animation: pulse 3s ease-in-out infinite;
}

/* Perlin octaves wave animation */
.perlin-octaves .octave {
    animation: octaveWave 2s ease-in-out infinite;
}

.perlin-octaves .octave:nth-child(1) { animation-delay: 0s; }
.perlin-octaves .octave:nth-child(2) { animation-delay: 0.3s; }
.perlin-octaves .octave:nth-child(3) { animation-delay: 0.6s; }
.perlin-octaves .octave:nth-child(4) { animation-delay: 0.9s; }
.perlin-octaves .octave:nth-child(5) { animation-delay: 1.2s; }
.perlin-octaves .octave:nth-child(6) { animation-delay: 1.5s; }

@keyframes octaveWave {
    0%, 100% { opacity: 0.4; transform: scaleY(1); }
    50% { opacity: 0.8; transform: scaleY(1.5); }
}

/* ================================
   TRUE CHAOS ANIMATIONS
   ================================ */

/* Attractor space pulse */
.attractor-space {
    animation: pulse 4s ease-in-out infinite;
}

/* Lorenz attractor trajectories */
.lorenz-attractor .trajectory {
    animation: chaosTrajectory 6s linear infinite;
}

.lorenz-attractor .trajectory:nth-child(1) { animation-delay: 0s; }
.lorenz-attractor .trajectory:nth-child(2) { animation-delay: 1.5s; }
.lorenz-attractor .trajectory:nth-child(3) { animation-delay: 3s; }
.lorenz-attractor .trajectory:nth-child(4) { animation-delay: 4.5s; }

@keyframes chaosTrajectory {
    0% { 
        transform: translate(0, 0) rotate(0deg); 
        opacity: 1; 
    }
    25% { 
        transform: translate(80px, -40px) rotate(90deg); 
        opacity: 0.8; 
    }
    50% { 
        transform: translate(-60px, -80px) rotate(180deg); 
        opacity: 0.6; 
    }
    75% { 
        transform: translate(-100px, 60px) rotate(270deg); 
        opacity: 0.4; 
    }
    100% { 
        transform: translate(0, 0) rotate(360deg); 
        opacity: 0.2; 
    }
}

/* Phase space animation */
.phase-space {
    animation: rotate 20s linear infinite;
}

/* Chaos parameter indicators */
.chaos-parameters .param-indicator {
    animation: pulse 1.5s ease-in-out infinite;
}

.chaos-parameters .param-indicator:nth-child(1) { animation-delay: 0s; }
.chaos-parameters .param-indicator:nth-child(2) { animation-delay: 0.3s; }
.chaos-parameters .param-indicator:nth-child(3) { animation-delay: 0.6s; }
.chaos-parameters .param-indicator:nth-child(4) { animation-delay: 0.9s; }
.chaos-parameters .param-indicator:nth-child(5) { animation-delay: 1.2s; }

/* ================================
   AUDIO ANALYZER ANIMATIONS
   ================================ */

/* Spectrum analyzer bars */
.spectrum-analyzer .spectrum-bar {
    animation: spectrumBounce 0.8s ease-in-out infinite;
}

.spectrum-analyzer .spectrum-bar:nth-child(1) { animation-delay: 0s; }
.spectrum-analyzer .spectrum-bar:nth-child(2) { animation-delay: 0.1s; }
.spectrum-analyzer .spectrum-bar:nth-child(3) { animation-delay: 0.2s; }
.spectrum-analyzer .spectrum-bar:nth-child(4) { animation-delay: 0.3s; }
.spectrum-analyzer .spectrum-bar:nth-child(5) { animation-delay: 0.4s; }
.spectrum-analyzer .spectrum-bar:nth-child(6) { animation-delay: 0.5s; }
.spectrum-analyzer .spectrum-bar:nth-child(7) { animation-delay: 0.6s; }
.spectrum-analyzer .spectrum-bar:nth-child(8) { animation-delay: 0.7s; }
.spectrum-analyzer .spectrum-bar:nth-child(9) { animation-delay: 0.8s; }
.spectrum-analyzer .spectrum-bar:nth-child(10) { animation-delay: 0.9s; }

@keyframes spectrumBounce {
    0%, 100% { 
        opacity: 0.4; 
        transform: scaleY(0.5);
    }
    50% { 
        opacity: 1; 
        transform: scaleY(1);
    }
}

/* RMS and Peak meters */
.rms-level, .peak-level {
    animation: meterFlicker 2s ease-in-out infinite;
}

@keyframes meterFlicker {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0.7; }
}

/* Analysis readouts */
.analysis-readouts .readout {
    animation: readoutUpdate 3s ease-in-out infinite;
}

.analysis-readouts .readout:nth-child(1) { animation-delay: 0s; }
.analysis-readouts .readout:nth-child(2) { animation-delay: 0.75s; }
.analysis-readouts .readout:nth-child(3) { animation-delay: 1.5s; }
.analysis-readouts .readout:nth-child(4) { animation-delay: 2.25s; }

@keyframes readoutUpdate {
    0%, 80%, 100% { opacity: 1; transform: scale(1); }
    90% { opacity: 0.8; transform: scale(1.05); }
}

/* ================================
   GRANULAR PROCESSOR ANIMATIONS
   ================================ */

/* Individual grains floating */
.grain {
    animation: grainFloat 4s ease-in-out infinite;
}

@keyframes grainFloat {
    0% { 
        transform: translate(0, 100px) scale(0);
        opacity: 0;
    }
    50% { 
        transform: translate(100px, 50px) scale(1);
        opacity: 0.8;
    }
    100% { 
        transform: translate(200px, 0) scale(0);
        opacity: 0;
    }
}

/* ================================
   MULTI-DISTORTION ANIMATIONS
   ================================ */

/* Input wave (clean) */
.input-wave {
    animation: cleanWave 2s ease-in-out infinite;
}

/* Output wave (distorted) */
.output-wave {
    animation: distortedWave 2s ease-in-out infinite;
}

@keyframes cleanWave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.5); }
}

@keyframes distortedWave {
    0%, 100% { transform: scaleY(1) scaleX(1); }
    25% { transform: scaleY(0.3) scaleX(1.2); }
    50% { transform: scaleY(1.5) scaleX(0.8); }
    75% { transform: scaleY(0.7) scaleX(1.3); }
}

/* ================================
   HARSH FILTER ANIMATIONS
   ================================ */

/* Filter sweep animation */
.filter-sweep {
    animation: sweepFrequency 3s ease-in-out infinite;
}

@keyframes sweepFrequency {
    0%, 100% { transform: translateX(0); opacity: 0.6; }
    50% { transform: translateX(200px); opacity: 1; }
}

/* ================================
   AUDIO MIXER ANIMATIONS
   ================================ */

/* Mixer channels */
.mixer-channels .channel {
    animation: channelLevel 1.5s ease-in-out infinite;
}

.mixer-channels .channel:nth-child(1) { animation-delay: 0s; }
.mixer-channels .channel:nth-child(2) { animation-delay: 0.3s; }
.mixer-channels .channel:nth-child(3) { animation-delay: 0.6s; }
.mixer-channels .channel:nth-child(4) { animation-delay: 0.9s; }

@keyframes channelLevel {
    0%, 100% { opacity: 0.5; transform: scaleY(0.7); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ================================
   CONVOLUTION REVERB ANIMATIONS
   ================================ */

/* Reverb impulse decay */
.reverb-impulse {
    animation: impulseDecay 5s ease-out infinite;
}

@keyframes impulseDecay {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.1; transform: scale(0.1); }
}

/* ================================
   MODULATION MATRIX ANIMATIONS
   ================================ */

/* Matrix display container */
.matrix-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
}

/* Matrix header styling */
.matrix-header {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 10px;
}

/* Modulation sources grid */
.modulation-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.mod-source {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.source-label {
    color: #ccc;
    font-size: 10px;
    font-weight: bold;
}

.source-wave {
    width: 20px;
    height: 8px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-color) 50%, transparent 100%);
    border-radius: 2px;
    animation: sourceModulation 1.5s ease-in-out infinite;
}

.mod-source:nth-child(1) .source-wave { animation-delay: 0s; }
.mod-source:nth-child(2) .source-wave { animation-delay: 0.3s; }
.mod-source:nth-child(3) .source-wave { animation-delay: 0.6s; }
.mod-source:nth-child(4) .source-wave { animation-delay: 0.9s; }

@keyframes sourceModulation {
    0%, 100% { 
        opacity: 0.4; 
        transform: scaleX(0.8);
    }
    50% { 
        opacity: 1; 
        transform: scaleX(1.2);
    }
}

/* Routing matrix grid */
.routing-matrix {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 10px 0;
}

.matrix-row {
    display: flex;
    gap: 3px;
}

.routing-matrix .matrix-cell {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.routing-matrix .matrix-cell.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    animation: matrixPulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px var(--accent-color);
}

@keyframes matrixPulse {
    0%, 100% { 
        opacity: 0.7; 
        transform: scale(1);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1);
    }
}

/* Signal flow lines */
.signal-flows {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.signal-line {
    position: absolute;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-color) 50%, transparent 100%);
    border-radius: 1px;
    animation: signalFlow 3s linear infinite;
}

.signal-1 {
    top: -20px;
    left: -20px;
    animation-delay: 0s;
}

.signal-2 {
    top: -5px;
    left: 10px;
    animation-delay: 0.75s;
}

.signal-3 {
    top: 10px;
    left: -10px;
    animation-delay: 1.5s;
}

.signal-4 {
    top: 25px;
    left: 20px;
    animation-delay: 2.25s;
}

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

/* Destination targets */
.destination-targets {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.dest-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.target-label {
    color: #ccc;
    font-size: 9px;
    font-weight: bold;
}

.target-meter {
    width: 6px;
    height: 20px;
    background: linear-gradient(180deg, var(--accent-color) 0%, transparent 70%);
    border-radius: 3px;
    animation: meterActivity 2s ease-in-out infinite;
}

.dest-target:nth-child(1) .target-meter { animation-delay: 0s; }
.dest-target:nth-child(2) .target-meter { animation-delay: 0.5s; }
.dest-target:nth-child(3) .target-meter { animation-delay: 1s; }
.dest-target:nth-child(4) .target-meter { animation-delay: 1.5s; }

@keyframes meterActivity {
    0%, 100% { 
        opacity: 0.3; 
        transform: scaleY(0.4);
    }
    50% { 
        opacity: 1; 
        transform: scaleY(1);
    }
}

/* ================================
   GENERAL VISUAL ENHANCEMENTS
   ================================ */

/* Node visual container hover effects */
.node-visual:hover .waveform,
.node-visual:hover .bar,
.node-visual:hover .trajectory,
.node-visual:hover .spectrum-bar,
.node-visual:hover .octave {
    animation-duration: 0.5s;
}

/* Glow effects for accent elements */
.signal-circle,
.fractal-center,
.attractor-space {
    animation: glow 3s ease-in-out infinite;
}

/* Pause animations on reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
} 