/* ================================================================
   channels.css  --  RGB channel sliders, toggles, gain, grayscale,
                     reset, channel value input, channel legend
   ================================================================ */

/* ---------- Controls container ---------- */

.channel-controls {
  display: none;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.rgb-toggle-group {
  display: none;
  gap: 4px;
  align-items: center;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.lb-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Individual slider ---------- */

.channel-slider {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.channel-slider label {
  color: #e8e8e8;
  font-size: 10px;
  font-weight: 500;
  min-width: 24px;
  text-transform: uppercase;
  user-select: none;
}

/* ---------- Range slider track ---------- */

.slider {
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  flex-shrink: 0;
}

/* Thumb – WebKit */
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Thumb – Firefox */
.slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ---------- Per-channel colours ---------- */

.red-slider::-webkit-slider-thumb   { background: #ff6b6b; }
.green-slider::-webkit-slider-thumb { background: #51cf66; }
.blue-slider::-webkit-slider-thumb  { background: #4dabf7; }
.gain-slider::-webkit-slider-thumb  { background: #ffd43b; }

.red-slider   { background: linear-gradient(to right, rgba(255, 107, 107, 0.3), #ff6b6b); }
.green-slider { background: linear-gradient(to right, rgba(81, 207, 102, 0.3),  #51cf66); }
.blue-slider  { background: linear-gradient(to right, rgba(77, 171, 247, 0.3),  #4dabf7); }
.gain-slider  { background: linear-gradient(to right, rgba(255, 212, 59, 0.3),  #ffd43b); }

/* ---------- Percentage label ---------- */

.channel-slider span {
  color: #e8e8e8;
  font-size: 9px;
  min-width: 28px;
  text-align: right;
  opacity: 0.8;
  font-weight: 500;
  user-select: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: var(--btn-transition);
  flex-shrink: 0;
}

.channel-slider span:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

/* Inline edit input */
.channel-value-input {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #e8e8e8;
  font-size: 10px;
  font-weight: 500;
  text-align: right;
  padding: 2px 4px;
  border-radius: 3px;
  width: 50px;
  outline: none;
}

.channel-value-input:focus {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ---------- Reset & grayscale buttons ---------- */

.reset-btn,
.grayscale-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  transition: var(--btn-transition);
}

.reset-btn:hover,
.grayscale-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.grayscale-btn.active {
  background: rgba(200, 200, 200, 0.3);
  border-color: rgba(200, 200, 200, 0.5);
  color: #ffffff;
}

/* ---------- Mobile RGB toggle buttons ---------- */

.channel-btn {
  min-width: 32px;
  min-height: 32px;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--btn-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-btn[data-channel="red"] {
  background: #dc2626;
  border-color: #b91c1c;
  color: white;
}

.channel-btn[data-channel="red"]:hover {
  background: #ef4444;
  border-color: #dc2626;
  transform: scale(1.05);
}

.channel-btn[data-channel="green"] {
  background: #16a34a;
  border-color: #15803d;
  color: white;
}

.channel-btn[data-channel="green"]:hover {
  background: #22c55e;
  border-color: #16a34a;
  transform: scale(1.05);
}

.channel-btn[data-channel="blue"] {
  background: #2563eb;
  border-color: #1d4ed8;
  color: white;
}

.channel-btn[data-channel="blue"]:hover {
  background: #3b82f6;
  border-color: #2563eb;
  transform: scale(1.05);
}

.channel-btn.disabled {
  opacity: 0.4;
  background: #374151;
  border-color: #4b5563;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Channel legend ---------- */

.channel-legend {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 300px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  pointer-events: none;
  display: block;
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.3s ease;
}

.channel-legend.visible {
  display: block;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-title {
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  margin: 0;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  transition: var(--btn-transition);
}

.red-color   { background: #ff4444; box-shadow: 0 0 4px rgba(255, 68, 68, 0.4); }
.green-color { background: #44ff44; box-shadow: 0 0 4px rgba(68, 255, 68, 0.4); }
.blue-color  { background: #4444ff; box-shadow: 0 0 4px rgba(68, 68, 255, 0.4); }

.red-color.disabled,
.green-color.disabled,
.blue-color.disabled {
  background: #666666;
  box-shadow: 0 0 4px rgba(102, 102, 102, 0.2);
}

.legend-label {
  color: #e8e8e8;
  font-size: 12px;
  line-height: 1.3;
  word-break: break-word;
}
