/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
}

/* Dark background - no gradient animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: -1;
}

/* Control Panel - Glassmorphism style */
.control-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 340px;
    height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow-y: auto;
    padding: 30px;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.control-panel.hidden {
    transform: translateX(-380px);
    opacity: 0;
}

.control-panel h2 {
    font-size: 28px;
    margin-bottom: 25px;
    color: #fff;
    font-weight: 200;
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.control-section:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h3 {
    font-size: 14px;
    margin-bottom: 18px;
    color: #64b5f6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-section h3::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, #64b5f6, #2196f3);
    border-radius: 2px;
}

.control-section h4 {
    font-size: 12px;
    margin: 20px 0 12px 0;
    color: #4fc3f7;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
    padding-left: 12px;
}

/* EQ Band sections */
.eq-band {
    background: rgba(30, 30, 40, 0.4);
    border: 1px solid rgba(100, 181, 246, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.eq-band > label:first-child {
    font-weight: 600;
    color: #64b5f6;
    margin-bottom: 12px;
}

/* Form Controls */
label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    transition: color 0.2s ease;
}

label:hover {
    color: rgba(255, 255, 255, 0.95);
}

input[type="file"],
input[type="url"] {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

input[type="file"]:hover,
input[type="url"]:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(100, 181, 246, 0.5);
    box-shadow: 0 0 20px rgba(100, 181, 246, 0.2);
}

input[type="file"]:focus,
input[type="url"]:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 30px rgba(100, 181, 246, 0.3);
}

select {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

select:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(100, 181, 246, 0.5);
    box-shadow: 0 0 20px rgba(100, 181, 246, 0.2);
}

select:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 30px rgba(100, 181, 246, 0.3);
}

select option {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
}

/* Sliders */
.slider-container {
    margin-bottom: 20px;
}

.slider-container label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.slider-container span {
    color: #64b5f6;
    font-weight: 600;
    font-size: 14px;
    padding: 4px 12px;
    background: rgba(100, 181, 246, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(100, 181, 246, 0.2);
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, 
        rgba(100, 181, 246, 0.3) 0%, 
        rgba(100, 181, 246, 0.3) var(--value, 50%), 
        rgba(255, 255, 255, 0.1) var(--value, 50%), 
        rgba(255, 255, 255, 0.1) 100%);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

input[type="range"]:hover {
    background: linear-gradient(to right, 
        rgba(100, 181, 246, 0.5) 0%, 
        rgba(100, 181, 246, 0.5) var(--value, 50%), 
        rgba(255, 255, 255, 0.2) var(--value, 50%), 
        rgba(255, 255, 255, 0.2) 100%);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #64b5f6 0%, #2196f3 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(100, 181, 246, 0.4);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(100, 181, 246, 0.6);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #64b5f6 0%, #2196f3 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(100, 181, 246, 0.4);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(100, 181, 246, 0.6);
}

input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.1);
}

/* Checkboxes */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

input[type="checkbox"]:hover {
    border-color: rgba(100, 181, 246, 0.5);
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.3);
}

input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #64b5f6 0%, #2196f3 100%);
    border-color: transparent;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.control-section label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-section label:hover {
    transform: translateX(5px);
}

/* Buttons */
button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #64b5f6 0%, #2196f3 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(33, 150, 243, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

button:disabled {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.1) 100%);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

#play-pause {
    margin-bottom: 15px;
    font-size: 16px;
}

#play-pause.playing {
    background: linear-gradient(135deg, #ff6b6b 0%, #f06595 100%);
}

.vr-button {
    background: linear-gradient(135deg, #f06595 0%, #ff6b6b 100%);
    margin-top: 10px;
}

.vr-button:hover {
    box-shadow: 0 6px 20px rgba(240, 101, 149, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* A-Frame Scene */
a-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Hide A-Frame VR mode button (we have our own) */
.a-enter-vr {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .control-panel {
        width: 100%;
        height: auto;
        max-height: 50vh;
        top: auto;
        bottom: 0;
        left: 0;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .control-panel.hidden {
        transform: translateY(100%);
    }
}

/* Scrollbar styling */
.control-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading state */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Info display styling */
#info-display {
    pointer-events: none;
}

/* Visualization Stats Panel */
.stats-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 25px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stats-panel h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #64b5f6;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-section h4 {
    font-size: 12px;
    margin-bottom: 10px;
    color: #90caf9;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.stat-item span:first-child {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.stat-item span:last-child {
    color: #64b5f6;
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
}

/* Frequency Bars */
.frequency-bar {
    background: linear-gradient(to top, #2196f3, #64b5f6, #90caf9);
    transition: height 0.1s ease;
}

/* Wave Path */
.wave-path {
    stroke: url(#waveGradient);
    stroke-width: 2;
    fill: none;
    filter: drop-shadow(0 0 10px rgba(100, 181, 246, 0.5));
}

/* Particle Glow */
.audio-particle {
    filter: blur(0.5px);
    animation: particlePulse 2s infinite;
}

@keyframes particlePulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Loading Animation */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #64b5f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Toggle Button */
.toggle-panel {
    position: fixed;
    top: 20px;
    left: 380px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.toggle-panel:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.toggle-panel.collapsed {
    left: 20px;
}

/* Stats panel scrollbar */
.stats-panel::-webkit-scrollbar {
    width: 6px;
}

.stats-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.stats-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 181, 246, 0.3);
    border-radius: 3px;
}

.stats-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 181, 246, 0.5);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .stats-panel {
        display: none;
    }
    
    .toggle-panel {
        bottom: 20px;
        top: auto;
        left: 20px;
    }
}
