/*!
 * 123PhotoTool Signature Maker and Resize Signature (inc/signature-tool.inc.php).
 * The panel's own parts (the shared segmented control is .pt-cseg, themed in
 * pt-theme.css), the signing box in the photo box, and the phone editor's
 * Type row.
 */

/* ── Panel ─────────────────────────────────────────────────────────────── */
.sig-modes > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sig-modes > button svg { width: 18px; height: 18px; flex: none; }
.sig-hint { font-size: 13px; line-height: 1.45; color: var(--cb-muted, #626973); margin: 0 0 10px; }
.sig-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sig-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.sig-flip { display: inline-block; transform: scaleX(-1); }

/* Type: each style shows the name in it, two to a row. */
.sig-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sig-font {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 60px;
  padding: 0 10px;
  font-size: 26px;
  line-height: 1.6;
  color: var(--cb-ink, #16181d);
  background: #fff;
  border: 1px solid var(--cb-line, #e4e1dc);
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
}
.sig-font > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-font:hover { border-color: #cfcac3; }
/* Upload a font...: a dashed tile, in the page's own type. */
.sig-font.sig-font-up { border-style: dashed; color: var(--pt-accent, #0f70e6); font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.25; text-align: center; white-space: normal; gap: 6px; }
.sig-font-up .uil { font-size: 18px; }
.sig-font[aria-pressed="true"] { border-color: #fff; box-shadow: var(--cb-ring, 0 0 0 2px #fff, 0 0 0 4px #16181d); }
.sig-font:focus-visible { outline: 3px solid rgba(15, 112, 230, 0.45); outline-offset: 2px; }

/* Ink: round swatches, and Original as a chip (Upload). */
.sig-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 2px; }
.sig-swatch {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(22, 24, 29, 0.18);
  cursor: pointer;
}
.sig-swatch[aria-pressed="true"] { box-shadow: var(--cb-ring, 0 0 0 2px #fff, 0 0 0 4px #16181d); }
.sig-swatch:focus-visible, .sig-pill:focus-visible { outline: 3px solid rgba(15, 112, 230, 0.45); outline-offset: 3px; }
.sig-pill {
  flex: none;
  min-height: 34px;
  padding: 4px 12px;
  font-size: 12.8px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--cb-text, #3d434b);
  background: var(--cb-bg, #f5f4f2);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.sig-pill:hover { color: var(--cb-ink, #16181d); background: var(--cb-hover-bg, #ece9e4); }
.sig-pill[aria-pressed="true"] { color: #fff; background: var(--cb-ink, #16181d); }

/* Size: a custom width × height and unit on one row; DPI and KB beside
   their labels. */
.sig-custom { display: flex; align-items: center; gap: 6px; }
.sig-custom .form-control { flex: 1 1 0; min-width: 0; }
.sig-custom .form-select { flex: 0 0 auto; width: auto; min-width: 72px; }
.sig-times { flex: none; color: var(--cb-muted, #626973); }
.sig-inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sig-inline > .form-label { flex: 1 1 auto; min-width: 0; }
.sig-inline > .form-select { flex: 0 0 auto; width: auto; min-width: 96px; }
.sig-kb { flex: 0 0 auto; width: 150px; flex-wrap: nowrap; }
.sig-kb .form-control { min-width: 0; }

/* The picture saved, at its own size where it fits. */
.sig-result-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 12px;
  background-color: #fff;
  background-image: linear-gradient(45deg, #e9e6e1 25%, transparent 25%), linear-gradient(-45deg, #e9e6e1 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e9e6e1 75%), linear-gradient(-45deg, transparent 75%, #e9e6e1 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.sig-result-box.sig-on-white { background: #fff; box-shadow: inset 0 0 0 1px var(--cb-line, #e4e1dc); }
.sig-result-box img { display: block; max-width: 100%; max-height: 200px; height: auto; object-fit: contain; }
.sig-result-info { color: var(--cb-text, #3d434b); font-variant-numeric: tabular-nums; }
.sig-result-warn { color: #b42318; }

/* ── The signing box ───────────────────────────────────────────────────── */
.sig-viewport { display: flex; align-items: center; justify-content: center; }
.sig-paper {
  position: relative;
  flex: none;
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.55);
}
.sig-paper.sig-checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #ecebe8 25%, transparent 25%), linear-gradient(-45deg, #ecebe8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ecebe8 75%), linear-gradient(-45deg, transparent 75%, #ecebe8 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.sig-paper canvas { position: absolute; z-index: 1; inset: 0; display: block; width: 100%; height: 100%; border-radius: 14px; }
.sig-paper.sig-drawing canvas { cursor: crosshair; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* The line to sign on, with its cross, under the strokes. */
.sig-line { position: absolute; z-index: 0; inset-inline: 9%; bottom: 27%; border-bottom: 1.5px solid #dcd8d2; pointer-events: none; }
.sig-line::before { content: "\00d7"; position: absolute; inset-inline-start: -4px; bottom: 2px; font-size: 22px; line-height: 1; color: #bdb8b1; }
.sig-paper:not(.sig-drawing) .sig-line { display: none; }
.sig-placeholder {
  position: absolute;
  z-index: 0;
  inset-inline: 0;
  top: 38%;
  text-align: center;
  font-size: 18px;
  color: #b3aea7;
  pointer-events: none;
}

/* ── Phone editor: Type in the bottom bar ─────────────────────────────── */
.pt-app-panels #sig-type-panel { padding: 6px 10px 2px; }
.pt-app-panels #sig-type-panel .form-label,
.pt-app-panels #sig-type-panel .sig-hint { display: none !important; }
.pt-app-panels #sig-type-panel .form-control { font-size: 16px; min-height: 40px; margin-bottom: 8px !important; }
.pt-app-panels #sig-fonts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  /* Room for the chosen style's ring, which the scrolling row would clip. */
  padding: 4px 4px 6px;
}
.pt-app-panels #sig-fonts::-webkit-scrollbar { display: none; }
.pt-app-panels .sig-font { flex: 0 0 auto; width: 150px; height: 48px; font-size: 22px; }
.pt-app-panels .sig-font.sig-font-up { width: 120px; font-size: 13px; }
