/* ROYBUZTOOLS Core Tools Stylesheet v1.0.2 */
.roybuz-tool-interactive {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  max-width: 820px;
  margin: 24px auto;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: #0f172a;
  box-sizing: border-box;
}

.roybuz-tool-interactive * {
  box-sizing: border-box;
}

.roybuz-dropzone {
  border: 2px dashed #0284c7;
  background: #f0f9ff;
  border-radius: 16px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.roybuz-dropzone:hover,
.roybuz-dropzone.dragover {
  background: #e0f2fe;
  border-color: #0369a1;
  transform: scale(0.995);
}

.roybuz-dropzone h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: #0f172a;
}

.roybuz-dropzone p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 18px;
}

.roybuz-browse-btn {
  background: #0284c7;
  color: #ffffff;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.2);
  transition: background 0.2s;
}

.roybuz-browse-btn:hover {
  background: #0369a1;
}

/* Files list */
.roybuz-files-container {
  margin-top: 18px;
}

.roybuz-files-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.files-count {
  font-weight: 700;
  color: #0f172a;
}

.files-hint {
  color: #64748b;
  font-size: 12px;
}

.roybuz-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.roybuz-file-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.roybuz-file-order {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.roybuz-file-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
}

.roybuz-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.roybuz-file-thumb.pdf-thumb {
  background: #fef2f2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
}

.roybuz-file-meta {
  min-width: 0;
}

.roybuz-file-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.roybuz-file-size {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.roybuz-file-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.roybuz-order-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.roybuz-order-btn {
  width: 28px;
  height: 22px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  color: #334155;
  padding: 0;
}

.roybuz-order-btn:hover:not(:disabled) {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
}

.roybuz-order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.roybuz-file-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}

.roybuz-file-remove:hover {
  background: #fef2f2;
}

.roybuz-add-more-btn {
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 1px dashed #94a3b8;
  background: #fff;
  border-radius: 10px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.roybuz-add-more-btn:hover {
  border-color: #0284c7;
  color: #0284c7;
  background: #f0f9ff;
}

/* Options */
.roybuz-options-card {
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
}

.options-header {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}

.roybuz-form-group {
  margin-bottom: 14px;
}

.roybuz-form-group:last-child {
  margin-bottom: 0;
}

.roybuz-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
}

.roybuz-form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #fff;
}

.roybuz-form-control:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.roybuz-presets-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.roybuz-preset-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #475569;
}

.roybuz-preset-btn.active,
.roybuz-preset-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.option-hint {
  font-size: 12px;
  color: #64748b;
  margin: 8px 0 0;
  line-height: 1.45;
}

/* Progress */
.roybuz-progress-wrapper {
  margin-top: 20px;
}

.progress-status {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
  margin-bottom: 6px;
}

.progress-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 0.2s ease;
}

/* Actions */
.roybuz-actions-row {
  margin-top: 20px;
}

.roybuz-process-btn {
  width: 100%;
  background: #0284c7;
  color: #ffffff;
  padding: 15px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 10px -2px rgba(2, 132, 199, 0.3);
  transition: background 0.2s;
}

.roybuz-process-btn:hover {
  background: #0369a1;
}

/* Result */
.roybuz-result-card {
  margin-top: 20px;
  border: 2px solid #10b981;
  background: #ffffff;
  border-radius: 16px;
  padding: 22px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.result-header h4 {
  font-size: 17px;
  font-weight: 700;
  color: #065f46;
  margin: 0;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: #f8fafc;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  margin-bottom: 14px;
}

.stat-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}

.stat-val {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.text-green { color: #10b981 !important; }
.text-blue { color: #0284c7 !important; }

.result-preview {
  margin-bottom: 16px;
  text-align: center;
}

.preview-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin: 0 0 8px;
}

.result-preview-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.roybuz-download-btn {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #10b981;
  color: #ffffff !important;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none !important;
  box-shadow: 0 4px 10px -2px rgba(16, 185, 129, 0.35);
}

.roybuz-download-btn:hover {
  background: #059669;
  color: #fff !important;
}

.roybuz-reset-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
}

.roybuz-reset-btn:hover {
  background: #e2e8f0;
}

@media (max-width: 560px) {
  .roybuz-tool-interactive { padding: 18px; }
  .roybuz-file-name { max-width: 140px; }
  .result-stats { grid-template-columns: 1fr; }
  .roybuz-file-order { display: none; }
}

/* Form row (2-col) */
.roybuz-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Signature pad */
.roybuz-signature-pad {
  width: 100%;
  max-width: 500px;
  height: 160px;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  display: block;
}
.sig-actions {
  margin-top: 8px;
}

/* Multi page downloads */
.multi-download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}
.multi-dl-link {
  display: inline-block;
  padding: 8px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  color: #0369a1;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.multi-dl-link:hover {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
}

@media (max-width: 560px) {
  .roybuz-form-row { grid-template-columns: 1fr; }
}

/* Visual crop UI */
.roybuz-crop-ui { margin-top: 4px; }
.roybuz-crop-stage-wrap {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
}
.roybuz-crop-stage {
  position: relative;
  width: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.roybuz-crop-source {
  max-width: 100%;
  max-height: 360px;
  display: block;
  margin: 0 auto;
}
.roybuz-crop-box {
  position: absolute;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
  cursor: move;
  box-sizing: border-box;
  touch-action: none;
}
.crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #38bdf8;
  border: 2px solid #fff;
  border-radius: 3px;
  box-sizing: border-box;
}
.crop-handle.tl { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-handle.tr { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-handle.bl { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-handle.br { right: -7px; bottom: -7px; cursor: nwse-resize; }
.roybuz-crop-meta {
  font-size: 12px;
  color: #64748b;
  margin: 8px 0 0;
  text-align: center;
}

/* PDF Visual Editor */
.roybuz-pdf-editor { margin-top: 4px; }
.pdf-ed-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: #1e293b;
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px 10px 0 0;
}
.pdf-ed-tool, .pdf-ed-nav {
  background: #334155;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.pdf-ed-tool.active, .pdf-ed-tool:hover, .pdf-ed-nav:hover {
  background: #0284c7;
}
.pdf-ed-sep {
  width: 1px;
  height: 18px;
  background: #475569;
  margin: 0 4px;
}
.pdf-ed-color-label, .pdf-ed-size-label, .pdf-ed-page {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pdf-ed-stage-wrap {
  background: #0f172a;
  overflow: auto;
  max-height: 70vh;
  border-radius: 0 0 10px 10px;
  padding: 12px;
  text-align: center;
}
.pdf-ed-page-wrap {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  background: #fff;
}
.pdf-ed-base, .pdf-ed-draw {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}
.pdf-ed-base { position: relative; z-index: 1; }
.pdf-ed-draw { z-index: 2; pointer-events: none; }
.pdf-ed-textlayer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  pointer-events: auto;
}
.pdf-ed-native-text, .pdf-ed-textbox {
  position: absolute;
  margin: 0;
  padding: 1px 2px;
  line-height: 1.2;
  color: #0f172a;
  background: transparent;
  border: 1px solid transparent;
  outline: none;
  white-space: pre-wrap;
  cursor: text;
  font-family: Helvetica, Arial, sans-serif;
}
.pdf-ed-native-text:hover, .pdf-ed-native-text.is-focus {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}
.pdf-ed-native-text.is-edited {
  background: rgba(254, 240, 138, 0.55);
  border-color: #f59e0b;
}
.pdf-ed-textbox {
  min-width: 80px;
  min-height: 20px;
  border: 1px dashed #0284c7;
  background: rgba(255,255,255,0.85);
  color: inherit;
  z-index: 4;
}
.pdf-ed-textbox:focus {
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(2,132,199,0.25);
}
@media (max-width: 640px) {
  .pdf-ed-toolbar { border-radius: 8px 8px 0 0; }
  .pdf-ed-stage-wrap { max-height: 55vh; }
}

/* Keep PDF editor pages at exact pixel size (no CSS scale = correct clicks) */
.pdf-ed-stage-wrap {
  overflow: auto;
}
.pdf-ed-page-wrap {
  transform: none !important;
  max-width: none !important;
}
.pdf-ed-base,
.pdf-ed-draw {
  max-width: none !important;
  height: auto !important;
}
.pdf-ed-native-text {
  overflow: hidden;
  z-index: 5;
}
.pdf-ed-textbox {
  z-index: 6;
  min-height: 18px;
  padding: 2px 4px;
}
.pdf-ed-textbox:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
}


/* Single visible text: overlays transparent until edited */
.pdf-ed-native-text {
  color: transparent;
  caret-color: #0f172a;
  background: transparent !important;
  border: 1px solid transparent;
  z-index: 5;
}
.pdf-ed-native-text:hover {
  border-color: rgba(56, 189, 248, 0.8);
  background: rgba(56, 189, 248, 0.08) !important;
}
.pdf-ed-native-text.is-focus {
  color: #0f172a !important;
  background: rgba(56, 189, 248, 0.2) !important;
  border-color: #38bdf8;
}
.pdf-ed-native-text.is-edited {
  color: #0f172a !important;
  background: rgba(254, 240, 138, 0.92) !important;
  border-color: #f59e0b;
}
.pdf-ed-native-text.is-dragging,
.pdf-ed-textbox.is-dragging {
  opacity: 0.85;
  z-index: 10;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.pdf-ed-hint-drag {
  font-size: 11px;
  color: #94a3b8;
}

.pdf-merge-preview-grid, .pdf-split-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.pdf-merge-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.pdf-merge-card.dragging { opacity: 0.6; border-color: #0284c7; }
.pdf-merge-thumb {
  height: 120px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pdf-merge-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pdf-merge-meta { padding: 8px; font-size: 11px; color: #334155; word-break: break-all; }
.pdf-split-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.pdf-split-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.pdf-split-card input { transform: scale(1.2); }
.roybuz-pdf-crop-stage-wrap {
  background: #0f172a;
  border-radius: 12px;
  overflow: auto;
  max-height: 70vh;
  padding: 12px;
}
.pdf-crop-box {
  position: absolute;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.5);
  cursor: move;
  box-sizing: border-box;
  touch-action: none;
}

.merge-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}
.merge-slot {
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
  min-height: 100px;
  text-align: center;
}
.merge-slot-label {
  font-size: 12px;
  font-weight: 800;
  color: #0284c7;
  margin-bottom: 6px;
}
.merge-slot-body {
  font-size: 12px;
  color: #64748b;
}
.merge-live-preview, .passport-sheet-preview {
  margin-top: 12px;
  text-align: center;
}
.passport-crop-ui { margin-bottom: 12px; }
