/* ==========================================================================
   ATP-004 — the page screen of a document (Components/Shared/DocumentSplitDialog.razor): a drawer over the whole
   window (.drawer--full, css/onix-drawer.css) whose body is a row of page cards — the thumbnail is the tick, the
   number and the flags ("↷ 90°", "copy") under it, the tools (↶ ↷ ⧉ 🗑) under those, a ✂ mark between every two
   cards — and whose foot is the result line with Cancel / Apply. Loaded by App.razor: the screen opens over the
   Documents list, the viewer's own page and the invoice editor alike. Theme tokens only (css/onix-theme.css, the
   motion tokens of app.css), so both themes come for free.
   ========================================================================== */

.doc-pm__body { padding: 14px 18px; }
.doc-pm__hint { font-size: 0.82rem; white-space: nowrap; }
.doc-pm__presets { display: inline-flex; gap: 6px; }
.doc-pm__note { margin: 24px auto; text-align: center; }

/* The ticked pages' tools, above the row. */
.doc-pm__selection {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 0 0 12px; padding: 6px 10px;
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel);
}
.doc-pm__selection-count { margin-right: 6px; font-weight: 600; }

/* The row of cards: a card per page, a ✂ between two. */
.doc-pm__pages { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 6px; }
.doc-pm__page {
    position: relative; margin: 0;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: 170px; padding: 8px;
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel);
    outline: none;
}
.doc-pm__page:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.doc-pm__page.is-selected { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.doc-pm__page.is-dragging { opacity: 0.5; }
.doc-pm__page[draggable="true"] .doc-pm__thumb { cursor: grab; }

/* The thumbnail is a button: a click ticks the page; a turned page shows turned, fitted into the same box. */
.doc-pm__thumb {
    display: flex; align-items: center; justify-content: center;
    width: 150px; height: 200px; padding: 0;
    border: 0; background: transparent; cursor: pointer;
}
.doc-pm__thumb img {
    max-width: 150px; max-height: 200px; width: auto; height: auto;
    border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: #fff; box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease);
}
.doc-pm__thumb img.is-rotated-90 { transform: rotate(90deg) scale(0.75); }
.doc-pm__thumb img.is-rotated-180 { transform: rotate(180deg); }
.doc-pm__thumb img.is-rotated-270 { transform: rotate(270deg) scale(0.75); }

.doc-pm__page figcaption { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.doc-pm__number { font-weight: 600; color: var(--ink); }
.doc-pm__flag { font-size: 0.7rem; }

/* The tools of a page — and of the selection. */
.doc-pm__tools { display: flex; gap: 2px; }
.doc-pm__tool {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0;
    border: 1px solid var(--line); border-radius: var(--radius-xs);
    background: var(--panel); color: var(--ink); cursor: pointer;
}
.doc-pm__tool svg { width: 16px; height: 16px; }
.doc-pm__tool:hover:not(:disabled) { border-color: var(--line-strong); background: var(--bg, var(--panel)); }
.doc-pm__tool:disabled { opacity: 0.45; cursor: default; }
.doc-pm__tool--danger:hover:not(:disabled) { color: var(--danger-strong); border-color: var(--danger); background: var(--danger-soft); }

/* The ✂ between two pages (REV-016's mark): dashed while the pages stay together, red where the document is cut. */
.doc-pm__cut {
    align-self: stretch; min-width: 26px;
    border: 1px dashed var(--line-strong); border-radius: var(--radius-xs);
    background: transparent; color: var(--muted); cursor: pointer; font-size: 1.1rem;
}
.doc-pm__cut.is-cut { border: 2px solid var(--danger); color: var(--danger-strong); background: var(--danger-soft); }

/* The foot: the result line takes the room, Cancel / Apply at the right. */
.doc-pm .drawer__foot { display: flex; align-items: center; gap: 8px; }
.doc-pm__summary { flex: 1 1 auto; min-width: 0; }
.doc-pm__error { color: var(--danger-strong); }

@media (max-width: 767.98px) {
    .doc-pm__hint { display: none; }
    .doc-pm__page { width: 140px; }
    .doc-pm__thumb { width: 120px; height: 160px; }
    .doc-pm__thumb img { max-width: 120px; max-height: 160px; }
}
