/* The colour tool (inc/recolor-tool.inc.php): the samples, the picked
   colours, the new colours and the brush. The layout is pt-ui.css's, the
   phone editor pt-app.css's, the pills and swatches take pt-theme.css's
   look. */

/* ── Empty state: the samples ─────────────────────────────────────────── */
.recolor-editor .sample-thumbnails-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  /* Without a width it shrinks to half the box (left: 50%). */
  width: 90%;
}
/* By id: in the phone editor the photo box is out of the card. */
#rc-empty.hidden { display: none; }
.recolor-editor .sample-thumbnails { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.recolor-editor .sample-thumbnail {
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  overflow: hidden;
  width: 110px;
  height: 110px;
  padding: 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.recolor-editor .sample-thumbnail:hover,
.recolor-editor .sample-thumbnail:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); }
.recolor-editor .sample-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 767px) { .recolor-editor .sample-thumbnail { width: 84px; height: 84px; } }

/* ── The photo ────────────────────────────────────────────────────────── */
#rc-viewport { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
#rc-canvas { display: block; max-width: 100%; max-height: 100%; border-radius: 6px; cursor: crosshair; touch-action: pan-y; }
#rc-canvas[hidden] { display: none; }
#rc-canvas.rc-brushing { cursor: none; }
/* A fine pointer paints straight away; in the phone editor a finger paints
   instead of scrolling. On the closed phone page the photo scrolls. */
@media (pointer: fine) { #rc-canvas { touch-action: none; } }
.pt-app-stage #rc-canvas { touch-action: none; }
/* The brush: a ring, white over a dark edge so it shows on any photo. */
.rc-cursor {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.rc-cursor.is-erase { border-style: dashed; }
.rc-cursor[hidden] { display: none; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.rc-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 3px 14px;
  font-size: 0.85rem;
  border-radius: 20px;
  border: 1px solid #dee2e6;
  background: transparent;
  color: #555;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.rc-pill svg { width: 16px; height: 16px; flex: none; }
/* Clicking the photo: three equal columns, the icon over the label, so the
   track stays one row in every language. */
#rc-tool-row .rc-seg { flex-wrap: nowrap; }
#rc-tool-row .rc-seg > .rc-pill {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}
#rc-tool-row .rc-seg > .rc-pill svg { width: 18px; height: 18px; }
.rc-pill[aria-pressed="true"] { background: var(--pt-accent, #0f70e6); border-color: var(--pt-accent, #0f70e6); color: #fff; }
.rc-pill:hover:not([aria-pressed="true"]):not(:disabled) { background: #f0f4ff; border-color: var(--pt-accent, #0f70e6); color: var(--pt-accent, #0f70e6); }
.rc-pill:focus-visible, .rc-swatch:focus-visible, .rc-swatch:focus-within, .rc-pick:focus-visible { outline: 3px solid rgba(15, 112, 230, 0.45); outline-offset: 2px; }
.rc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 2px; }
.rc-swatch {
  flex: none;
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #444;
  background: #fff;
  transition: border-color 0.15s, transform 0.15s;
}
.rc-swatch svg { width: 16px; height: 16px; }
.rc-swatch[aria-pressed="true"], .rc-swatch.is-on, .rc-swatch:hover:not(:disabled) { border-color: var(--pt-accent, #0f70e6); transform: scale(1.1); }
/* Any colour: the browser's own picker, over the whole button. */
.rc-custom input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.rc-custom { background: conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935); color: #fff; }
.rc-custom svg { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.6)); }
.rc-custom.is-on svg { filter: none; }
/* The picked colours: tap one to take it off. */
.rc-pick {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.rc-pick svg { width: 14px; height: 14px; opacity: 0; transition: opacity 0.15s; }
.rc-pick:hover svg, .rc-pick:focus-visible svg { opacity: 1; }
@media (hover: none) { .rc-pick svg { opacity: 0.85; } }
.rc-pick.is-auto { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 0 2px #fff, 0 0 0 3px #b9c0ca; }
#rc-picks:empty { display: none; }
.rc-link {
  border: 0;
  background: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  color: var(--pt-accent, #0f70e6);
  cursor: pointer;
}
.rc-link:disabled { color: #9aa1aa; cursor: default; }
.rc-hint { font-size: 0.7rem; line-height: 1.45; color: #6c757d; margin: 2px 0 10px; }

/* ── Phone editor: the rows lifted into the bottom bar ────────────────── */
/* They are strips (pt-app.css): one row that scrolls sideways. */
.pt-app-panels #rc-picks,
.pt-app-panels #rc-to-row { align-items: center; gap: 10px; padding: 5px 4px; flex-wrap: nowrap; }
.pt-app-panels #rc-picks:empty { display: flex; min-height: 44px; }
.pt-app-panels .rc-swatch { width: 36px; height: 36px; border-color: var(--pt-app-line-strong); }
.pt-app-panels .rc-pick { width: 38px; height: 38px; }
/* A ring outside a dark gap: shows on the white swatch and the black one. */
.pt-app-panels .rc-swatch[aria-pressed="true"], .pt-app-panels .rc-swatch.is-on { border-color: #fff; transform: none; }
