/* --- START OF FILE /static/shared/audio-visualizer.css --- */
/* 
 * NANOVERSE Universal Audio Visualizer
 * A futuristic, cinematic, dynamic animated visualizer for audio assets
 * Used across Studio, Aura Labs, Community, and Projects views
 */

/* === CSS Variables (inherits from parent or uses fallbacks) === */
.nv-audio-visualizer {
    --viz-primary: var(--accent-blue, #00c3ff);
    --viz-secondary: var(--accent-purple, #9d5dff);
    --viz-tertiary: #ff00aa;
    --viz-bg: rgba(0, 0, 0, 0.4);
    --viz-glow-primary: rgba(0, 195, 255, 0.5);
    --viz-glow-secondary: rgba(157, 93, 255, 0.5);
    --viz-text: var(--text-primary, #e6e6ff);
    --viz-text-muted: var(--text-secondary, #a0a0cc);
    --viz-border: var(--border-color, rgba(65, 78, 143, 0.4));
}

/* === Main Visualizer Container === */
.nv-audio-visualizer {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 24px;
    background: linear-gradient(145deg, rgba(10, 12, 30, 0.85), rgba(5, 5, 15, 0.95));
    border-radius: 16px;
    border: 1px solid var(--viz-border);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Ambient glow effect */
.nv-audio-visualizer::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(0, 195, 255, 0.08) 0%, transparent 50%);
    animation: ambientPulse 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes ambientPulse {
    0%, 100% { opacity: 0.5; transform: scale(0.95) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.05) rotate(180deg); }
}

/* === Waveform Visualizer Canvas === */
.nv-viz-waveform-container {
    position: relative;
    height: 100px;
    margin-bottom: 20px;
    background: var(--viz-bg);
    border-radius: 12px;
    overflow: hidden;
    z-index: 1;
}

/* Canvas-based waveform */
.nv-viz-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Bar-based waveform (CSS fallback) */
.nv-viz-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    padding: 15px 20px;
}

.nv-viz-bar {
    width: 4px;
    min-width: 3px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--viz-primary), var(--viz-secondary));
    border-radius: 4px;
    transform-origin: center;
    animation: vizBarPulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 8px var(--viz-glow-primary);
}

/* Create staggered animation for each bar */
.nv-viz-bar:nth-child(1) { height: 30%; animation-delay: 0s; }
.nv-viz-bar:nth-child(2) { height: 50%; animation-delay: 0.05s; }
.nv-viz-bar:nth-child(3) { height: 70%; animation-delay: 0.1s; }
.nv-viz-bar:nth-child(4) { height: 90%; animation-delay: 0.15s; }
.nv-viz-bar:nth-child(5) { height: 65%; animation-delay: 0.2s; }
.nv-viz-bar:nth-child(6) { height: 80%; animation-delay: 0.25s; }
.nv-viz-bar:nth-child(7) { height: 55%; animation-delay: 0.3s; }
.nv-viz-bar:nth-child(8) { height: 75%; animation-delay: 0.35s; }
.nv-viz-bar:nth-child(9) { height: 45%; animation-delay: 0.4s; }
.nv-viz-bar:nth-child(10) { height: 85%; animation-delay: 0.45s; }
.nv-viz-bar:nth-child(11) { height: 60%; animation-delay: 0.5s; }
.nv-viz-bar:nth-child(12) { height: 95%; animation-delay: 0.55s; }
.nv-viz-bar:nth-child(13) { height: 70%; animation-delay: 0.6s; }
.nv-viz-bar:nth-child(14) { height: 50%; animation-delay: 0.65s; }
.nv-viz-bar:nth-child(15) { height: 80%; animation-delay: 0.7s; }
.nv-viz-bar:nth-child(16) { height: 40%; animation-delay: 0.75s; }
.nv-viz-bar:nth-child(17) { height: 65%; animation-delay: 0.8s; }
.nv-viz-bar:nth-child(18) { height: 55%; animation-delay: 0.85s; }
.nv-viz-bar:nth-child(19) { height: 75%; animation-delay: 0.9s; }
.nv-viz-bar:nth-child(20) { height: 35%; animation-delay: 0.95s; }
.nv-viz-bar:nth-child(21) { height: 60%; animation-delay: 1s; }
.nv-viz-bar:nth-child(22) { height: 85%; animation-delay: 1.05s; }
.nv-viz-bar:nth-child(23) { height: 50%; animation-delay: 1.1s; }
.nv-viz-bar:nth-child(24) { height: 70%; animation-delay: 1.15s; }

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

/* Paused state */
.nv-audio-visualizer.paused .nv-viz-bar {
    animation-play-state: paused;
    opacity: 0.4;
}

/* === Circular Visualizer Mode === */
.nv-viz-circular {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nv-viz-circular-rings {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.nv-viz-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: ringPulse 2s ease-in-out infinite;
}

.nv-viz-ring:nth-child(1) {
    inset: 0;
    border-color: var(--viz-primary);
    animation-delay: 0s;
    box-shadow: 0 0 20px var(--viz-glow-primary);
}
.nv-viz-ring:nth-child(2) {
    inset: 15px;
    border-color: var(--viz-secondary);
    animation-delay: 0.3s;
    box-shadow: 0 0 15px var(--viz-glow-secondary);
}
.nv-viz-ring:nth-child(3) {
    inset: 30px;
    border-color: var(--viz-tertiary);
    animation-delay: 0.6s;
    box-shadow: 0 0 10px rgba(255, 0, 170, 0.4);
}

@keyframes ringPulse {
    0%, 100% { transform: scale(0.95); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 1; }
}

.nv-viz-circular-core {
    position: relative;
    z-index: 2;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--viz-primary), var(--viz-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 0 30px var(--viz-glow-primary),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nv-viz-circular-core:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 40px var(--viz-glow-primary),
        0 0 60px var(--viz-glow-secondary);
}

.nv-viz-circular-core i {
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* === Player Controls === */
.nv-viz-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    z-index: 1;
    position: relative;
}

.nv-viz-play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--viz-primary), var(--viz-secondary));
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px var(--viz-glow-primary);
    flex-shrink: 0;
}

.nv-viz-play-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 25px var(--viz-glow-primary);
}

.nv-viz-play-btn:disabled {
    background: rgba(100, 100, 120, 0.5);
    cursor: not-allowed;
    box-shadow: none;
}

/* Timeline/Progress */
.nv-viz-timeline {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nv-viz-progress-wrapper {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.nv-viz-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--viz-primary), var(--viz-secondary));
    border-radius: 4px;
    position: relative;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--viz-glow-primary);
}

.nv-viz-progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px var(--viz-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nv-viz-progress-wrapper:hover .nv-viz-progress-bar::after {
    opacity: 1;
}

/* Time display */
.nv-viz-time {
    display: flex;
    justify-content: space-between;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--viz-text-muted);
}

/* Volume control */
.nv-viz-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nv-viz-volume-icon {
    color: var(--viz-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nv-viz-volume-icon:hover {
    color: var(--viz-primary);
}

.nv-viz-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
}

.nv-viz-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--viz-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--viz-glow-primary);
}

.nv-viz-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--viz-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px var(--viz-glow-primary);
}

/* === Track Info === */
.nv-viz-info {
    margin-top: 16px;
    text-align: center;
    z-index: 1;
    position: relative;
}

.nv-viz-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--viz-text);
    margin-bottom: 4px;
    text-shadow: 0 0 10px var(--viz-glow-primary);
}

.nv-viz-subtitle {
    font-size: 0.85rem;
    color: var(--viz-text-muted);
}

/* === Action Buttons === */
.nv-viz-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    z-index: 1;
    position: relative;
}

.nv-viz-action-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--viz-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--viz-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.nv-viz-action-btn:hover {
    background: rgba(0, 195, 255, 0.1);
    border-color: var(--viz-primary);
    color: var(--viz-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--viz-glow-primary);
}

.nv-viz-action-btn i {
    font-size: 0.9rem;
}

/* === Compact Mode (for cards/lists) === */
.nv-audio-visualizer.compact {
    max-width: 100%;
    padding: 16px;
}

.nv-audio-visualizer.compact .nv-viz-waveform-container {
    height: 60px;
    margin-bottom: 12px;
}

.nv-audio-visualizer.compact .nv-viz-controls {
    padding: 8px 12px;
    gap: 12px;
}

.nv-audio-visualizer.compact .nv-viz-play-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.nv-audio-visualizer.compact .nv-viz-info {
    margin-top: 12px;
}

.nv-audio-visualizer.compact .nv-viz-title {
    font-size: 0.95rem;
}

.nv-audio-visualizer.compact .nv-viz-actions {
    margin-top: 12px;
}

.nv-audio-visualizer.compact .nv-viz-action-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
}

/* === Mini Mode (for inline players) === */
.nv-audio-visualizer.mini {
    max-width: 100%;
    padding: 12px;
    border-radius: 10px;
}

.nv-audio-visualizer.mini::before {
    display: none;
}

.nv-audio-visualizer.mini .nv-viz-waveform-container {
    height: 40px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.nv-audio-visualizer.mini .nv-viz-bar {
    width: 3px;
}

.nv-audio-visualizer.mini .nv-viz-controls {
    padding: 6px 10px;
    gap: 10px;
}

.nv-audio-visualizer.mini .nv-viz-play-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

.nv-audio-visualizer.mini .nv-viz-volume {
    display: none;
}

.nv-audio-visualizer.mini .nv-viz-info,
.nv-audio-visualizer.mini .nv-viz-actions {
    display: none;
}

/* === Podcast Mode (larger, more cinematic) === */
.nv-audio-visualizer.podcast {
    max-width: 800px;
    padding: 30px;
    background: linear-gradient(145deg, rgba(15, 15, 35, 0.95), rgba(5, 5, 15, 0.98));
}

.nv-audio-visualizer.podcast .nv-viz-waveform-container {
    height: 120px;
    margin-bottom: 24px;
}

.nv-audio-visualizer.podcast .nv-viz-bar {
    width: 5px;
}

.nv-audio-visualizer.podcast .nv-viz-play-btn {
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
}

/* === Color Themes === */
/* Music theme (magenta/cyan) */
.nv-audio-visualizer.theme-music {
    --viz-primary: #ff00aa;
    --viz-secondary: #00ffcc;
    --viz-glow-primary: rgba(255, 0, 170, 0.5);
    --viz-glow-secondary: rgba(0, 255, 204, 0.5);
}

/* Podcast theme (orange/purple) */
.nv-audio-visualizer.theme-podcast {
    --viz-primary: #ff6b00;
    --viz-secondary: #a855f7;
    --viz-glow-primary: rgba(255, 107, 0, 0.5);
    --viz-glow-secondary: rgba(168, 85, 247, 0.5);
}

/* Studio theme (blue/green) */
.nv-audio-visualizer.theme-studio {
    --viz-primary: #00c3ff;
    --viz-secondary: #00ff88;
    --viz-glow-primary: rgba(0, 195, 255, 0.5);
    --viz-glow-secondary: rgba(0, 255, 136, 0.5);
}

/* === Responsive === */
@media (max-width: 640px) {
    .nv-audio-visualizer {
        padding: 16px;
        border-radius: 12px;
    }
    
    .nv-viz-waveform-container {
        height: 70px;
    }
    
    .nv-viz-controls {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .nv-viz-volume {
        width: 100%;
        justify-content: center;
    }
    
    .nv-viz-volume-slider {
        width: 120px;
    }
    
    .nv-viz-actions {
        flex-wrap: wrap;
    }
    
    .nv-viz-action-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

/* === Hidden audio element === */
.nv-audio-visualizer audio {
    display: none;
}

/* --- END OF FILE /static/shared/audio-visualizer.css --- */
