/**
 * ONE RESIZER — Tool 17: PDF Signature Stylesheet
 * Interactive Signature Studio (Draw, Type, Upload & Transparent Ink),
 * Multi-Signature Draggable/Resizable Stage Overlay, Scope Targeting,
 * Real-Time Visual Feedback, and Responsive Layout.
 */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@600;700&family=Dancing+Script:wght@700&family=Great+Vibes&family=Homemade+Apple&display=swap');

/* ========================================================
   CONTAINER & WORKSPACE VIEWS
   ======================================================== */
.pdfsig-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.pdfsig-view {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.pdfsig-view.hidden {
  display: none !important;
}

/* ========================================================
   UPLOAD HERO SCREEN
   ======================================================== */
.upload-hero-card {
  background: var(--bg-card);
  border: 2px dashed var(--primary-cyan);
  border-radius: var(--radius-xl);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.upload-hero-card:hover, .upload-hero-card.dragover {
  background: rgba(22, 135, 245, 0.08);
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.upload-icon-wrapper {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: rgba(22, 135, 245, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-cyan);
}
.upload-icon-wrapper svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
}

.upload-heading {
  font-size: 20px;
  font-weight: 850;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.upload-subheading {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.upload-btn-fake {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-cyan);
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  padding: 9px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px var(--primary-glow);
  margin-bottom: 14px;
  transition: var(--transition);
}
.upload-btn-fake:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.upload-formats-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

/* ========================================================
   WORKSPACE 2-COLUMN STUDIO LAYOUT
   ======================================================== */
.pdfsig-studio-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 950px) {
  .pdfsig-studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Signature Creation & Controls */
.pdfsig-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* Mini File Bar */
.pdfsig-file-mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.pdfsig-mini-info {
  min-width: 0;
}
.pdfsig-mini-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.pdfsig-mini-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.pdfsig-btn-change {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 750;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.pdfsig-btn-change:hover {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* Method Tabs: Draw / Type / Upload */
.pdfsig-method-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 16px;
}
.pdfsig-method-tab {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.pdfsig-method-tab:hover {
  color: var(--text-heading);
}
.pdfsig-method-tab.active {
  background: var(--bg-card);
  color: var(--primary-cyan);
  box-shadow: var(--shadow-sm);
}

/* METHOD A: DRAW CANVAS BOX */
.pdfsig-draw-box {
  background: var(--bg-subtle);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pdfsig-draw-canvas {
  width: 100%;
  height: 130px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: crosshair;
  touch-action: none;
}
.pdfsig-draw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
}
.pdfsig-color-swatches {
  display: flex;
  gap: 6px;
}
.pdfsig-ink-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}
.pdfsig-ink-dot.active {
  border-color: var(--text-heading);
  transform: scale(1.15);
}
.pdfsig-btn-mini {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.pdfsig-btn-mini:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* METHOD B: TYPE SIGNATURE BOX */
.pdfsig-type-box {
  margin-bottom: 14px;
}
.pdfsig-input-name {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  outline: none;
  box-sizing: border-box;
  margin-bottom: 10px;
}
.pdfsig-input-name:focus {
  border-color: var(--primary-cyan);
}
.pdfsig-font-previews {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}
.pdfsig-font-choice {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 20px;
  color: #0f172a;
  transition: var(--transition);
  user-select: none;
}
.pdfsig-font-choice:hover {
  border-color: rgba(22, 135, 245, 0.4);
}
.pdfsig-font-choice.active {
  border-color: var(--primary-cyan);
  background: rgba(22, 135, 245, 0.08);
  color: var(--primary-cyan);
}

/* METHOD C: UPLOAD SIGNATURE BOX */
.pdfsig-upload-box {
  margin-bottom: 14px;
}
.pdfsig-upload-thumb-wrap {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pdfsig-upload-thumb {
  max-height: 48px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 2px;
  display: none;
}

/* Add Signature to Page Button */
.pdfsig-btn-place {
  width: 100%;
  padding: 10px 14px;
  background: rgba(22, 135, 245, 0.1);
  border: 1.5px solid var(--primary-cyan);
  color: var(--primary-cyan);
  font-size: 13px;
  font-weight: 800;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pdfsig-btn-place:hover {
  background: var(--primary-cyan);
  color: #fff;
}

/* Signature Options Section (Opacity, Scope) */
.pdfsig-options-box {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-bottom: 18px;
}
.pdfsig-form-group {
  margin-bottom: 12px;
}
.pdfsig-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pdfsig-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pdfsig-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--primary-cyan);
}
.pdfsig-slider-val {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 40px;
}

.pdfsig-scope-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.pdfsig-scope-btn {
  padding: 6px 10px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.pdfsig-scope-btn:hover {
  color: var(--text-heading);
}
.pdfsig-scope-btn.active {
  background: var(--bg-card);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* Primary Action Button */
.pdfsig-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: var(--transition);
}
.pdfsig-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px var(--primary-glow);
}
.pdfsig-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Progress Bar */
.pdfsig-progress-card {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: none;
}
.pdfsig-progress-card.active {
  display: block;
}
.pdfsig-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 6px;
}
.pdfsig-progress-track {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.pdfsig-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-cyan), #10b981);
  transition: width 0.2s ease;
}

/* Results Card */
.pdfsig-results-card {
  margin-top: 20px;
  padding: 22px;
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.06);
  border-radius: var(--radius-xl);
  display: none;
}
.pdfsig-results-card.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
.pdfsig-results-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16.5px;
  font-weight: 900;
  color: #10b981;
  margin-bottom: 14px;
}
.pdfsig-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 550px) {
  .pdfsig-metrics-grid {
    grid-template-columns: 1fr;
  }
}
.pdfsig-metric-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
}
.pdfsig-metric-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}
.pdfsig-metric-value {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-heading);
}

.pdfsig-download-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: #10b981;
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
  margin-bottom: 10px;
}
.pdfsig-download-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}
.pdfsig-btn-secondary {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 750;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.pdfsig-btn-secondary:hover {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
}

/* ========================================================
   RIGHT COLUMN: LIVE INTERACTIVE PDF STAGE & OVERLAYS
   ======================================================== */
.pdfsig-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdfsig-preview-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pdfsig-preview-title {
  font-size: 14px;
  font-weight: 850;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdfsig-preview-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pdfsig-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--text-heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition);
}
.pdfsig-nav-btn:hover:not(:disabled) {
  background: var(--primary-cyan);
  color: #fff;
  border-color: var(--primary-cyan);
}
.pdfsig-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pdfsig-nav-counter {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

/* Stage & Document Wrapper */
.pdfsig-canvas-stage {
  width: 100%;
  max-width: 480px;
  min-height: 480px;
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.08);
  position: relative;
}

.pdfsig-page-wrapper {
  position: relative;
  display: inline-block;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  border-radius: 2px;
  background: #fff;
  line-height: 0;
  user-select: none;
}
.pdfsig-preview-canvas {
  display: block;
  max-width: 100%;
  max-height: 480px;
}

/* Draggable & Resizable Signature Overlay */
.pdfsig-overlay-item {
  position: absolute;
  border: 1.5px dashed var(--primary-cyan);
  background: rgba(22, 135, 245, 0.05);
  cursor: move;
  box-sizing: border-box;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.pdfsig-overlay-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Corner Resize Handle */
.pdfsig-handle-resize {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  background: var(--primary-cyan);
  border: 1.5px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 12;
}

/* Delete Button on Overlay */
.pdfsig-handle-delete {
  position: absolute;
  right: -7px;
  top: -7px;
  width: 16px;
  height: 16px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  z-index: 12;
  border: 1px solid #fff;
}
