/* ===== Photoshop 风格颜色选择器 ===== */

.ps-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  animation: fadeIn .15s ease;
}

.ps-picker {
  position: fixed;
  z-index: 1001;
  background: #2d2d2d;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
  animation: scaleIn .2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
}

.ps-picker-body {
  display: flex;
  gap: 12px;
}

/* ===== SV 饱和度-明度 方形区域 ===== */
.ps-sv-area {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 5px;
  overflow: hidden;
  cursor: crosshair;
  border: 1px solid #3d3d3d;
}
.ps-sv-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.ps-sv-cursor {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 3px rgba(0,0,0,.6), inset 0 0 2px rgba(0,0,0,.3);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width .1s, height .1s;
}
.ps-sv-area:active .ps-sv-cursor { width: 14px; height: 14px; }

/* ===== 色相滑条 ===== */
.ps-hue-slider {
  position: relative;
  width: 18px;
  height: 240px;
  border-radius: 5px;
  overflow: hidden;
  cursor: ns-resize;
  border: 1px solid #3d3d3d;
  flex-shrink: 0;
}
.ps-hue-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.ps-hue-cursor {
  position: absolute;
  left: -2px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #fff;
  pointer-events: none;
  transform: translateY(-50%);
  filter: drop-shadow(0 0 2px rgba(0,0,0,.5));
}

/* ===== 底部：预览 + 三格式输入 ===== */
.ps-picker-footer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ps-preview {
  display: flex;
  flex-direction: column;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #3d3d3d;
  flex-shrink: 0;
}
.ps-preview-new,
.ps-preview-old {
  width: 36px;
  height: 36px;
}
.ps-preview-old {
  border-top: 1px solid #3d3d3d;
}

.ps-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ps-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ps-input-row .ps-copy-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  flex-shrink: 0;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ps-input-row .ps-copy-btn:hover {
  background: #3d3d3d;
  color: #fafafa;
}

.ps-input-label {
  font-size: 10px;
  font-weight: 700;
  color: #a1a1aa;
  min-width: 28px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.ps-hex-input {
  flex: 1;
  display: flex;
  align-items: center;
  background: #1e1e1e;
  border: 1.5px solid #3d3d3d;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color .15s;
}
.ps-hex-input:focus-within {
  border-color: #818cf8;
}
.ps-hex-hash {
  padding: 0 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #a1a1aa;
  font-family: 'SF Mono', 'Consolas', monospace;
}
.ps-hex-field {
  flex: 1;
  padding: 6px 8px 6px 2px;
  border: none;
  background: transparent;
  color: #fafafa;
  font-size: 13px;
  font-family: 'SF Mono', 'Consolas', monospace;
  outline: none;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* 确定按钮 */
.ps-confirm-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px 0;
  border: none;
  border-radius: 5px;
  background: #818cf8;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.ps-confirm-btn:hover { background: #6d5ce9; }
.ps-confirm-btn:active { transform: scale(0.98); }

/* RGB / HSL 数字输入 */
.ps-num-field {
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  background: #1e1e1e;
  border: 1.5px solid #3d3d3d;
  border-radius: 4px;
  color: #fafafa;
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
  text-align: center;
  outline: none;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.ps-num-field::-webkit-inner-spin-button,
.ps-num-field::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ps-num-field:focus {
  border-color: #818cf8;
}

/* ===== 颜色触发按钮（替代原生 input[type=color]） ===== */
.color-swatch-btn {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  flex-shrink: 0;
  padding: 0;
  outline: none;
}
.color-swatch-btn:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}
.color-swatch-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 棋盘格背景（显示透明度感） */
.color-swatch-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 3px;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  opacity: .3;
  z-index: 0;
}
.color-swatch-btn::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 3px;
  z-index: 1;
  background: inherit;
}

/* 小号触发按钮 */
.color-swatch-btn.small {
  width: 34px;
  height: 34px;
}

/* 隐藏原生颜色输入 */
input[type="color"].native-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
