/**
 * Music Visualizer Styles
 * Pure CSS animations for different visualization types
 */

/* ========================================
   Base Visualizer Container
   ======================================== */

.visualizer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #0d021a 0%, #1a0033 100%);
    border-radius: var(--radius-md, 0.5rem);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visualizer-title {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    z-index: 10;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-family: var(--font-display, sans-serif);
    padding: 0 1rem;
}

/* ========================================
   Album Art Visualizer
   ======================================== */

.visualizer-album-art {
    width: 100%;
    height: 100%;
    position: relative;
}

.album-art-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.4);
    transform: scale(1.1);
}

.album-art-overlay {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.album-art-disc {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a0033, #2d1b4e);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 5px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.album-art-disc img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.album-art-disc i {
    font-size: 6rem;
    color: rgba(255, 255, 255, 0.3);
}

.album-art-spinning {
    animation: spin 10s linear infinite;
}

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

/* Audio Wave Indicator (under album art) */
.audio-wave-indicator {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 30px;
}

.audio-wave-indicator span {
    width: 4px;
    background: var(--color-primary, #ff00c1);
    border-radius: 2px;
    animation: wave-bounce 1s ease-in-out infinite;
}

.audio-wave-indicator span:nth-child(1) { animation-delay: 0s; height: 40%; }
.audio-wave-indicator span:nth-child(2) { animation-delay: 0.1s; height: 70%; }
.audio-wave-indicator span:nth-child(3) { animation-delay: 0.2s; height: 50%; }
.audio-wave-indicator span:nth-child(4) { animation-delay: 0.3s; height: 80%; }
.audio-wave-indicator span:nth-child(5) { animation-delay: 0.4s; height: 60%; }

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

/* ========================================
   Animated Bars Visualizer
   ======================================== */

.visualizer-bars {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 2rem;
}

.bars-container {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 60%;
    width: 100%;
    max-width: 800px;
}

.visualizer-bar {
    flex: 1;
    background: var(--color-primary, #ff00c1);
    border-radius: 4px 4px 0 0;
    min-height: 5%;
    animation: bar-pulse 1.5s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    transform-origin: bottom;
    box-shadow: 0 -2px 10px rgba(255, 0, 193, 0.5);
}

@keyframes bar-pulse {
    0%, 100% { 
        height: var(--height, 30%);
        opacity: 0.8;
    }
    50% { 
        height: calc(var(--height, 30%) * 1.5);
        opacity: 1;
    }
}

/* ========================================
   Sine Wave Visualizer
   ======================================== */

.visualizer-wave {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wave-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.wave-path {
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 10px currentColor);
}

/* ========================================
   Particle Field Visualizer
   ======================================== */

.visualizer-particles {
    width: 100%;
    height: 100%;
    position: relative;
    background: radial-gradient(circle at center, rgba(26, 0, 51, 0.8), #0d021a);
}

.particle {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    animation: float-particle 4s ease-in-out infinite;
    opacity: 0;
}

@keyframes float-particle {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translate(
            calc(var(--random-x, 0) * 1px), 
            calc(var(--random-y, 0) * 1px)
        ) scale(1);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(var(--random-x, 0) * 2px), 
            calc(var(--random-y, 0) * 2px)
        ) scale(0);
        opacity: 0;
    }
}

/* Generate random movement for particles */
.particle:nth-child(odd) {
    --random-x: 50;
    --random-y: -30;
}

.particle:nth-child(even) {
    --random-x: -40;
    --random-y: 40;
}

.particle:nth-child(3n) {
    --random-x: 30;
    --random-y: 50;
}

.particle:nth-child(5n) {
    --random-x: -50;
    --random-y: -40;
}

/* ========================================
   Spectrum Circles Visualizer
   ======================================== */

.visualizer-circles {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circles-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-circle {
    position: absolute;
    border: 3px solid var(--color-primary, #ff00c1);
    border-radius: 50%;
    width: 100%;
    height: 100%;
    animation: pulse-expand 2s ease-out infinite;
    animation-delay: var(--delay, 0s);
    opacity: 0;
}

@keyframes pulse-expand {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .visualizer-title {
        font-size: 1.2rem;
        bottom: 1rem;
    }
    
    .album-art-disc {
        width: 180px;
        height: 180px;
    }
    
    .album-art-disc i {
        font-size: 4rem;
    }
    
    .circles-container {
        width: 200px;
        height: 200px;
    }
    
    .bars-container {
        gap: 2px;
    }
}

/* ========================================
   Loading State
   ======================================== */

.visualizer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
}

.visualizer-loading i {
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

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

/* ========================================
   Theme Integration
   ======================================== */

/* These styles inherit from theme variables */
.visualizer-container {
    border: 1px solid var(--color-border-primary, rgba(255, 0, 193, 0.2));
}

.visualizer-bar {
    background: var(--color-primary, #ff00c1);
    box-shadow: 0 -2px 10px var(--color-primary, #ff00c1);
}

.pulse-circle {
    border-color: var(--color-primary, #ff00c1);
}

.audio-wave-indicator span {
    background: var(--color-primary, #ff00c1);
}
