/* Sign PDF Online — local prototype only */

.pdf-sign-workspace {
  width: 100%;
  min-width: 0;
}

.pdf-sign-workspace > h2 {
  margin-bottom: 12px;
}

.pdf-sign-upload {
  margin: 24px 0;
  padding: 24px;
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  background: rgba(100, 140, 190, .045);
}

.pdf-sign-upload input {
  display: block;
  margin-top: 14px;
  max-width: 100%;
}

.pdf-sign-help,
.pdf-sign-privacy {
  font-size: .9rem;
  line-height: 1.65;
  opacity: .85;
}

.pdf-sign-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  margin: 28px 0;
}

.pdf-sign-editor[hidden],
.pdf-sign-controls [hidden] {
  display: none !important;
}

.pdf-sign-preview,
.pdf-sign-controls {
  min-width: 0;
  padding: 22px;
  border: 1px solid rgba(130, 150, 175, .35);
  border-radius: 14px;
  background: rgba(130, 150, 175, .045);
}

.pdf-sign-preview h3,
.pdf-sign-controls h3 {
  margin: 0 0 18px;
}

.pdf-sign-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.pdf-sign-navigation button,
.pdf-sign-tabs button,
#signClearDrawing {
  padding: 10px 14px;
  border: 1px solid rgba(130, 150, 175, .5);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.pdf-sign-page {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

#signPdfCanvas {
  display: block;
  width: 100%;
  height: auto;
}

#signPdfOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pdf-sign-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pdf-sign-tabs button[aria-pressed="true"] {
  border-color: #3789f8;
  background: rgba(55, 137, 248, .12);
  font-weight: 700;
}

#signDrawingCanvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
}

#signClearDrawing {
  margin-top: 10px;
}

.pdf-sign-controls input[type="text"],
.pdf-sign-controls input[type="date"],
.pdf-sign-controls input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 8px 0 18px;
}

.pdf-sign-options {
  margin: 22px 0;
}

.pdf-sign-options label {
  display: block;
  margin-top: 14px;
  font-weight: 600;
}

#signSize {
  display: block;
  width: 100%;
  margin: 16px 0;
}

#signPlaceSignature,
#signDownload,
#signClearAll {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.pdf-sign-privacy {
  margin-top: 22px;
  padding: 16px 18px;
  border-left: 3px solid #3789f8;
  background: rgba(55, 137, 248, .06);
  border-radius: 8px;
}

@media (max-width: 850px) {
  .pdf-sign-editor {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .pdf-sign-upload,
  .pdf-sign-preview,
  .pdf-sign-controls {
    padding: 16px;
  }

  .pdf-sign-navigation {
    justify-content: center;
  }

  .pdf-sign-navigation button {
    flex: 1;
  }

  .pdf-sign-tabs button {
    flex: 1;
  }
}

/* Document preview editing toolbar */

.pdf-sign-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 14px;
}

.pdf-sign-undo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(130, 150, 175, .45);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.pdf-sign-undo-icon:hover:not(:disabled) {
  background: rgba(55, 137, 248, .1);
  border-color: #3789f8;
}

.pdf-sign-undo-icon:focus-visible {
  outline: 3px solid #3789f8;
  outline-offset: 3px;
}

.pdf-sign-undo-icon:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.pdf-sign-edit-actions:empty {
  display: none;
}

.pdf-sign-edit-actions {
  margin-top: 10px;
}

#signRemoveSelected {
  width: 100%;
  margin: 0;
}

/* PDF preview: Undo left, zoom controls right */

.pdf-sign-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.pdf-sign-zoom-toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-left: auto;
  flex-wrap: nowrap;
}

.pdf-sign-zoom-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 4px 8px;
  border: 1px solid #b8c6d8;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.pdf-sign-zoom-toolbar button:hover:not(:disabled) {
  border-color: #3789f8;
  background: rgba(55, 137, 248, .08);
}

.pdf-sign-zoom-toolbar button:focus-visible {
  outline: 2px solid #3789f8;
  outline-offset: 2px;
}

#signZoomLevel {
  min-width: 42px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 420px) {
  .pdf-sign-zoom-toolbar {
    gap: 4px;
  }

  .pdf-sign-zoom-toolbar button {
    min-width: 32px;
    padding: 4px 6px;
  }
}

/* Active PDF zoom: preserve natural canvas dimensions. */

.pdf-sign-page {
  width: max-content;
  max-width: none;
  overflow: hidden;
}

#signPdfCanvas {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
}

#signPdfOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Allow the preview to scroll horizontally when magnified. */
.pdf-sign-preview {
  min-width: 0;
}

.pdf-sign-preview .pdf-sign-page {
  margin-right: 0;
}

/* Keep magnified PDFs inside the document preview. */

.pdf-sign-preview {
  min-width: 0;
  max-width: 100%;
}

.pdf-sign-viewport {
  width: 100%;
  max-width: 100%;
  max-height: 75vh;
  min-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 4px;
  scrollbar-gutter: stable;
}

.pdf-sign-viewport .pdf-sign-page {
  position: relative;
  width: max-content;
  max-width: none;
  margin: 0;
}

.pdf-sign-viewport #signPdfCanvas {
  display: block;
  max-width: none;
}

.pdf-sign-preview-toolbar {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 600px) {
  .pdf-sign-viewport {
    max-height: 65vh;
  }
}


/* Pen cursor for handwritten signatures. */
#signDrawingCanvas {
  cursor: url("./pen-cursor.svg") 5 27, crosshair;
}
