/**
 * ==========================================================================
 * SOLID3D CAD - Professional Studio Color Picker Stylesheet
 * Blender / Figma / Adobe inspired PBR Color Picker Popover
 * ==========================================================================
 */

.cad-color-picker-popover {
  position: absolute;
  z-index: 9999999;
  width: 264px;
  background: #181c24;
  border: 1px solid #2e3846;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #e2e8f0;
  user-select: none;
  animation: ccpFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ccpFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.ccp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ccp-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #94a3b8;
  text-transform: uppercase;
}

.ccp-title-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.ccp-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ccp-icon-btn {
  background: #252d3a;
  border: 1px solid #334155;
  color: #cbd5e1;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: all 0.15s ease;
}

.ccp-icon-btn:hover {
  background: #334155;
  color: #38bdf8;
  border-color: #38bdf8;
}

/* Saturation / Value Area */
.ccp-sv-container {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 6px;
  overflow: hidden;
  cursor: crosshair;
  background-color: #ff0000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.ccp-sv-white {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0));
}

.ccp-sv-black {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #000000, rgba(0, 0, 0, 0));
}

.ccp-sv-handle {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 2px 5px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 100%;
  top: 0%;
}

/* Controls Strip (Sliders & Swatches) */
.ccp-controls-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.ccp-sliders-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ccp-slider-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.ccp-hue-track {
  background: linear-gradient(to right,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
}

.ccp-alpha-track {
  background-image: repeating-linear-gradient(45deg, #272d38 25%, transparent 25%, transparent 75%, #272d38 75%, #272d38),
                    repeating-linear-gradient(45deg, #272d38 25%, #181c24 25%, #181c24 75%, #272d38 75%, #272d38);
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
  overflow: hidden;
}

.ccp-alpha-gradient {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), #38bdf8);
}

.ccp-slider-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 0%;
}

/* Swatch Box Comparison */
.ccp-preview-swatch-box {
  width: 34px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  flex-shrink: 0;
}

.ccp-swatch-new {
  flex: 1;
  background-color: #38bdf8;
}

.ccp-swatch-orig {
  flex: 1;
  background-color: #94a3b8;
  opacity: 0.9;
}

/* Inputs Row */
.ccp-inputs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.ccp-mode-toggle {
  background: #252d3a;
  border: 1px solid #334155;
  color: #7dd3fc;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.ccp-mode-toggle:hover {
  background: #334155;
  color: #ffffff;
}

.ccp-input-group {
  flex: 1;
  display: flex;
  align-items: center;
  background: #0f131a;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 2px 6px;
}

.ccp-input-group:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8;
}

.ccp-prefix {
  font-size: 12px;
  color: #64748b;
  margin-right: 3px;
  font-weight: 600;
}

.ccp-hex-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f1f5f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 0;
}

.ccp-copy-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  padding: 2px;
  line-height: 1;
  transition: color 0.15s;
}

.ccp-copy-btn:hover {
  color: #38bdf8;
}

.ccp-rgb-group {
  background: transparent;
  border: none;
  padding: 0;
  gap: 5px;
}

.ccp-mini-input {
  flex: 1;
  display: flex;
  align-items: center;
  background: #0f131a;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 2px 4px;
}

.ccp-mini-input input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
}

.ccp-mini-input input::-webkit-outer-spin-button,
.ccp-mini-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ccp-mini-input span {
  font-size: 9px;
  color: #64748b;
  font-weight: 700;
  margin-left: 2px;
}

/* Palette Section */
.ccp-palette-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #222a36;
}

.ccp-palette-label {
  font-size: 10px;
  color: #798394;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 5px;
}

.ccp-palette-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
}

.ccp-swatch-chip {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ccp-swatch-chip:hover {
  transform: scale(1.18);
  border-color: #ffffff;
  z-index: 2;
}

/* Custom In-App Color Well Button (Replaces Native <input type="color">) */
.node-color-well-btn {
  display: inline-block;
  vertical-align: middle;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
  outline: none;
}

.node-color-well-btn:hover {
  transform: scale(1.06);
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
