/* Sign Image page. Reuses /compress/compress-page.css (workspace, gallery frame, purpose cards,
   buttons, status line, results bar and cards); only signature-specific parts live here. */

.sign-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== Big preview inside the Shared Gallery (gallery `preview` extension) ===== */
.sign-page [data-lovepdfi-gallery] .lp-gallery__main--custom { display: block; overflow: visible; }
.sign-preview { width: 100%; min-width: 0; }
.sign-preview-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 0; }
.sign-preview-nav[hidden] { display: none; }
.sign-preview-count { font: 800 14px Roboto, system-ui, sans-serif; color: #1d2947; }
.sign-nav-btn {
  width: 44px; height: 40px; border: 1px solid #dfe5f1; border-radius: 10px; background: #fff;
  color: #315cf5; font: 800 22px/1 Roboto, system-ui, sans-serif; cursor: pointer;
}
.sign-nav-btn:disabled { opacity: .35; cursor: default; }
.sign-stage {
  position: relative; display: flex; justify-content: center; width: 100%; min-height: 160px; line-height: 0;
  background: #eef1f6; border-radius: 10px;
  touch-action: none;                                  /* the stage only: pinch / drag never zoom or scroll the page */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.sign-stage:focus { outline: none; }
.sign-stage:focus-visible { outline: 3px solid #315cf5; outline-offset: 2px; }
.sign-stage-canvas { display: block; max-width: 100%; cursor: default; }
.sign-stage.is-busy { pointer-events: none; opacity: .7; }
.sign-stage-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0;
  color: #5d6878; font: 700 13px/1.4 Roboto, system-ui, sans-serif; pointer-events: none;
}
.sign-stage-loading[hidden] { display: none; }

/* Colour menu (opened with ⋯ on the frame) */
.sign-color-menu { display: flex; justify-content: center; gap: 10px; margin: 10px 0 0; }
.sign-color-menu[hidden] { display: none; }
.sign-swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; padding: 0; cursor: pointer; }
.sign-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px #10b981; }
.sign-swatch:focus-visible { outline: 3px solid #315cf5; outline-offset: 2px; }
.sw-original { background: linear-gradient(135deg, #0b1f66 50%, #fff 50%); }
.sw-black { background: #111111; }
.sw-blue { background: #1d4ed8; }
.sw-red { background: #dc2626; }
.sw-green { background: #16a34a; }

/* Thumbnails with signatures that are not applied yet */
.sign-page .lp-thumb-item.sign-has-pending { position: relative; }
.sign-page .lp-thumb-item.sign-has-pending::after {
  content: "✍"; position: absolute; left: 3px; bottom: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #10b981; color: #fff; font: 700 12px/20px Roboto, system-ui, sans-serif; text-align: center; pointer-events: none;
}

/* ===== Settings ===== */
.sign-settings .sign-sources { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; }
.sign-settings .sign-source { min-width: 0; }
.sign-settings .settings-title { display: flex; margin-bottom: 12px; }
.sign-settings .sign-step2 { margin-top: 22px; padding-top: 18px; border-top: 1px solid #edf0f6; }
.sign-saved-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 0; }
.sign-saved-row:not(:has(button:not([hidden]))) { display: none; }
.sign-small-btn { min-height: 44px; padding: 9px 14px; font-size: 13.5px; }
.sign-link-btn { min-height: 44px; padding: 9px 12px; background: transparent; color: #b42335; font-size: 13px; text-decoration: underline; }
.sign-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 700 14px Roboto, system-ui, sans-serif; color: #263451; cursor: pointer; }
.sign-check input { width: 20px; height: 20px; margin: 0; accent-color: #10b981; }
.sign-remember { display: flex; justify-content: center; margin: 6px 0 0; }
.sign-privacy { margin: 0; text-align: center; color: #4b5875; font-size: 12.5px; line-height: 1.45; }
.sign-hint { margin: 0 0 10px; }
.sign-edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.sign-edit-row #signPasteAll { grid-column: 1 / -1; }
@media (min-width: 601px) { .sign-edit-row { grid-template-columns: auto auto auto; justify-content: center; } .sign-edit-row #signPasteAll { grid-column: auto; } }
.sign-stamp { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px; margin: 0 0 6px; }
.sign-stamp-size { display: inline-flex; align-items: center; gap: 6px; }
.sign-size-btn {
  min-width: 46px; min-height: 44px; border: 1px solid #dfe5f1; border-radius: 10px; background: #fff;
  color: #315cf5; font: 800 15px/1 Roboto, system-ui, sans-serif; cursor: pointer;
}
.sign-size-btn:disabled { opacity: .4; cursor: default; }
.sign-stamp-size output { min-width: 46px; text-align: center; font: 800 13px Roboto, system-ui, sans-serif; color: #263451; }
.sign-settings .compress-cancel-btn[hidden] { display: none; }

/* ===== Dialogs ===== */
.sign-dialog {
  width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 16px; border: 0; border-radius: 16px;
  background: #fff; color: #111a35; box-shadow: 0 20px 60px rgba(15, 23, 42, .35);
}
.sign-dialog::backdrop { background: rgba(15, 23, 42, .62); }
.sign-dialog h3 { margin: 0 0 10px; font-size: 17px; }
.sign-dialog p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.5; }
.sign-dialog-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.sign-dialog-row .page-btn { flex: 1 1 0; min-width: 0; }
.sign-dialog-row .page-btn[hidden] { display: none; }
.sign-notice { width: min(420px, calc(100vw - 24px)); }
.sign-pad {
  display: block; width: 100%; height: auto; aspect-ratio: 900 / 320; border: 2px dashed #94a3b8; border-radius: 10px;
  background: #fff; touch-action: none; cursor: crosshair;
}
.sign-dialog-full {
  width: calc(100vw - 16px); max-width: 1000px; height: calc(100dvh - 16px); max-height: none;
  display: none; flex-direction: column;
}
.sign-dialog-full[open] { display: flex; }
.sign-crop-box { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #0f172a; border-radius: 10px; }
.sign-crop-canvas { display: block; touch-action: none; }
.sign-checker {
  display: flex; justify-content: center; padding: 10px; border-radius: 10px;
  background: repeating-conic-gradient(#e2e8f0 0 25%, #fff 0 50%) 0 0 / 20px 20px;
}
.sign-checker[hidden] { display: none; }
.sign-result-canvas { display: block; max-width: 100%; max-height: 40vh; height: auto; }
.sign-error { color: #b42335; font-weight: 700; }
.sign-error[hidden] { display: none; }

@media (max-width: 600px) {
  .sign-settings .sign-sources { gap: 6px; }
  .sign-settings .sign-source { flex-direction: column; text-align: center; padding: 10px 4px; gap: 4px; }
  .sign-settings .sign-source .purpose-text small { font-size: 10.5px; }
  .sign-dialog { padding: 12px; }
}

/* ===== Same look as the Compress page ===== */
.sign-page #signClearAll{background:#dc3f45!important;border:1px solid #dc3f45!important;color:#fff!important;box-shadow:0 5px 14px rgba(220,63,69,.16)}
.sign-page #signClearAll:disabled{background:#dc3f45!important;color:#fff!important;opacity:.55}
/* Four trust cards (Compress has three): one row on wide screens, 2 × 2 on phones, same card style. */
.sign-page .trust-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:700px){.sign-page .trust-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.sign-page .sig-help{max-width:760px;margin:28px auto;text-align:left}
.sign-page .sig-help li{margin:8px 0}

/* ===== Full window editor (same look as the PDF signature editor) ===== */
.sign-fw {
  width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0f172a; color: #fff; overflow: hidden;
}
.sign-fw[open] { display: flex; flex-direction: column; }
.sign-fw::backdrop { background: #0f172a; }
.sign-fw-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
}
.sign-fw-title { flex: 1; text-align: center; font: 500 15px/1.3 Roboto, system-ui, sans-serif; opacity: .9; }
.sign-fw-btn {
  flex: 0 0 auto; min-height: 44px; padding: 10px 14px; border: 1px solid #334155; border-radius: 10px;
  background: #1e293b; color: #fff; font: 600 14px/1.2 Roboto, system-ui, sans-serif; cursor: pointer;
}
.sign-fw-btn:disabled { opacity: .45; cursor: default; }
.sign-fw-btn[hidden] { display: none; }
.sign-fw-btn:focus-visible, .sign-fw-chk:focus-within { outline: 3px solid #93c5fd; outline-offset: 2px; }
.sign-fw-done { background: #16a34a; border-color: #16a34a; min-width: 84px; }
.sign-fw-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 8px; overflow: hidden; }
.sign-fw-stage .sign-preview { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sign-fw-stage .sign-stage { background: transparent; flex: 0 0 auto; }
.sign-fw-stage .sign-stage-canvas { box-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.sign-fw-stage .sign-color-menu { margin-top: 8px; }
.sign-fw-stage .sign-swatch { border-color: #0f172a; box-shadow: 0 0 0 1px #64748b; }
.sign-fw-nav { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 4px 12px 0; }
.sign-fw-nav[hidden] { display: none; }
.sign-fw-arrow { width: 48px; padding: 6px 0; font-size: 22px; }
.sign-fw-count { min-width: 110px; text-align: center; font: 700 14px Roboto, system-ui, sans-serif; }
.sign-fw-note { min-height: 18px; margin: 4px 12px 0; text-align: center; color: #a7f3d0; font: 500 13px/1.35 Roboto, system-ui, sans-serif; }
.sign-fw-bar {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px;
  width: 100%; max-width: 640px; margin: 0 auto; box-sizing: border-box;
  padding: 8px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.sign-fw-wide { flex: 0 0 100%; }
.sign-fw-chk {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid #334155;
  border-radius: 10px; background: #1e293b; font: 600 14px Roboto, system-ui, sans-serif; cursor: pointer;
}
.sign-fw-chk input { width: 20px; height: 20px; margin: 0; accent-color: #10b981; }
.sign-fw-range { flex: 1 1 100%; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 10px; font: 500 14px Roboto, system-ui, sans-serif; }
.sign-fw-range input { flex: 0 1 260px; min-width: 90px; width: auto; accent-color: #a3e635; }
.sign-fw-range output { min-width: 46px; font-weight: 700; color: #cbd5e1; }
@media (max-width: 600px) { .sign-fw-btn { padding: 9px 11px; font-size: 13.5px; } .sign-fw-bar { gap: 6px; } }

/* ===== Apply close to the gallery: sources → edit row → Apply; extra options below the results ===== */
.sign-settings .sign-sources { margin-bottom: 10px; }
.sign-settings .sign-saved-row { margin: 0 0 10px; }
.sign-edit-row, .sign-edit-row:is(*) { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; margin: 0 0 6px; }
.sign-edit-row #signPasteAll { grid-column: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 601px) { .sign-edit-row { grid-template-columns: auto auto minmax(0, 260px); justify-content: center; } }
@media (max-width: 370px) { .sign-edit-row .sign-small-btn { padding: 9px 10px; font-size: 12.5px; } }
.sign-pending { margin: 4px 0 0; text-align: center; color: #5d6878; font: 600 12.5px/1.4 Roboto, system-ui, sans-serif; }
.sign-settings .process-actions { margin-top: 8px; }
.sign-options { margin-top: 22px; padding-top: 16px; border-top: 1px solid #edf0f6; }
.sign-options .sign-hint { margin: 6px 0 4px; }
.sign-options .sign-saved-row { margin: 4px 0 0; }
.sign-wide-only { display: none; }
@media (min-width: 421px) { .sign-wide-only { display: inline; } }

/* ===== Compact signature sources (icon + name on one line) ===== */
.sign-settings .sign-sources {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 560px; margin: 0 auto 10px;
}
.sign-source {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 48px; padding: 8px 10px;
  border: 1px solid #dbe3f4; border-radius: 14px; background: linear-gradient(180deg, #ffffff, #f4f7ff);
  color: #1f2a44; font: 800 14px/1.15 Roboto, system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 2px 8px rgba(49, 92, 245, .07); transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.sign-source:hover:not(:disabled) { border-color: #9db5ff; box-shadow: 0 6px 16px rgba(49, 92, 245, .14); transform: translateY(-1px); }
.sign-source:active:not(:disabled) { transform: scale(.97); background: #eef2ff; }
.sign-source:focus-visible { outline: 3px solid rgba(49, 92, 245, .35); outline-offset: 2px; }
.sign-source:disabled { opacity: .5; cursor: default; box-shadow: none; }
.sign-source-icon {
  flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: #eaf0ff; font-size: 15px; line-height: 1;
}
.sign-source-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .sign-settings .sign-sources { gap: 6px; }
  .sign-source { gap: 5px; padding: 7px 6px; font-size: 13px; border-radius: 12px; }
  .sign-source-icon { width: 24px; height: 24px; font-size: 13px; border-radius: 8px; }
}

/* ===== Date / time stamp just above Apply: one compact row ===== */
.sign-settings .sign-stamp {
  display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 6px; max-width: 560px; margin: 6px auto 0;
}
.sign-settings .sign-stamp .sign-check {
  justify-content: center; gap: 6px; min-height: 42px; padding: 6px 8px; border: 1px solid #e1e6f0; border-radius: 12px;
  background: #fff; font-size: 13px; white-space: nowrap;
}
.sign-settings .sign-stamp .sign-check:has(input:checked) { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.sign-settings .sign-stamp .sign-check input { width: 18px; height: 18px; }
.sign-settings .sign-stamp-size { gap: 2px; padding: 2px; border: 1px solid #e1e6f0; border-radius: 12px; background: #fff; }
.sign-settings .sign-size-btn { min-width: 40px; min-height: 40px; border: 0; border-radius: 9px; background: #f2f5ff; font-size: 13.5px; }
.sign-settings .sign-stamp-size output { min-width: 40px; font-size: 12.5px; }
@media (max-width: 480px) {
  .sign-settings .sign-stamp { grid-template-columns: 1fr 1fr; }
  .sign-settings .sign-stamp-size { grid-column: 1 / -1; justify-self: center; }
}
/* the older mobile rule stacked icon over text: keep one line */
.sign-settings .sign-source, .sign-settings .sign-source:is(*) { flex-direction: row; text-align: left; }

/* ===== Date / time size: slim slider, shown only while a stamp is ticked ===== */
.sign-settings .sign-stamp-size, .sign-settings .sign-stamp-size:is(*) {
  grid-column: 1 / -1; justify-self: stretch; display: flex; align-items: center; gap: 10px;
  min-height: 0; padding: 2px 4px; border: 0; background: none; font: 700 12.5px Roboto, system-ui, sans-serif; color: #4b5875;
}
.sign-settings .sign-stamp-size[hidden] { display: none; }
.sign-settings .sign-stamp-size input { flex: 1 1 auto; min-width: 0; height: 28px; margin: 0; accent-color: #10b981; }
.sign-settings .sign-stamp-size output { min-width: 40px; text-align: right; color: #263451; }
.sign-settings .sign-stamp { grid-template-columns: 1fr 1fr; }
.sign-fw-range[hidden] { display: none; }
