/* PDFlyHQ — tools/edit-pdf/options.css
   File card + editor toolbar + page canvas with a positioned-DOM-element
   overlay (text/rectangle/ellipse/line). Matches _Options.cshtml. JS
   contract: #file-name, #file-size, #btn-remove-file, .tool-btn[data-tool],
   #opt-color, #opt-font-size(-value), #opt-stroke-width(-value), #opt-fill,
   #btn-delete-element, #btn-prev-page, #opt-page-select, #btn-next-page,
   #editor-canvas, #editor-overlay, #btn-save, #btn-back
   (ElementManager.js / EditorCanvas.js / index.js).

   Every added element is a real positioned DOM node (.editor-el), not a
   canvas draw — left/top/width/height are px derived from ratios of the
   canvas's own rendered size, same technique as Sign PDF's signature
   placement overlay, which is what lets EditorCanvas.js drag any element
   type with one shared pointer handler. */

.options-wrap.editor-wrap { display: flex; flex-direction: column; gap: var(--space-4); }

/* ── File card (shared shape across every tool's Options step) ── */
.file-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: color-mix(in srgb, var(--color-primary-500) 6%, var(--color-surface-alt));
  border: 1px solid color-mix(in srgb, var(--color-primary-500) 18%, var(--color-border));
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.file-card__icon { flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--color-surface); border-radius: var(--radius-sm); color: var(--color-primary-600); }
.file-card__icon svg { width: 20px; height: 20px; }
.file-card__meta { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.file-card__meta #file-name { font-weight: var(--font-semibold); color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card__meta #file-size { font-size: var(--text-xs); color: var(--color-text-muted); }

#btn-remove-file {
  flex: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: color var(--duration-base) var(--ease-default), background-color var(--duration-base) var(--ease-default);
}
#btn-remove-file:hover { color: var(--color-danger-500); background: var(--color-danger-50); }
#btn-remove-file:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
#btn-remove-file svg { width: 14px; height: 14px; }

.select {
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
}
.select:focus { outline: none; border-color: var(--color-primary-500); box-shadow: var(--shadow-focus); }

/* ── Toolbar ── */
.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}

.editor-toolbar__tools { display: flex; gap: 2px; padding: 2px; background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.tool-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  transition: background-color var(--duration-base) var(--ease-default), color var(--duration-base) var(--ease-default);
}
.tool-btn svg { width: 17px; height: 17px; }
.tool-btn:hover { background: var(--color-surface-alt); color: var(--color-text); }
.tool-btn.active { background: var(--color-primary-500); color: #fff; }
.tool-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.editor-toolbar__style { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-right: auto; }

.editor-color {
  flex: none;
  width: 36px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}
.editor-color::-webkit-color-swatch-wrapper { padding: 0; }
.editor-color::-webkit-color-swatch { border: none; border-radius: 2px; }

.editor-style-control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.editor-style-control output { color: var(--color-text); font-weight: var(--font-semibold); font-variant-numeric: tabular-nums; }
.editor-style-control input[type="range"] { width: 100px; accent-color: var(--color-primary-500); }
.editor-style-control--check { gap: var(--space-1); cursor: pointer; }

#btn-delete-element:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Page navigator ── */
.editor-page-nav { display: flex; align-items: center; justify-content: center; gap: var(--space-2); }
.editor-page-nav .select { min-width: 110px; text-align: center; }

/* ── Canvas + overlay ── */
.editor-canvas-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  line-height: 0;
  background: repeating-conic-gradient(var(--color-surface-alt) 0% 25%, var(--color-surface) 0% 50%) 0 0 / 16px 16px;
}
.editor-canvas-wrap canvas { display: block; max-width: 100%; height: auto; }

.editor-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}
.editor-overlay.editor-overlay--select { cursor: default; }

.editor-el {
  position: absolute;
  box-sizing: border-box;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.editor-el:active { cursor: grabbing; }
.editor-el.selected { outline: 2px dashed var(--color-primary-500); outline-offset: 2px; }

.editor-el--text {
  min-width: 20px;
  min-height: 1em;
  padding: 2px 4px;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 700;
  line-height: 1.15;
  white-space: pre;
  outline: none;
}
.editor-el--text:focus { box-shadow: var(--shadow-focus); border-radius: 2px; }

.editor-el--rect { border-style: solid; }
.editor-el--ellipse { border-style: solid; border-radius: 50%; }
.editor-el--line { transform-origin: 0 50%; }

.editor-draw-preview {
  position: absolute;
  border: 1.5px dashed var(--color-primary-500);
  background: color-mix(in srgb, var(--color-primary-500) 8%, transparent);
  pointer-events: none;
}

.options-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.options-note svg { flex: none; width: 14px; height: 14px; margin-top: 1px; color: var(--color-text-muted); }

.options-actions { display: flex; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.options-actions .btn--primary { flex: 1; }
