/* pdf-editor.css — editor de elementos usado por editar/anotar/assinar/redigir
   PDF e pelas ferramentas de seleção de página (recortar, excluir, extrair,
   preencher formulário). Não mexe em .tool-panel/.tool-drop-zone — só define
   a área de trabalho interna, que precisa de mais largura que os 1000px
   padrão para caber as páginas em tamanho legível. */

.pdf-editor-panel { max-width: 1200px; }

.pdf-editor { width: 100%; }

.pdf-editor-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--space-sm, 8px);
  align-items: center; margin-bottom: var(--space-md, 16px);
  position: sticky; top: 0; z-index: 5;
  background: var(--color-bg, #fff); padding: 8px 0;
}

.pdf-editor-tool-btn {
  border: 1px solid var(--color-border, #ddd); background: var(--color-surface, #fff);
  color: var(--color-text, #222); border-radius: 8px; padding: 6px 12px;
  font-size: .85rem; cursor: pointer;
}
.pdf-editor-tool-btn.active { border-color: var(--brand-primary, #248AF6); background: var(--brand-primary, #248AF6); color: #fff; }

.pdf-editor-color { width: 34px; height: 30px; border: 1px solid var(--color-border, #ddd); border-radius: 6px; padding: 2px; background: none; cursor: pointer; }
.pdf-editor-size { width: 60px; border: 1px solid var(--color-border, #ddd); border-radius: 6px; padding: 4px 6px; }

/* Quando a barra de ferramentas é renderizada na sidebar do workspace (ver
   opts.toolbarContainer em pdfElementEditor.js) em vez de sobre o canvas —
   vira uma coluna em vez de uma fileira, e não precisa mais ser sticky
   (a própria sidebar já é sticky). */
.tool-workspace-sidebar .pdf-editor-toolbar {
  flex-direction: column;
  align-items: stretch;
  position: static;
  margin-bottom: 0;
  padding: 0;
  background: none;
}
.tool-workspace-sidebar .pdf-editor-tool-btn { text-align: left; }
.tool-workspace-sidebar .pdf-editor-color,
.tool-workspace-sidebar .pdf-editor-size { width: 100%; box-sizing: border-box; }

.pdf-editor-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }

.pdf-editor-page { position: relative; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.pdf-editor-canvas { display: block; }

.pdf-editor-overlay { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }

.pdf-editor-el { cursor: move; user-select: none; }
.pdf-editor-el-text { white-space: nowrap; padding: 2px; font-family: Helvetica, Arial, sans-serif; }
.pdf-editor-el-image img { width: 100%; height: 100%; display: block; pointer-events: none; }
.pdf-editor-el-rect { box-sizing: border-box; }

.pdf-editor-el-del {
  position: absolute; top: -10px; right: -10px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: #e02424; color: #fff;
  font-size: 11px; line-height: 20px; cursor: pointer; display: none;
}
.pdf-editor-el:hover .pdf-editor-el-del { display: block; }

.pdf-editor-resize-handle {
  position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px;
  background: var(--brand-primary, #248AF6); border: 2px solid #fff; border-radius: 50%;
  cursor: nwse-resize;
}

.pdf-editor-pen-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Grade de seleção de páginas (excluir / extrair páginas, campos de formulário) */
.pdf-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; width: 100%; }
.pdf-page-grid-item { position: relative; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; }
.pdf-page-grid-item img, .pdf-page-grid-item canvas { display: block; width: 100%; }
.pdf-page-grid-item.selected { border-color: var(--brand-primary, #248AF6); }
.pdf-page-grid-item .pdf-page-num { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .7rem; padding: 1px 6px; border-radius: 4px; }
.pdf-page-grid-item .pdf-page-check {
  position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: 2px solid var(--color-border, #ccc);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff;
}
.pdf-page-grid-item.selected .pdf-page-check { background: var(--brand-primary, #248AF6); border-color: var(--brand-primary, #248AF6); }
