/* Unified Controls CSS - Comprehensive styling for all visualizer controls */

/* Base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Main container */
#visualizer-controls {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1000;
}

/* Control bar (bottom) */
#control-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 15px;
  pointer-events: all;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Control buttons */
.control-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0.8;
}

.control-btn:hover:not(:disabled) {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.control-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Time displays */
.time-display {
  color: #fff;
  font-size: 12px;
  min-width: 45px;
  text-align: center;
  opacity: 0.9;
}

/* Seek bar */
.seek-container {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.seek-bar {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
  border-radius: 2px;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
}

.seek-bar:hover::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
}

/* Volume controls */
.volume-container {
  display: flex;
  align-items: center;
  width: 100px;
}

.volume-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
  border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: #fff;
  cursor: pointer;
  border-radius: 50%;
}

/* Upload zone */
.upload-zone {
  position: relative;
  overflow: hidden;
}

.upload-zone input[type="file"] {
  position: absolute;
  left: -9999px;
}

.upload-zone label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.upload-zone label:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Unified sidebar */
.unified-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: calc(100% - 60px);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  pointer-events: all;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.unified-sidebar.hidden {
  transform: translateX(100%);
}

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
}

.sidebar-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close:hover {
  opacity: 1;
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-icon {
  color: rgba(255, 255, 255, 0.5);
  margin-right: 10px;
}

.search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.15);
}

/* Preset bar */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preset-select {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.preset-select option,
.preset-select optgroup {
  background: #222;
  color: #fff;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Categories container */
.categories-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

/* Scrollbar styling */
.categories-container::-webkit-scrollbar {
  width: 8px;
}

.categories-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.categories-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.categories-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Category panels */
.category-panel {
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.category-header {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.category-icon {
  font-size: 18px;
  margin-right: 10px;
}

.category-title {
  flex: 1;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.category-chevron {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  transition: transform 0.2s;
}

.category-content {
  padding: 0 15px 15px;
  display: none;
}

/* Control wrappers */
.control-wrapper {
  margin-bottom: 15px;
}

.control-label {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  margin-bottom: 8px;
  cursor: help;
}

/* Slider controls */
.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
  border-radius: 2px;
}

.control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  cursor: pointer;
  border-radius: 50%;
}

.slider-value {
  min-width: 45px;
  text-align: right;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

/* Toggle controls */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-toggle {
  width: 40px;
  height: 20px;
  position: relative;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.control-toggle:checked {
  background: #4CAF50;
}

.control-toggle::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.control-toggle:checked::before {
  transform: translateX(20px);
}

.toggle-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

/* Dropdown controls */
.control-dropdown {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.control-dropdown option {
  background: #222;
  color: #fff;
}

/* Color picker controls */
.color-picker-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-color {
  width: 50px;
  height: 30px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-hex {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  outline: none;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  border-left: 4px solid #4CAF50;
}

.toast-error {
  border-left: 4px solid #f44336;
}

/* Help tooltip */
#help-tooltip {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: rgba(0, 0, 0, 0.95);
  color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 2000;
  max-width: 300px;
}

#help-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#help-tooltip h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

#help-tooltip ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#help-tooltip li {
  margin-bottom: 8px;
  font-size: 13px;
}

#help-tooltip kbd {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
  margin-right: 8px;
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 3000;
}

#loading-overlay.show {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: #fff;
  margin-top: 20px;
  font-size: 16px;
}

.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin-top: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #fff;
  width: 0%;
  transition: width 0.3s;
}

/* Error display */
#error-display {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(244, 67, 54, 0.9);
  color: #fff;
  padding: 15px 25px;
  border-radius: 4px;
  font-size: 14px;
  display: none;
  z-index: 2000;
  max-width: 80%;
  text-align: center;
}

#error-display.show {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .unified-sidebar {
    width: 280px;
  }
  
  #control-bar {
    padding: 0 10px;
    gap: 8px;
  }
  
  .control-btn {
    font-size: 16px;
    padding: 6px;
  }
  
  .seek-container {
    padding: 0 5px;
  }
  
  .time-display {
    font-size: 11px;
    min-width: 40px;
  }
}

/* Mobile fullscreen adjustments */
@media (max-width: 480px) {
  .unified-sidebar {
    width: 100%;
  }
  
  #control-bar {
    height: 50px;
  }
}

/* Dark mode adjustments for better visibility */
@media (prefers-color-scheme: light) {
  #visualizer-controls {
    color-scheme: dark;
  }
}