/* ── PDF Sign — tool-specific styles ──────────────────────────────────────────
   Global styles are inherited from /css/style.css.
   Colours reference CSS custom properties only — no hardcoded values.
   ─────────────────────────────────────────────────────────────────────────── */

.pds-page { display: flex; flex-direction: column; gap: 0; }

/* ── Dropzone ─────────────────────────────────────────────────────────────── */

.pds-dropzone {
  width: 100%;
  min-height: 220px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  padding: 2rem 1rem;
}
.pds-dropzone:hover,
.pds-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.pds-dropzone__icon { font-size: 3rem; margin-bottom: 12px; display: block; }
.pds-dropzone__text { font-size: 1.1rem; font-weight: 500; color: var(--text-primary); margin: 0; }
.pds-dropzone__hint { font-size: 0.8rem; color: var(--text-secondary); margin: 4px 0 0; }
.pds-choose-btn { margin-top: 12px; }

.pds-error {
  margin: 0.75rem 0 0;
  color: var(--color-danger, #ef4444);
  font-size: 0.875rem;
}
.pds-warning {
  margin: 0 0 1rem;
  color: var(--color-warning, #b45309);
  font-size: 0.875rem;
}
.pds-loading {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.pds-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

#pds-editor-section[hidden] { display: none; }

/* ── Layout ───────────────────────────────────────────────────────────────── */

.pds-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  .pds-layout { grid-template-columns: 1fr; }
}

.pds-preview-col { display: flex; flex-direction: column; gap: 0.75rem; }
.pds-controls-col { display: flex; flex-direction: column; gap: 1rem; }

/* ── Page navigator ───────────────────────────────────────────────────────── */

.pds-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.pds-nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.pds-nav-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-light); }
.pds-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pds-page-label { font-size: 0.9rem; color: var(--text-secondary); min-width: 110px; text-align: center; }

/* ── Page canvas + signature overlay ─────────────────────────────────────── */

.pds-canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  padding: 0.5rem;
  overflow: hidden;
}

#pds-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.pds-overlay {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(0, 0, 0, 0.001);
  cursor: move;
  touch-action: none;
  min-width: 24px;
}
.pds-overlay[hidden] { display: none; }
.pds-overlay img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}
.pds-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  cursor: nwse-resize;
  touch-action: none;
}

.pds-hint { margin: 0; font-size: 0.8rem; color: var(--text-secondary); text-align: center; }

.pds-placement-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pds-signed-pages {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.pds-signed-pages[hidden] { display: none; }
.pds-signed-pages__label { font-size: 0.85rem; color: var(--text-secondary); }
.pds-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pds-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.35rem 0.25rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-card);
  font-size: 0.8rem;
  color: var(--text-primary);
}
.pds-chip.is-active { border-color: var(--accent); background: var(--accent-light); }
.pds-chip button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 4px;
}
.pds-chip button:hover { color: var(--color-danger, #ef4444); }
.pds-chip span { cursor: pointer; }

/* ── Cards ────────────────────────────────────────────────────────────────── */

.pds-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card, 8px);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.pds-card__heading { font-size: 1.05rem; margin: 0; }

.pds-mode-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pds-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color var(--transition), background var(--transition);
}
.pds-mode-pill:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.pds-mode-pill input { accent-color: var(--accent); }

.pds-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; flex: 1; }
.pds-label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.pds-help { margin: 0; font-size: 0.8rem; color: var(--text-secondary); }

.pds-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control, 8px);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font-size: 1rem;
}
.pds-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pds-field-row { display: flex; align-items: flex-end; gap: 0.6rem; }
@media (max-width: 520px) { .pds-field-row { flex-direction: column; align-items: stretch; } }

.pds-color-input {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  background: none;
}
.pds-slider { width: 100%; accent-color: var(--accent); cursor: pointer; }

.pds-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
}
.pds-checkbox-row input { accent-color: var(--accent); }

.pds-draw-canvas-wrap {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
#pds-draw-canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }

.pds-clear-btn { align-self: flex-start; }

.pds-type-preview-wrap,
.pds-upload-preview-wrap {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
}
#pds-type-canvas, #pds-upload-canvas { max-width: 100%; display: block; }
#pds-upload-canvas[hidden] { display: none; }

.pds-use-signature-btn { align-self: flex-start; }

.pds-current-signature {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 0.8rem;
}
.pds-current-signature[hidden] { display: none; }
.pds-current-signature img {
  max-width: 90px;
  max-height: 40px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
}

.pds-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.pds-privacy-notice { font-size: 0.8rem; color: var(--text-secondary); text-align: center; margin: 0; }

/* ── Common uses ──────────────────────────────────────────────────────────── */

.pds-uses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.pds-uses-grid h3 { font-size: 1rem; margin: 0 0 0.4rem; }
.pds-uses-grid p { margin: 0; font-size: 0.9rem; color: var(--text-secondary); }
