/* useforfree — PDF editor (/edit-pdf/, /sign-pdf/). Loaded only on those pages. */

@font-face {
  font-family: "Great Vibes";
  src: url("/assets/fonts/great-vibes-latin.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Dancing Script";
  src: url("/assets/fonts/dancing-script-600-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("/assets/fonts/caveat-500-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* Toolbar */

.ed-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.ed-btn {
  font: inherit;
  font-size: .78rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 54px;
  padding: 6px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.ed-btn .ico { font-size: 1.15rem; line-height: 1.1; }
.ed-btn:hover { background: var(--accent-soft); }
.ed-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ed-btn:disabled { opacity: .4; cursor: not-allowed; background: none; }
.ed-btn.primary { background: var(--accent); color: var(--accent-text); }
.ed-btn.primary:hover { background: var(--accent-hover); }
.ed-sep { width: 1px; background: var(--border); margin: 4px 3px; }
.ed-spacer { flex: 1; }
.ed-zoom { align-self: center; font-size: .8rem; color: var(--muted); min-width: 40px; text-align: center; }

/* Context options and hint */

.ed-props {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 8px 2px 0;
  min-height: 38px;
  font-size: .9rem;
}
.ed-props[hidden] { display: none; }
.ed-props label { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.ed-props select,
.ed-props input[type="number"] { width: auto; padding: 5px 8px; }
.ed-props input[type="number"] { width: 70px; }
.ed-props input[type="color"] { width: 40px; height: 32px; }
.ed-bold[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.ed-hint { color: var(--muted); font-size: .9rem; margin: 6px 2px 0; }

/* Pages */

.ed-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  padding: 16px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.ed-page {
  position: relative;
  flex: none;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.ed-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-layer { position: absolute; inset: 0; }
.ed-mode-text .ed-layer,
.ed-mode-date .ed-layer { cursor: text; }
.ed-mode-check .ed-layer,
.ed-mode-cross .ed-layer { cursor: copy; }
.ed-mode-draw .ed-layer,
.ed-mode-highlight .ed-layer,
.ed-mode-whiteout .ed-layer { cursor: crosshair; touch-action: none; }

/* Items placed on a page */

.ed-obj {
  position: absolute;
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ed-obj.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-text { white-space: pre; line-height: 1.2; }
.ed-text-content {
  outline: none;
  min-width: 6px;
  min-height: 1.2em;
  unicode-bidi: plaintext;
  text-align: start;
}
.ed-text-content:empty::before { content: "Type here"; opacity: .45; }
.ed-obj.editing { cursor: text; user-select: text; -webkit-user-select: text; }
.ed-image img { display: block; width: 100%; height: 100%; pointer-events: none; }
.ed-path svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ed-highlight { mix-blend-mode: multiply; opacity: .45; }
.ed-whiteout { outline: 1px dashed rgba(0, 0, 0, .25); }
.ed-whiteout.selected { outline: 2px solid var(--accent); }
.ed-live { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }

.ed-handle,
.ed-remove { display: none; position: absolute; }
.ed-obj.selected .ed-handle,
.ed-obj.selected .ed-remove { display: block; }
.ed-obj.editing .ed-handle { display: none; }
.ed-handle {
  right: -9px;
  bottom: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  cursor: nwse-resize;
}
.ed-remove {
  top: -13px;
  right: -13px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--err);
  color: #fff;
  font: 700 12px/22px var(--font);
  text-align: center;
  cursor: pointer;
}
@media (pointer: coarse) {
  .ed-handle { width: 24px; height: 24px; right: -13px; bottom: -13px; }
  .ed-remove { width: 28px; height: 28px; line-height: 28px; top: -16px; right: -16px; }
}

/* Signature dialog */

.sig-dialog {
  width: min(640px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}
.sig-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.sig-dialog h2 { margin: 0 0 12px; font-size: 1.2rem; }
.sig-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.sig-tab {
  font: inherit;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.sig-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.sig-pad {
  display: block;
  width: 100%;
  height: 200px;
  background: #fff;
  border: 1px dashed #b8b8b8;
  border-radius: 10px;
  touch-action: none;
  cursor: crosshair;
}
.sig-fonts { display: grid; gap: 8px; margin-top: 10px; }
.sig-font {
  font-size: 2rem;
  line-height: 1.4;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #1a1a1a;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.sig-font[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sig-colors { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: .9rem; color: var(--muted); }
.sig-color {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}
.sig-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.sig-preview {
  display: block;
  max-width: 100%;
  max-height: 160px;
  margin-top: 10px;
  border-radius: 8px;
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}
.sig-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.sig-actions .sig-reuse { margin-right: auto; }
