/* PDFlyHQ — tools/sign-pdf/options.css
   File card + two-phase signature UI (create → place). Matches
   _Options.cshtml. JS contract: see the comment at the top of that file.

   Caveat (OFL-licensed, self-hosted at /fonts/caveat-600.woff2 — Coding
   Rules §10: self-hosted assets only, the site's CSP is font-src 'self'
   so a CDN font would be silently blocked) is scoped to this file since
   only the Type-signature tab uses it. */

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/caveat-600.woff2') format('woff2');
}

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

/* ── 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; }

.options-group__label { display: block; font-size: var(--text-xs); font-weight: var(--font-semibold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin-bottom: var(--space-3); }

.sign-phase { display: flex; flex-direction: column; gap: var(--space-4); }
.sign-phase.hidden { display: none; }

/* ── Signature source tabs — segmented control, same visual language as
   Compress PDF's .level-selector but a plain row instead of a 3-col grid. ── */
.sig-tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--color-border); }
.sig-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-base) var(--ease-default), border-color var(--duration-base) var(--ease-default);
}
.sig-tab:hover { color: var(--color-text-secondary); }
.sig-tab.active { color: var(--color-primary-600); border-color: var(--color-primary-500); }
:root[data-theme="dark"] .sig-tab.active { color: var(--color-primary-400); }

.sig-panel.hidden { display: none; }

/* ── Draw tab ── */
.sig-canvas {
  display: block;
  width: 100%;
  height: 200px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--color-surface-alt) 0 0) padding-box,
    var(--color-surface);
  cursor: crosshair;
  touch-action: none;
  margin-bottom: var(--space-3);
}

/* ── Type tab ── */
.sig-type-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-md);
  margin-bottom: var(--space-4);
  transition: border-color var(--duration-base) var(--ease-default), box-shadow var(--duration-base) var(--ease-default);
}
.sig-type-input:focus { outline: none; border-color: var(--color-primary-500); box-shadow: var(--shadow-focus); }

.sig-type-preview {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 48px;
  line-height: 1;
  color: var(--color-text);
  word-break: break-word;
  text-align: center;
}

/* ── Upload tab ── */
.sig-upload-preview {
  display: block;
  max-width: 100%;
  max-height: 140px;
  margin-top: var(--space-4);
  padding: var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background:
    repeating-conic-gradient(var(--color-surface-alt) 0% 25%, var(--color-surface) 0% 50%) 0 0 / 16px 16px;
}

.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; }

/* ── Phase 2: placement controls ── */
.place-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}
.place-page-picker,
.place-size-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
}
.place-size-picker { flex: 1; min-width: 140px; }
.place-size-picker input[type="range"] { flex: 1; accent-color: var(--color-primary-500); }

.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); }

/* ── Page preview + draggable signature overlay ── */
.place-preview-wrap {
  position: relative;
  max-width: 100%;
  width: fit-content;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  line-height: 0;
}
.place-preview-wrap canvas { display: block; max-width: 100%; height: auto; }

.place-sig-overlay {
  position: absolute;
  cursor: grab;
  touch-action: none;
  border: 1px dashed transparent;
  transition: border-color var(--duration-fast) var(--ease-default);
}
.place-sig-overlay:hover,
.place-sig-overlay.dragging {
  border-color: var(--color-primary-400);
}
.place-sig-overlay.dragging { cursor: grabbing; }
.place-sig-overlay img { display: block; width: 100%; height: 100%; pointer-events: none; }
