/* ======================================================
  Color Picker Panel
====================================================== */
.pz-color-picker-panel {
  z-index: 10020;
  position: fixed;
  left: -300px;
  width: 256px;
  padding: 12px;
  box-sizing: border-box;
  border: 1px solid #888888;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 12px 12px 8px #44444466;
  display: none;
  cursor: default;
  user-select: none;
}

/* ======================================================
  SV Area
====================================================== */
.pz-sv-area {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #000;
  overflow: visible;
  cursor: crosshair;
}
.pz-sv-white {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to right, #fff, rgba(255,255,255,0));
}
.pz-sv-black {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, #000, rgba(0,0,0,0));
}
.pz-sv-cursor {
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  margin-left: -10px;
  margin-top: -10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* ======================================================
  Sliders
====================================================== */
.pz-slider {
  margin-top: 10px;
  height: 14px;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  overflow: visible;
}
.pz-hue-slider {
  background: linear-gradient(to right,
    #f00 0%, #ff0 16.6%, #0f0 33.3%, #0ff 50%,
    #00f 66.6%, #f0f 83.3%, #f00 100%);
}
.pz-alpha-slider {
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
    linear-gradient(45deg, #ccc 25%, white 25%, white 75%, #ccc 75%, #ccc);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}
.pz-alpha-inner {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
}
.pz-slider-thumb {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #000;
  pointer-events: none;
}

/* ======================================================
  Preview + Inputs
====================================================== */
.pz-preview-row {
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pz-preview-control {
  flex: 0 0 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pz-preview-circle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid #888;
  position: relative;
  overflow: hidden;
}
.pz-preview-circle.pz-checker::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
    linear-gradient(45deg, #ccc 25%, white 25%, white 75%, #ccc 75%, #ccc);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}
.pz-preview-circle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--preview-color, transparent);
}

/* ======================================================
  Input Wrap
====================================================== */
.pz-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
}

/* ラベル行（RGB / HSL） */
.pz-input-label-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #444;
  margin-bottom: 2px;
}
.pz-input-label-row span {
  flex: 1;
  text-align: center;
}
.pz-input-label-row.is-hex {
  width: calc(100% - 62px);
}

/* 共通 input */
.pz-hex-input {
  min-height: 40px;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-family: monospace;
  font-size: 12px;
  box-sizing: border-box;
  user-select: text;
}

/* RGB / HSL 数値 */
.pz-hex-input.pz-small {
  padding: 9px;
  width: auto;
  min-width: 0;
  flex: 1 1 0;
  text-align: right;
}

/* HEX input */
.pz-hex-input.is-hex {
  width: 100%;
}

.pz-hex-row {
  width: 100%;
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.pz-hex-row .pz-hex-input.is-hex {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.pz-hex-clear {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #bbb;
  background: linear-gradient(#fafafa, #eaeaea);
  font-size: 12px;
  cursor: pointer;
}

.pz-hex-clear:active {
  transform: translateY(1px);
}

/* ======================================================
  Mode Button
====================================================== */
.pz-mode-label {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 26px;
  padding: 0 5px;

  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;

  border-radius: 6px;
  border: 1px solid #bbb;

  background: linear-gradient(#fafafa, #eaeaea);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.8) inset,
    0 1px 1px rgba(0,0,0,0.08);

  transition: background 0.15s ease, transform 0.05s ease;
}
.pz-mode-label:active {
  transform: translateY(1px);
}

/* モード別色 */
.pz-mode-label.is-hex {
  background: linear-gradient(#f3f8ff, #e3eefc);
  border-color: #9bb7e5;
  color: #1f3b6f;
}
.pz-mode-label.is-rgb {
  background: linear-gradient(#f2fff6, #e2f6ea);
  border-color: #8bc7a0;
  color: #1f5a36;
}
.pz-mode-label.is-hsl {
  background: linear-gradient(#fff8ef, #f7ead6);
  border-color: #d2b38a;
  color: #6b3f12;
}

/* ======================================================
  Palette
====================================================== */
.pz-palette {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.pz-palette-color {
  width: 100%;
  padding-top: 75%;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.pz-color-context-menu {
  position: absolute;
  z-index: 3;
  padding: 2px;
  border: 1px solid #888;
  background: #fff;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.25);
}

.pz-color-context-menu button {
  display: block;
  min-width: 120px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: #222;
  text-align: left;
  cursor: pointer;
}

.pz-color-context-menu button:hover,
.pz-color-context-menu button:focus {
  background: #e8f0fe;
  outline: none;
}

/* ======================================================
  Trigger Button (input置換)
====================================================== */
.pz-color-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  width: 84px;
  border: 1px solid #888;
  border-radius: 6px;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.pz-color-swatch {
  width: 24px;
  height: 24px;
  border: 1px solid #444;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.pz-color-swatch.pz-checker::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
    linear-gradient(45deg, #ccc 25%, white 25%, white 75%, #ccc 75%, #ccc);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

/* disabled input の見た目（クリックはJS側で無効化） */
.pz-color-button.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
