/* The shape effects tool (inc/sx-tool.inc.php): the samples, the look
   tiles and the photo. The layout is pt-ui.css's, the
   phone editor pt-app.css's, the sliders and buttons take pt-theme.css's look. */

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

/* ── The photo ────────────────────────────────────────────────────────── */
#sx-viewport { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
#sx-canvas { display: block; max-width: 100%; max-height: 100%; border-radius: 6px; background: #fff; }
#sx-canvas[hidden] { display: none; }
/* Reflection on a transparent background: the checkerboard behind it. */
#sx-canvas.sx-alpha {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e3e3e3 25%, transparent 25%), linear-gradient(-45deg, #e3e3e3 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #e3e3e3 75%), linear-gradient(-45deg, transparent 75%, #e3e3e3 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
#sx-compare.active { color: #fff; background: var(--cb-ink, #16181d); border-color: var(--cb-ink, #16181d); }

/* ── Look tiles: the photo in each look ───────────────────────────────── */
/* Five looks: three, then two. */
.sx-looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
.sx-look {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cb-text, #3d434b);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
}
.sx-thumb {
  position: relative;
  display: block;
  width: 100%;
  max-width: 96px;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #e9e5df, #f6f4f1);
  box-shadow: inset 0 0 0 1px var(--cb-line, #e4e1dc);
  transition: box-shadow 0.15s;
}
.sx-thumb canvas { display: block; width: 100%; height: 100%; }
.sx-name { max-width: 100%; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
.sx-look:hover .sx-thumb { box-shadow: inset 0 0 0 1px var(--cb-line, #e4e1dc), 0 0 0 2px #cfcac3; }
.sx-look[aria-pressed="true"] { color: var(--cb-ink, #16181d); font-weight: 700; }
/* The chosen one: CB's double ring. */
.sx-look[aria-pressed="true"] .sx-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cb-ink, #16181d); }
.sx-look:focus-visible { outline: none; }
.sx-look:focus-visible .sx-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 112, 230, 0.6); }
fieldset:disabled .sx-look { cursor: default; opacity: 0.75; }

.sx-link {
  border: 0;
  background: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  color: var(--pt-accent, #0f70e6);
  cursor: pointer;
}
.sx-link:disabled { color: #9aa1aa; cursor: default; }
/* Not .d-flex: its !important would show the row on every look. */
#sx-text-row { display: flex; flex-wrap: wrap; gap: 8px; }
#sx-text-row[hidden] { display: none; }
#sx-text-row .btn { display: inline-flex; align-items: center; gap: 6px; }
.sx-opts[hidden] { display: none; }
/* Choices of three or six: words wrap rather than overflow. */
.sx-choice .pt-cseg { flex-wrap: wrap; }
.sx-choice .pt-cseg button { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }

/* ── Phone editor ─────────────────────────────────────────────────────── */
/* The tiles lifted into the bottom bar: one row that scrolls sideways. */
.pt-app-panels .sx-looks { display: flex; gap: 10px; padding: 6px 4px; }
.pt-app-panels .sx-look { flex: 0 0 auto; width: 68px; color: var(--pt-app-fg); }
.pt-app-panels .sx-look[aria-pressed="true"] { color: var(--pt-app-fg); }
.pt-app-panels .sx-thumb { box-shadow: inset 0 0 0 1px var(--pt-app-line-strong); }
/* Options in the bottom bar: the look's choices, compact. */
.pt-app-panels #sx-opts { padding: 4px 4px 2px; max-height: 40vh; overflow-y: auto; }
.pt-app-panels #sx-opts .form-label { color: var(--pt-app-fg); font-size: 13px; margin-bottom: 4px; }
.pt-app-panels #sx-opts .sx-choice,
.pt-app-panels #sx-opts #sx-text-row { margin-bottom: 10px !important; }


/* A picture of another shape (Tiny Planet is square, Reflection is taller or
   wider) is fitted into the stage the same way. */
#sx-canvas { object-fit: contain; }
