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

body {
    font-family: 'Exo 2', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

/* Typography */
h3, h4 {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

.glow-text {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    color: #00ffff;
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.nav-controls {
    display: flex;
    gap: 16px;
}

.nav-btn {
    padding: 8px 16px;
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 0, 255, 0.5);
}

/* Main Container */
.main-container {
    position: relative;
    height: 100vh;
    width: 100vw;
    padding-top: 60px;
}

#scene-container {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
}

#scene-container canvas {
    display: block;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
}

/* Control Panel */
.control-panel {
    position: fixed;
    top: 60px;
    right: 0;
    width: 350px;
    height: calc(100vh - 60px);
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(15px);
    border-left: 1px solid #333;
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.4s ease;
    z-index: 100;
}

.control-panel.collapsed {
    transform: translateX(300px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.toggle-btn {
    background: #333;
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #555;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Control Sections */
.control-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #222;
}

.control-section h4 {
    color: #00ffff;
    margin-bottom: 16px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Mode Buttons */
.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #333;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mode-btn:hover,
.mode-btn.active {
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #ff00ff, #00ffff);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.4);
}

/* Audio Controls */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.audio-btn {
    padding: 10px 16px;
    background: linear-gradient(45deg, #0a84ff, #00d4aa);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.audio-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(10, 132, 255, 0.4);
}

.audio-level {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.level-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #ffff00, #ff0000);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 4px;
}

/* Frequency Display */
.frequency-display {
    display: flex;
    align-items: end;
    height: 60px;
    gap: 2px;
    margin-top: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid #333;
}

.freq-bar {
    flex: 1;
    background: linear-gradient(to top, #ff00ff, #00ffff);
    min-height: 2px;
    border-radius: 1px;
    transition: height 0.1s ease;
}

/* Parameter Controls */
.param-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-group label {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.param-slider {
    appearance: none;
    height: 6px;
    background: linear-gradient(90deg, #333, #666);
    border-radius: 3px;
    outline: none;
    position: relative;
    cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
    transition: all 0.2s ease;
}

.param-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
}

.param-select {
    padding: 8px 12px;
    background: rgba(20, 20, 40, 0.9);
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.param-select:focus {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Beat Detection */
.beat-indicator {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-radius: 50%;
    margin: 0 auto 16px;
    transition: all 0.2s ease;
    position: relative;
}

.beat-indicator.beat-pulse {
    border-color: #ff00ff;
    box-shadow: 
        0 0 20px rgba(255, 0, 255, 0.8),
        inset 0 0 20px rgba(255, 0, 255, 0.3);
    transform: scale(1.2);
}

.beat-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 0, 255, 0.3), transparent);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.beat-indicator.beat-pulse::before {
    background: radial-gradient(circle, rgba(255, 0, 255, 0.8), transparent);
    animation: pulse 0.2s ease;
}

/* Animations */
@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

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

.control-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #ff44ff, #44ffff);
}

/* Responsive Design */
@media (max-width: 768px) {
    .control-panel {
        width: 300px;
    }
    
    .control-panel.collapsed {
        transform: translateX(250px);
    }
    
    .nav-controls {
        gap: 8px;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .glow-text {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .control-panel {
        width: 100%;
        transform: translateY(100%);
    }
    
    .control-panel.collapsed {
        transform: translateY(calc(100% - 60px));
    }
    
    .main-container {
        height: 100vh;
    }
    
    #scene-container {
        width: 100%;
        height: 100%;
    }
}

/* Loading and Error States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00ffff;
    font-size: 1.2rem;
}

.error {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
}

/* Custom Glow Effects */
.glow-border {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.5);
}

.glow-border:hover {
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}