/* GigColor (public/assets/js/color-picker.js): colour fields as swatches and the picker that opens from them.
   Navy panel in the brand look; becomes a bottom sheet on phones. Colours of swatches are set through the CSSOM. */

/* The colour field (the former input[type=color]). Plugin styles for their own colour fields win over these. */
input[data-gig-color] {
  width: 48px; height: 32px; min-height: 0; max-width: 100%; padding: 0; margin: 0;
  border: 1px solid rgba(121, 122, 125, 0.7); border-radius: 6px;
  color: transparent !important; caret-color: transparent !important; text-shadow: none; font-size: 0;
  cursor: pointer; user-select: none; -webkit-user-select: none; vertical-align: middle;
}
input[data-gig-color]:disabled { cursor: not-allowed; opacity: 0.5; }
input[data-gig-color]::selection { background: transparent; }
/* LED tools keep the size they gave the browser's colour field. */
.led-tool input[data-gig-color], .tp-app input[data-gig-color] { width: 100%; height: 40px; border-radius: 8px; }

/* The picker */
.gig-cp {
  position: fixed; inset: auto; left: 8px; top: 8px; margin: 0; z-index: 1000;
  width: 284px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; box-sizing: border-box;
  padding: 12px; display: grid; gap: 10px;
  background: #0F2A47; color: #F2F3F4; border: 1px solid rgba(121, 122, 125, 0.6); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  font-family: inherit; font-size: 13px; line-height: 1.3; text-align: left;
}
.gig-cp[popover]:not(:popover-open) { display: none; }
.gig-cp[hidden], .gig-cp [hidden] { display: none !important; }
.gig-cp *, .gig-cp *::before, .gig-cp *::after { box-sizing: border-box; }
.gig-cp :focus-visible { outline: 2px solid #F2F3F4; outline-offset: 2px; }
.gig-cp button { font: inherit; color: inherit; margin: 0; cursor: pointer; text-transform: none; letter-spacing: normal; }

.gig-cp-head { display: flex; align-items: center; gap: 6px; }
.gig-cp-head .gig-cp-seg { flex: 1; }
.gig-cp-seg { display: flex; padding: 2px; gap: 2px; background: #0A1E34; border: 1px solid rgba(121, 122, 125, 0.45); border-radius: 8px; }
.gig-cp-seg button { flex: 1; min-height: 28px; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; font-weight: 600; font-size: 12px; color: #B3BBC5; }
.gig-cp-seg button[aria-pressed="true"] { background: #2368AE; color: #FFFFFF; }
.gig-cp-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid rgba(121, 122, 125, 0.45); border-radius: 8px; background: transparent; }
.gig-cp-icon:hover, .gig-cp-seg button:hover { color: #FFFFFF; }
.gig-cp-icon svg { width: 16px; height: 16px; }

/* Spectrum: saturation (across) and brightness (up) over the hue, and the hue strip */
.gig-cp-pane { display: grid; gap: 10px; }
.gig-cp-area {
  position: relative; height: 168px; border-radius: 8px; cursor: crosshair; touch-action: none;
  background-image: linear-gradient(to top, #000000, rgba(0, 0, 0, 0)), linear-gradient(to right, #FFFFFF, rgba(255, 255, 255, 0));
}
.gig-cp-thumb {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2px solid #FFFFFF; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.3); cursor: grab;
}
.gig-cp-thumb:focus-visible, .gig-cp-strip-thumb:focus-visible { outline: 2px solid #F2F3F4; outline-offset: 3px; }
.gig-cp-strip { position: relative; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none; }
.gig-cp-hue { background: linear-gradient(to right, #FF0000, #FFFF00 16.67%, #00FF00 33.33%, #00FFFF 50%, #0000FF 66.67%, #FF00FF 83.33%, #FF0000); }
.gig-cp-strip-thumb {
  position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2px solid #FFFFFF; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

/* Wheel: hue ring and saturation/brightness triangle */
.gig-cp-wheel { position: relative; width: 220px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; touch-action: none; cursor: crosshair; }
.gig-cp-wheel canvas { display: block; width: 100%; height: 100%; }

/* Sliders */
.gig-cp-rows { display: grid; gap: 8px; }
.gig-cp-row { display: grid; grid-template-columns: 52px 1fr 58px; align-items: center; gap: 8px; }
.gig-cp-row label { font-weight: 500; font-size: 12px; color: #B3BBC5; }
.gig-cp input.gig-cp-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 14px; min-height: 0; margin: 0; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 7px; background: #0A1E34; cursor: pointer; box-shadow: none;
}
.gig-cp input.gig-cp-range::-webkit-slider-runnable-track { background: transparent; border: 0; height: 12px; }
.gig-cp input.gig-cp-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -3px; border-radius: 50%;
  background: #FFFFFF; border: 2px solid #0F2A47; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.gig-cp input.gig-cp-range::-moz-range-track { background: transparent; border: 0; }
.gig-cp input.gig-cp-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; border: 2px solid #0F2A47; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.gig-cp input.gig-cp-range:focus-visible { outline: 2px solid #F2F3F4; outline-offset: 3px; }
.gig-cp input.gig-cp-num, .gig-cp input.gig-cp-hex {
  width: 100%; min-height: 0; height: 30px; margin: 0; padding: 4px 6px;
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; color: #FFFFFF;
  background: #0A1E34; border: 1px solid #797A7D; border-radius: 6px; box-shadow: none;
}
.gig-cp input.gig-cp-num:focus, .gig-cp input.gig-cp-hex:focus { border-color: #F2F3F4; outline: none; box-shadow: 0 0 0 3px rgba(35, 104, 174, 0.6); }

/* Old and new colour, hex */
.gig-cp-foot { display: flex; align-items: center; gap: 10px; }
.gig-cp-compare { display: flex; flex: none; border: 1px solid rgba(121, 122, 125, 0.7); border-radius: 8px; overflow: hidden; }
.gig-cp-old, .gig-cp-new { display: block; width: 40px; height: 32px; padding: 0; border: 0; border-radius: 0; }
.gig-cp-old { cursor: pointer; }
.gig-cp-hexlabel { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 12px; color: #B3BBC5; min-width: 0; }
.gig-cp input.gig-cp-hex { text-transform: uppercase; letter-spacing: 0.04em; }

/* Swatches */
.gig-cp-swatches { display: grid; gap: 6px; }
.gig-cp-label { margin: 0; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #B3BBC5; }
.gig-cp-sw { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.gig-cp-swatch { width: 24px; height: 24px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 6px; }
.gig-cp-swatch:hover { border-color: #FFFFFF; }

.gig-cp-actions { display: flex; justify-content: flex-end; }
.gig-cp-done { min-height: 34px; padding: 6px 18px; border: 0; border-radius: 8px; background: #2368AE; color: #FFFFFF; font-weight: 600; }
.gig-cp-done:hover { background: #2B78C4; }

/* Phones: a sheet along the bottom of the screen. */
@media (max-width: 599px) {
  .gig-cp.is-sheet {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-width: 100%; max-height: 88vh;
    border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .gig-cp.is-sheet .gig-cp-area { height: 200px; }
  .gig-cp.is-sheet .gig-cp-wheel { width: 240px; }
  .gig-cp.is-sheet .gig-cp-swatch { width: 32px; height: 32px; }
  .gig-cp.is-sheet .gig-cp-done { min-height: 44px; flex: 1; }
}
