/* The Profile Picture Maker (inc/pfp-tool.inc.php): the samples, the picture,
   the swatches and the shape buttons. The layout is pt-ui.css's, the phone
   editor pt-app.css's. */

/* ── Empty state: the samples ─────────────────────────────────────────── */
.pfp-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. */
#pfp-empty.hidden { display: none; }
.pfp-editor .sample-thumbnails { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.pfp-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;
}
.pfp-editor .sample-thumbnail:hover,
.pfp-editor .sample-thumbnail:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); }
.pfp-editor .sample-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 767px) { .pfp-editor .sample-thumbnail { width: 84px; height: 84px; } }

/* ── The picture ──────────────────────────────────────────────────────── */
/* Centred in its box (by id: in the phone editor the box is in the stage). */
#pfp-viewport { display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; }
#pfp-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#pfp-canvas:active { cursor: grabbing; }
#pfp-canvas:focus { outline: none; }
#pfp-canvas:focus-visible { outline: 3px solid rgba(15, 112, 230, 0.5); outline-offset: 4px; border-radius: 8px; }
#pfp-canvas[hidden] { display: none; }
@media (min-width: 768px) {
  /* The box has a fixed height: the picture fills it, less the padding. */
  #pfp-canvas { height: 100%; width: auto; }
}

/* Waiting for the cut-out. */
.pfp-busy {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(20, 24, 33, 0.55);
  color: #fff;
  font-size: 0.8rem;
  text-align: center;
  padding: 16px;
}
.pfp-busy[hidden] { display: none; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.pfp-title { display: block; }
.pfp-note { font-size: 0.7rem; line-height: 1.45; color: #6c757d; margin: 6px 0 0; }
.pfp-note[hidden] { display: none; }
.pfp-cut-done { color: #198754; }
.pt-app-sheet .pfp-note { color: inherit; opacity: 0.75; }

.pfp-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.pfp-swatch {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.pfp-swatch:hover { transform: scale(1.06); }
.pfp-swatch:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 112, 230, 0.6); }
.pfp-swatch[aria-pressed="true"],
.pfp-swatch-pick.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pt-accent, #0f70e6); }
.pfp-swatch-photo canvas { display: block; width: 100%; height: 100%; }
/* None: a white dot crossed out. */
.pfp-swatch-none::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12%;
  bottom: 12%;
  width: 2px;
  margin-left: -1px;
  background: #e5484d;
  transform: rotate(45deg);
}
/* A colour of your own: the colour wheel, the picker over it. */
.pfp-swatch-pick { display: block; background: conic-gradient(#ff4757, #ffd32a, #00c389, #00c6ff, #4782dc, #764ba2, #ff4757); margin: 0; }
.pfp-swatch-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.pfp-seg { display: flex; gap: 8px; }
.pfp-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 40px;
  padding: 0;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  background: #fff;
  color: #343f52;
  cursor: pointer;
}
.pfp-seg-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.pfp-seg-btn:hover { border-color: var(--pt-accent, #0f70e6); }
.pfp-seg-btn[aria-pressed="true"] { border-color: var(--pt-accent, #0f70e6); background: #eef3fc; color: var(--pt-accent, #0f70e6); }
.pfp-seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(15, 112, 230, 0.35); }

/* ── In the phone editor's bottom bar ─────────────────────────────────── */
/* The swatches are one sideways row (pt-app-strip), a little bigger for a
   finger; the shapes sit in the middle. By id: pt-app.css shows panels as
   blocks. */
.pt-app-panels #pfp-bgs .pfp-swatch,
.pt-app-panels #pfp-rings .pfp-swatch { width: 40px; height: 40px; border-color: var(--pt-app-line-strong); }
.pt-app-panels #pfp-bgs.pt-app-panel-on,
.pt-app-panels #pfp-rings.pt-app-panel-on { padding: 6px 6px 8px; gap: 10px; }
.pt-app-panels #pfp-shape.pt-app-panel-on { display: flex !important; justify-content: center; gap: 12px; padding: 4px 0 6px; }
.pt-app-panels .pfp-seg-btn {}
.pt-app-panels .pfp-seg-btn[aria-pressed="true"] {}
.pt-app-panels .pfp-swatch[aria-pressed="true"],
.pt-app-panels .pfp-swatch-pick.on { box-shadow: 0 0 0 2px var(--pt-app-bg), 0 0 0 4px #5b8def; }
