/* Color Control Panel CSS - ENFORCED DARK MODE */

* {
  color-scheme: dark !important;
}

html, body {
  background-color: #000000 !important;
  color: #ffffff !important;
}

/* Force dark mode on ALL elements EXCEPT color elements */
*:not(.color-spectrum-bar):not(.color-preview):not(.hue-slider):not(.saturation-slider):not(.lightness-slider), 
*:not(.color-spectrum-bar):not(.color-preview):not(.hue-slider):not(.saturation-slider):not(.lightness-slider)::before, 
*:not(.color-spectrum-bar):not(.color-preview):not(.hue-slider):not(.saturation-slider):not(.lightness-slider)::after {
  background-color: #0a0a0a !important;
  color: #ffffff !important;
  border-color: #333333 !important;
}

/* Specific overrides for form elements */
input, select, button, textarea, label {
  background-color: #2a2a2a !important;
  color: #ffffff !important;
  border: 1px solid #444444 !important;
}

/* Force body and html dark */
html {
  background: #000000 !important;
  color: #ffffff !important;
}

body {
  background: #000000 !important;
  color: #ffffff !important;
  margin: 0 !important;
  padding: 20px !important;
}

.control-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 380px;
  background: #0a0a0a !important;
  border: 1px solid #333333 !important;
  border-radius: 12px;
  padding: 0;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.9);
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #ffffff !important;
  backdrop-filter: blur(10px);
}

.control-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #333333 !important;
  background: #1a1a1a !important;
  border-radius: 12px 12px 0 0;
}

.control-panel-header h3 {
  margin: 0;
  color: #f9fafb;
  font-size: 16px;
  font-weight: 600;
}

.control-panel-actions {
  display: flex;
  gap: 8px;
}

.control-btn {
  background: rgba(107, 114, 128, 0.3);
  border: 1px solid rgba(156, 163, 175, 0.2);
  color: #d1d5db;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: rgba(107, 114, 128, 0.5);
  border-color: rgba(156, 163, 175, 0.4);
}

.control-panel-body {
  padding: 20px;
  max-height: 600px;
  overflow-y: auto;
}

.control-group {
  margin-bottom: 20px;
}

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

.control-group label {
  display: block;
  margin-bottom: 8px;
  color: #d1d5db;
  font-size: 14px;
  font-weight: 500;
}

.edit-mode-toggle {
  width: 100%;
  padding: 12px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-mode-toggle:hover {
  background: #5855eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.edit-mode-toggle.active {
  background: #10b981;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.save-btn-hidden {
  background: rgba(107, 114, 128, 0.3);
  color: #9ca3af;
  opacity: 0.5;
  pointer-events: none;
}

.save-btn-visible {
  background: #10b981;
  color: white;
  opacity: 1;
  pointer-events: all;
}

.save-btn-visible:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

select {
  width: 100%;
  padding: 10px 12px;
  background: #2a2a2a;
  border: 1px solid #444444;
  border-radius: 6px;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

select option {
  background: #2a2a2a;
  color: #ffffff;
}

/* Color Spectrum Explorer Styles */
.color-spectrum-container {
  background: #1a1a1a !important;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #333333 !important;
}

.spectrum-slider-container {
  position: relative;
  margin-bottom: 20px;
}

.color-spectrum-bar {
  width: 100%;
  height: 40px;
  background: linear-gradient(to right, 
    #ff0000 0%,
    #ff8000 12.5%,
    #ffff00 25%,
    #80ff00 37.5%,
    #00ff00 50%,
    #00ff80 62.5%,
    #00ffff 75%,
    #0080ff 87.5%,
    #0000ff 100%
  ) !important;
  border-radius: 8px;
  border: 2px solid #333333 !important;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
}

.spectrum-slider {
  width: 100%;
  height: 40px;
  background: transparent;
  border-radius: 8px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  margin: 0;
}

.spectrum-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 44px;
  background: #ffffff;
  border: 3px solid #000000;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
}

.spectrum-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.9);
}

.spectrum-slider::-moz-range-thumb {
  width: 8px;
  height: 44px;
  background: #ffffff;
  border: 3px solid #000000;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.color-slider-container {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-slider-container label {
  color: #cccccc;
  font-size: 12px;
  font-weight: 500;
  min-width: 120px;
  margin-bottom: 0;
}

.hue-slider, .saturation-slider, .lightness-slider {
  width: 100%;
  height: 20px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
  background-size: 100% 100% !important;
  background-position: 0 0 !important;
}

.hue-slider::-webkit-slider-track,
.saturation-slider::-webkit-slider-track,
.lightness-slider::-webkit-slider-track {
  height: 8px;
  border-radius: 4px;
  background: transparent;
  width: 100%;
}

.hue-slider::-moz-range-track,
.saturation-slider::-moz-range-track,
.lightness-slider::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: transparent;
  border: none;
  width: 100%;
}

.hue-slider {
  background: linear-gradient(to right, 
    hsl(0, 100%, 50%) 25%,
    hsl(60, 100%, 50%) 35%,
    hsl(120, 100%, 50%) 45%,
    hsl(180, 100%, 50%) 55%,
    hsl(240, 100%, 50%) 65%,
    hsl(300, 100%, 50%) 75%,
    hsl(360, 100%, 50%) 75%
  ) !important;
}

.saturation-slider {
  background: linear-gradient(to right, hsl(0, 0%, 50%) 25%, hsl(0, 100%, 50%) 75%) !important;
}

.lightness-slider {
  background: linear-gradient(to right, hsl(0, 100%, 0%) 25%, hsl(0, 100%, 50%) 50%, hsl(0, 100%, 100%) 75%) !important;
}

.hue-slider::-webkit-slider-thumb,
.saturation-slider::-webkit-slider-thumb,
.lightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  border: 2px solid #000000;
}

.hue-slider::-moz-range-thumb,
.saturation-slider::-moz-range-thumb,
.lightness-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  border: 2px solid #000000;
}

.hue-value, .saturation-value, .lightness-value {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 11px;
  color: #9ca3af;
  background: rgba(17, 24, 39, 0.8);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(156, 163, 175, 0.1);
  min-width: 45px;
  text-align: center;
}

.color-preview {
  width: 100%;
  height: 45px;
  background: var(--preview-color, #ff0000);
  border-radius: 8px;
  border: 2px solid #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 16px;
  font-family: 'SF Mono', monospace;
}

.color-fine-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 6px;
}

.color-fine-btn {
  background: rgba(107, 114, 128, 0.3);
  border: 1px solid rgba(156, 163, 175, 0.2);
  color: #d1d5db;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-fine-btn:hover {
  background: rgba(107, 114, 128, 0.5);
  border-color: rgba(156, 163, 175, 0.4);
  transform: translateY(-1px);
}

.color-fine-label {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
}

.color-adjustment-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-container label {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 0;
}

.adjustment-slider {
  width: 100%;
  height: 6px;
  background: rgba(107, 114, 128, 0.3);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.adjustment-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.adjustment-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Color Controls */
.color-controls {
  background: rgba(31, 41, 55, 0.5);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid rgba(156, 163, 175, 0.1);
}

.color-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-slider-group label {
  min-width: 60px;
  margin-bottom: 0;
  font-size: 12px;
  color: #9ca3af;
}

.color-slider-group input[type="color"] {
  width: 40px;
  height: 30px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-slider-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-slider-group input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.color-value {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 11px;
  color: #9ca3af;
  background: rgba(17, 24, 39, 0.8);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(156, 163, 175, 0.1);
  min-width: 60px;
  text-align: center;
}

/* Reset Button */
#reset-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
  margin-top: 20px;
}

#reset-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .control-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }
  
  .control-panel-body {
    max-height: 500px;
  }
}