/**
 * Workspace layout CSS: thumbnails on the left, document in the middle,
 * options on the right — everything visible without scrolling between steps.
 */

/* ── Workspace shell ─────────────────────────────────────────────────────── */
.ws {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 340px;
  gap: 0;
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--n-100);
  height: min(78vh, 880px);
  min-height: 420px;
}
.ws__rail {
  background: var(--n-050);
  border-right: 1px solid var(--n-200);
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ws__main { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--n-150); }
.ws__bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--white); border-bottom: 1px solid var(--n-200); flex: none;
}
.ws__bar .sep { width: 1px; height: 22px; background: var(--n-200); }
.ws__view {
  flex: 1; overflow: auto; padding: 22px; display: flex;
  align-items: flex-start; justify-content: center;
}
.ws__page { transform-origin: top left; flex: none; }
.ws__panel {
  background: var(--white);
  border-left: 1px solid var(--n-200);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ws__panel h3 { font-size: .95rem; margin: 0; }
.ws__panel .field { font-size: .84rem; }
.ws__panel .options-grid { grid-template-columns: 1fr; gap: 14px; }
.ws__hint { font-size: .78rem; color: var(--n-500); line-height: 1.5; }

/* ── Thumbnails ──────────────────────────────────────────────────────────── */
.ws__rail .thumb {
  padding: 4px; cursor: pointer; border: 2px solid transparent;
  border-radius: var(--r-xs); background: var(--white); box-shadow: var(--sh-1);
}
.ws__rail .thumb canvas, .ws__rail .thumb img {
  display: block; width: 100%; height: auto; border-radius: 4px; background: #fff;
}
.ws__rail .thumb__n {
  top: 6px; left: 6px; font-size: .66rem; padding: 1px 7px; border-radius: var(--r-pill);
  background: rgba(11,16,32,.82); color: #fff; z-index: 2;
}
.ws__rail .thumb.is-sel { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.18); }

/* Pages that already carry a mark (redaction) get a clear flag */
.ws__rail .thumb--flagged::after {
  content: "";
  position: absolute; inset: 4px; border-radius: 4px;
  outline: 2px solid var(--err); outline-offset: 2px; pointer-events: none;
}
.ws__rail .thumb { position: relative; }
.ws__rail .thumb--flagged .thumb__n { background: var(--err); }

/* ── Page in the middle ──────────────────────────────────────────────────── */
.ws__page {
  position: relative; background: #fff; box-shadow: var(--sh-2);
  line-height: 0; max-width: 100%;
}
.ws__page canvas { display: block; max-width: 100%; height: auto; }
.ws__layer { position: absolute; inset: 0; cursor: crosshair; }

/* Placed items (signature, watermark, image tags…) */
.ws-item {
  position: absolute; border: 1.5px solid transparent; cursor: move;
  touch-action: none; user-select: none;
}
.ws-item img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ws-item.is-sel { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.2); }
.ws-item__del {
  position: absolute; top: -10px; right: -10px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--err); color: #fff; border: 2px solid #fff;
  display: none; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.ws-item__grip {
  position: absolute; right: -8px; bottom: -8px; width: 18px; height: 18px;
  background: var(--brand-500); border: 2px solid #fff; border-radius: 4px;
  cursor: nwse-resize; display: none;
}
.ws-item.is-sel .ws-item__del, .ws-item.is-sel .ws-item__grip { display: flex; }

/* ── Signature/choice tiles in the panel ─────────────────────────────────── */
.ws-choice {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--n-200); border-radius: var(--r-sm); background: var(--white);
  cursor: pointer; text-align: left; width: 100%; font: inherit;
}
.ws-choice:hover { border-color: var(--n-300); background: var(--n-050); }
.ws-choice.is-active { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.ws-choice__ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--brand-050); color: var(--brand-600); }
.ws-choice strong { display: block; font-size: .9rem; }
.ws-choice span { font-size: .78rem; color: var(--n-500); }

.ws-empty {
  border: 1px dashed var(--n-300); border-radius: var(--r-sm); padding: 18px;
  text-align: center; font-size: .84rem; color: var(--n-500); background: var(--n-050);
}
.ws-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ws-list li {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 8px 10px; border: 1px solid var(--n-200); border-radius: var(--r-xs); font-size: .82rem;
}

/* ── Responsive: stack the panels on small screens ───────────────────────── */
@media (max-width: 1024px) {
  .ws { grid-template-columns: 1fr; height: auto; }
  .ws__rail {
    flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0;
    border-bottom: 1px solid var(--n-200); padding: 10px;
  }
  .ws__rail .thumb { flex: none; width: 96px; }
  .ws__panel { border-left: 0; border-top: 1px solid var(--n-200); }
  .ws__view { padding: 14px; min-height: 320px; }
  .ws__page { max-width: 100%; }
}
