/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: linear-gradient(135deg, #1a1a1a, #2a1a2a);
    border-bottom: 1px solid #333;
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.1);
}

.app-title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #00ff00);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Control Styles */
.control-select, .control-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    color: #ffffff;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.control-select:hover, .control-btn:hover {
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.control-btn {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(255, 0, 255, 0.2));
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.4), rgba(255, 0, 255, 0.4));
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 80px);
    position: relative;
}

/* Control Panel */
.control-panel {
    width: 320px;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 255, 255, 0.2);
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 10;
}

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

.panel-toggle {
    position: absolute;
    top: 10px;
    right: -40px;
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 0 8px 8px 0;
    color: #00ffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.panel-toggle:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

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

.control-section h3 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.control-group {
    margin-bottom: 15px;
    position: relative;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #cccccc;
}

.control-slider {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #333, #666);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00ffff, #ff00ff);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.control-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00ffff, #ff00ff);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.control-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #00ffff;
    cursor: pointer;
}

.value-display {
    position: absolute;
    right: 0;
    top: 0;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: rgba(0, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.frequency-analyzer {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 200px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: end;
    padding: 10px;
    gap: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .control-panel {
        width: 280px;
    }
    
    .control-panel.collapsed {
        transform: translateX(-240px);
    }
    
    .main-container {
        height: calc(100vh - 120px);
    }
}

@media (max-width: 480px) {
    .header-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .control-select, .control-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .control-panel {
        width: 260px;
        padding: 15px;
    }
    
    .control-panel.collapsed {
        transform: translateX(-220px);
    }
}

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

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

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

.control-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #33ffff, #ff33ff);
}

/* Glow Effects */
.control-slider:focus {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

.control-select:focus, .control-btn:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

/* Animation for panel toggle */
@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.panel-toggle {
    animation: pulse 2s infinite;
}

/* Fullscreen mode adjustments */
.canvas-container:fullscreen {
    background: #0a0a0a;
}

.canvas-container:fullscreen #canvas {
    cursor: none;
}