/*
 * Compare Images / Before and After Photo Maker (inc/cmp-tool.inc.php). The
 * layout is pt-ui.css's, the phone editor pt-app.css's, the segmented tracks
 * pt-theme.css's (.pt-cseg); this is the two image slots, the view tiles,
 * the swatches, the samples and the picture. Sizes in px: the theme's rem
 * is 20px. Panel rows are styled by id: in the phone editor they are moved
 * out of .cmp-editor.
 */
.cmp-ic { width: 20px; height: 20px; flex: 0 0 auto; }

/* ── The two images ───────────────────────────────────────────────────── */
.cmp-slots { display: grid; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr); gap: 6px; align-items: center; }
.cmp-slot { min-width: 0; border-radius: 14px; }
.cmp-slot.dragover { outline: 2px dashed var(--cb-pink, #d81878); outline-offset: 2px; }
.cmp-slot-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 7px;
  border: 1.5px dashed var(--cb-ghost, #cbd2dc);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cmp-slot-pick:hover { border-color: var(--cb-ink, #16181d); background: var(--cb-bg, #f2f4f8); }
.cmp-slot-pick:focus-visible { outline: none; box-shadow: var(--cb-focus, 0 0 0 3px rgba(15, 112, 230, 0.28)); }
.cmp-slot.filled .cmp-slot-pick { border-style: solid; border-color: var(--cb-line, #e1e5ec); }
.cmp-thumb {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cb-muted, #626973);
  background: var(--cb-bg, #f2f4f8);
}
.cmp-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmp-thumb img[hidden] { display: none; }
.cmp-slot-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cmp-slot-tag { font-size: 13px; font-weight: 800; color: var(--cb-ink, #16181d); overflow-wrap: anywhere; hyphens: auto; }
.cmp-slot-name, .cmp-slot-size { font-size: 12px; color: var(--cb-muted, #626973); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "Add an image" runs long in most languages: it wraps; a file name is cut. */
.cmp-slot:not(.filled) .cmp-slot-name { white-space: normal; overflow-wrap: anywhere; hyphens: auto; }
.cmp-swap {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--cb-btn-line, #d3d9e2);
  border-radius: 999px;
  background: #fff;
  color: var(--cb-ink, #16181d);
}
.cmp-swap:hover:not(:disabled) { background: var(--cb-hover-bg, #e6eaf1); }
.cmp-swap:disabled { opacity: 0.4; }
.cmp-swap .cmp-ic { width: 18px; height: 18px; }
.cmp-hint { font-size: 12.5px; }

/* ── The view: four tiles, an icon over its name ──────────────────────── */
#cmp-views {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: var(--cb-bg, #f2f4f8);
}
.cmp-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  padding: 7px 3px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--cb-text, #3d434b);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
.cmp-view span { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.cmp-view:hover { color: var(--cb-ink, #16181d); }
.cmp-view.active { color: var(--cb-ink, #16181d); background: #fff; box-shadow: var(--cb-raised, 0 2px 8px -2px rgba(22, 24, 29, 0.25)); }
.cmp-view:focus-visible { outline: none; box-shadow: var(--cb-focus, 0 0 0 3px rgba(15, 112, 230, 0.28)); }
fieldset:disabled .cmp-view { opacity: 0.55; }

/* Two choices share the track evenly. */
#cmp-dir > button, #cmp-show > button, #cmp-fit > button { flex: 1 1 0; min-width: 0; }

.cmp-stat { font-size: 13px; font-weight: 700; color: var(--cb-ink, #16181d); font-variant-numeric: tabular-nums; }

/* ── Background swatches ──────────────────────────────────────────────── */
#cmp-bg { display: flex; flex-wrap: wrap; gap: 10px; }
.cmp-swatch {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(22, 24, 29, 0.18);
  cursor: pointer;
}
.cmp-swatch.active { box-shadow: inset 0 0 0 1px rgba(22, 24, 29, 0.18), var(--cb-ring, 0 0 0 2px #fff, 0 0 0 4px #16181d); }
.cmp-swatch:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(22, 24, 29, 0.18), 0 0 0 2px #fff, 0 0 0 4px rgba(15, 112, 230, 0.6); }
.cmp-swatch-pick { overflow: hidden; background: conic-gradient(#ff4d4d, #ffd84d, #4dff88, #4dc3ff, #a64dff, #ff4dc3, #ff4d4d); }
.cmp-swatch-pick:focus-within { box-shadow: inset 0 0 0 1px rgba(22, 24, 29, 0.18), 0 0 0 2px #fff, 0 0 0 4px rgba(15, 112, 230, 0.6); }
.cmp-swatch-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.cmp-label-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.cmp-label-fields[hidden] { display: none; }

/* ── The picture ──────────────────────────────────────────────────────── */
#cmp-viewport { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
#cmp-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: repeating-conic-gradient(#e6e9ee 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
#cmp-canvas[hidden] { display: none; }
#cmp-canvas.cmp-drag-x { cursor: ew-resize; }
#cmp-canvas.cmp-drag-y { cursor: ns-resize; }
/* In the phone editor there is no page to scroll: every drag is the line's. */
.pt-app-open #cmp-canvas { touch-action: none; }
.cmp-next {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  white-space: nowrap;
  border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
.cmp-next[hidden] { display: none; }
[dir="rtl"] .cmp-next { left: auto; right: 50%; transform: translateX(50%); }

/* ── Empty: the samples ───────────────────────────────────────────────── */
.cmp-editor .cmp-empty {
  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%;
}
[dir="rtl"] .cmp-editor .cmp-empty { left: auto; right: 50%; transform: translate(50%, -50%); }
#cmp-empty.hidden { display: none; }
.cmp-samples { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.cmp-sample {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  padding: 0;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.cmp-sample:hover, .cmp-sample:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); outline: none; }
.cmp-sample img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 767px) {
  .cmp-sample { width: 72px; height: 72px; }
  .cmp-samples { gap: 8px; }
}

/* ── Phone editor ─────────────────────────────────────────────────────── */
/* The view tiles lifted into the bottom bar: one row. */
.pt-app-panels #cmp-views { display: flex; gap: 6px; padding: 4px; background: transparent; }
.pt-app-panels .cmp-view { flex: 1 0 auto; min-width: 72px; min-height: 56px; color: var(--pt-app-fg); }
.pt-app-panels .cmp-view.active { background: var(--cb-bg, #f2f4f8); box-shadow: inset 0 0 0 1.5px var(--cb-ink, #16181d); }
