/* Firma PDF Privata & Timbro Aziendale - Specific Styles */

:root {
  --primary-ink: #000000;
  --primary-accent: #2563eb;
  --selection-color: #000000;
}

body {
  font-size: 18px;
  background-color: var(--bg-page) !important;
  color: var(--ink);
}

/* Ensure no font drops below 16px */
p, span, small, label, input, button, .badge, .alert, .modal-title, .modal-body, .toast {
  font-size: 16px;
}

h1, .h1 { font-size: 24px; font-weight: 850; }
h2, .h2 { font-size: 22px; font-weight: 850; }
h3, .h3 { font-size: 19px; font-weight: 800; }

/* Dropzone styling */
.border-dashed {
  border-style: dashed !important;
}

#dropZone {
  background-color: #ffffff !important;
  border: 2.5px dashed var(--border-color) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

#dropZone.dragover {
  background-color: #f0f7ff !important;
  border-color: #000000 !important;
  transform: scale(1.01);
}

/* Page wrapper container */
.page-wrap {
  position: relative;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  border: 2.5px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  user-select: none;
}

.page-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.page-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.page-number-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(9, 9, 11, 0.75);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 10;
}

/* Placed item (signature / stamp) */
.placed-item {
  position: absolute;
  cursor: grab;
  touch-action: none;
  border: 2px dashed transparent;
  box-sizing: border-box;
  transform-origin: center center;
  transition: border-color 0.15s ease;
}

.placed-item:active {
  cursor: grabbing;
}

.placed-item.selected {
  border-color: var(--selection-color);
  box-shadow: 0 0 0 1px #ffffff, 0 4px 16px rgba(37, 99, 235, 0.25);
}

.placed-item img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

/* Handles on selected items */
.item-handle-resize {
  position: absolute;
  bottom: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  background: #2563eb;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: nwse-resize;
  display: none;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.item-handle-rotate {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: #16a34a;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  display: none;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.item-btn-delete {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: #dc2626;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.placed-item.selected .item-handle-resize,
.placed-item.selected .item-handle-rotate,
.placed-item.selected .item-btn-delete {
  display: flex;
}
