/* Color Picker — complete color picker component, swatch grid, custom color panels, SV/hue, opacity */

.chart-color-picker {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 17, 24, 0.96);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
  gap: 12px;
}

.chart-color-picker.visible {
  display: grid;
}

.chart-color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.chart-color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.chart-color-swatch.active {
  border-color: #4e8cff;
  box-shadow: 0 0 0 1px rgba(78, 140, 255, 0.45);
}

.chart-color-picker-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.chart-color-custom-toggle,

.chart-color-apply-btn {
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #eef2f7;
  cursor: pointer;
  padding: 0 12px;
}

.chart-color-custom {
  display: none;
  gap: 12px;
}

.chart-color-custom.visible {
  display: grid;
}

.chart-color-custom-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.chart-color-custom-preview {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.chart-color-custom-head input {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: #eef2f7;
  padding: 0 11px;
  font-family: var(--mono);
  min-width: 0;
}

.chart-color-custom-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 12px;
  align-items: stretch;
}

.chart-color-sv-panel {
  position: relative;
  min-height: 220px;
  border-radius: 12px;
  overflow: hidden;
  cursor: crosshair;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, var(--chart-color-hue, #2962ff));
}

.chart-color-sv-handle,

.chart-color-hue-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.chart-color-hue-panel {
  position: relative;
  min-height: 220px;
  border-radius: 999px;
  cursor: ns-resize;
  background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.chart-color-hue-handle {
  left: 50%;
  width: 22px;
  height: 10px;
  border-radius: 999px;
}

.chart-color-opacity-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: #eef2f7;
  font-size: 11px;
}

.chart-color-opacity-row input[type="range"] {
  width: 100%;
  accent-color: #31c0ff;
}

/* --- Quick toolbar color picker overrides --- */

.chart-wrapper-quick-toolbar > .chart-color-picker {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 312px;
  margin-top: 0;
}

.chart-wrapper-quick-toolbar > .chart-color-picker {
  min-width: 156px;
  padding: 6px;
  gap: 6px;
  border-radius: 10px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-swatch-grid {
  gap: 6px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-swatch {
  border-radius: 8px;
  border-width: 1px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-picker-meta {
  gap: 6px;
  font-size: 10px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-custom-toggle,

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-apply-btn {
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 11px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-custom {
  gap: 6px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-custom-head {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 6px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-custom-preview {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-custom-head input {
  height: 28px;
  border-radius: 8px;
  padding: 0 7px;
  font-size: 11px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-custom-body {
  grid-template-columns: minmax(0, 1fr) 16px;
  gap: 6px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-sv-panel {
  min-height: 96px;
  border-radius: 10px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-hue-panel {
  min-height: 96px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-sv-handle,

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-hue-handle {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-hue-handle {
  width: 16px;
  height: 8px;
}

.chart-wrapper-quick-toolbar > .chart-color-picker .chart-color-opacity-row {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  font-size: 10px;
}
