/* Styles for the pdf drawer (js/tools/pdf.js). Uses the tokens in style.css. */
.pdf-drop .pdf-sample { align-self: center; }

/* Page grid (organiser, picture list) */
.pdf-grid-wrap:has(.pdf-grid:empty) { display: none; }
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pdf-grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pdf-grid:empty { display: none; }
.pdf-page {
  display: flex; flex-direction: column; gap: 8px; padding: 10px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  cursor: grab;
}
.pdf-page.dragging { opacity: .4; }
.pdf-page.over { border-color: var(--g, var(--accent)); box-shadow: 0 0 0 2px var(--g-pdf); }
.pdf-thumb {
  aspect-ratio: 1; display: grid; place-items: center; overflow: hidden;
  background: var(--bg-2); border-radius: 8px;
}
.pdf-thumb img { max-width: 86%; max-height: 86%; object-fit: contain; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); transition: transform .2s; background: #fff; }
.pdf-page-label { font-size: .82rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-page-label strong { color: var(--ink); font-size: .95rem; }
.pdf-page-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.pdf-page-btns .btn.small.icon-btn { width: 34px; min-height: 34px; padding: 0; }

/* Results and previews */
.pdf-result { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.pdf-result[hidden] { display: none; }
.pdf-result-info { margin: 0; font-size: .95rem; color: var(--ink-2); word-break: break-word; }
.pdf-previews { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.pdf-previews:empty { display: none; }
.pdf-fig { margin: 0; display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.pdf-fig figcaption { font-size: .82rem; color: var(--ink-3); }
.pdf-previews .pdf-sheet { width: auto; height: auto; max-width: min(100%, 460px); max-height: 320px; }
.pdf-sheet { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }

/* Rotate & crop stage */
.pdf-pager-label { flex: 1 1 auto; text-align: center; align-self: center; font-weight: 600; color: var(--ink-2); }
.pdf-stage-inner { position: relative; align-self: center; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; max-width: 100%; }
.pdf-stage .pdf-sheet { max-width: 100%; }
.pdf-cropbox {
  position: absolute; border: 2px dashed var(--g-pdf); pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(20, 14, 10, .45);
}
.pdf-stage-inner { overflow: hidden; border-radius: 4px; }
.pdf-margins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Preflight */
.pdf-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pdf-check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.pdf-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.pdf-check.good .pdf-mark { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.pdf-check.warn .pdf-mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.pdf-check.bad .pdf-mark { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.table td.pdf-ok { color: var(--good); }
.table td.pdf-warn { color: var(--accent); }
.table td.pdf-bad { color: var(--bad); font-weight: 700; }
.stat.good strong { color: var(--good); }

@media (max-width: 520px) {
  .pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pdf-page { padding: 8px; }
  .pdf-page-btns .btn.small.icon-btn { width: 30px; min-height: 32px; }
  .pdf-previews .pdf-sheet { max-width: 100%; }
}
