/* ---- PDF page + overlay ---- */
.page-wrap {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  container-type: size;
}
.page-wrap canvas.pdf-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.page-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  font-weight: 800;
}
.page-number {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  z-index: 5;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  pointer-events: none;
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
}

/* ---- Placed items ---- */
.item {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.item:hover,
.item.selected {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25);
}
.item.dragging {
  cursor: grabbing;
}
.item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}
.item.item-textbox {
  display: inline-flex;
  align-items: center;
  white-space: pre;
  padding: 1px 4px;
  line-height: 1.15;
  font-weight: 700;
}
.item.item-textbox .txt {
  pointer-events: none;
  outline: none;
  white-space: pre;
}
.item.item-textbox.editing {
  cursor: text;
  border-color: #fbbf24;
}
.item.item-textbox.editing .txt {
  pointer-events: auto;
  min-width: 8px;
}

/* handles: only visible when selected/hover */
.item .handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #111827;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.15s;
}
.item:hover .handle,
.item.selected .handle {
  opacity: 1;
}
.item .handle.resize {
  inset-inline-start: -9px;
  bottom: -9px;
  cursor: nesw-resize;
}
.item .handle.delete {
  inset-inline-end: -9px;
  top: -9px;
  background: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

/* ---- Signature modal tabs ---- */
.sig-tab {
  color: #6b7280;
}
.sig-tab.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.type-font.active,
.type-color.active,
.pen-color.active {
  outline: none;
}
.type-font.active {
  border-color: #111827;
  background: #f9fafb;
}

/* ---- Spinner ---- */
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
