/* Edit PDF page. Reuses /scan/scan-page.css (sc-* workspace, panel, Arrange) and /compress/compress-page.css;
   only the Edit-PDF-specific parts live here: the password box and a couple of layout tweaks. */

/* One PDF result card spans the row so Share + Download sit side by side (same as Scan to PDF). */
#epResultsList { grid-template-columns: 1fr !important; }
#epResultsList > * { max-width: 520px; width: 100%; }

/* The page panel: the selected thumbnail gets the clear blue frame like the scan pages. */
.ep-workspace [data-lovepdfi-gallery] .lp-gallery__thumbnail[aria-current="true"] { border: 3px solid #2563eb; outline: 0; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(37, 99, 235, .35); }

/* "Protect with a password" line + the password field row under it. */
.ep-protect-line { justify-content: flex-start; }
.ep-protect { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.ep-pw-row { display: flex; gap: 8px; align-items: center; }
.ep-pw-field { flex: 1 1 auto; min-width: 0; padding: 11px 12px; border: 1px solid var(--line, #e3e6ea); border-radius: 10px; font: 500 16px Roboto, system-ui, sans-serif; background: #fff; color: #1e293b; }
.ep-pw-eye { flex: 0 0 auto; min-width: 46px; }

/* Password dialog for opening a protected PDF. */
.ep-pw-dialog { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line, #e3e6ea); border-radius: 16px; padding: 0; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
.ep-pw-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.ep-pw-form { padding: 18px 18px 16px; margin: 0; display: grid; gap: 10px; }
.ep-pw-title { margin: 0; font: 700 18px Roboto, system-ui, sans-serif; color: #10233f; }
.ep-pw-name { margin: 0; font-size: 13.5px; color: #65708a; word-break: break-all; }
.ep-pw-inputrow { display: flex; gap: 8px; }
.ep-pw-inputrow input { flex: 1 1 auto; min-width: 0; padding: 11px 12px; border: 1px solid var(--line, #e3e6ea); border-radius: 10px; font: 500 16px Roboto, system-ui, sans-serif; }
.ep-pw-actions { display: flex; gap: 8px; margin-top: 4px; }
.ep-pw-actions .page-btn { flex: 1 1 0; min-height: 44px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ep-pw-field,
  :root:not([data-theme="light"]) .ep-pw-inputrow input { background: #0f172a; color: #e8edf6; border-color: #27324a; }
  :root:not([data-theme="light"]) .ep-pw-dialog { background: #0f172a; color: #e8edf6; border-color: #27324a; }
  :root:not([data-theme="light"]) .ep-pw-title { color: #e8edf6; }
}

/* ======================= Phase B: annotations (Text / Draw / Highlight / White-out / Date) ======================= */
/* Annotate buttons under the gallery (one line, wrap on tiny screens is fine) */
.ep-annotate-line { flex-wrap: wrap; gap: 6px; }
.ep-an-btn { flex: 1 1 auto; min-width: 0; white-space: nowrap; }

/* Read-only overlay drawn over the big preview so edits stay visible after Done */
.ep-overlay { position: absolute; pointer-events: none; overflow: hidden; z-index: 2; }
.ep-overlay[hidden] { display: none; }
.ep-an { position: absolute; }
.ep-an-text { white-space: pre; line-height: 1.25; transform-origin: top left; }
.ep-an-box { border-radius: 1px; }
svg.ep-an-draw { overflow: visible; }

/* ---- Full window editor ---- */
.ep-fw { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #0b0f14; color: #fff; overflow: hidden; }
.ep-fw[open] { display: flex; flex-direction: column; }
.ep-fw::backdrop { background: #0b0f14; }
.ep-fw-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); flex: 0 0 auto; }
.ep-fw-title { font: 600 15px Roboto, system-ui, sans-serif; }
.ep-fw-nav { display: inline-flex; align-items: center; gap: 10px; }
.ep-fw-count { font: 500 14px Roboto, system-ui, sans-serif; min-width: 54px; text-align: center; }
.sc-fw-arrow { min-width: 44px; }
.ep-fw-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 6px; touch-action: none; }
.ep-fw-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.5); -webkit-user-drag: none; user-select: none; }
.ep-fw-layer { position: absolute; touch-action: none; }
.ep-fw-layer .ep-an { cursor: move; }
.ep-fw-layer .ep-an-text { padding: 1px 2px; outline: 1px dashed rgba(120,140,170,.55); min-width: 10px; min-height: 1em; }
.ep-fw-layer .ep-an-text.ep-editing { outline: 2px solid #3b82f6; cursor: text; background: rgba(255,255,255,.06); }
.ep-fw-layer .ep-an-sel { outline-color: #3b82f6 !important; }
.ep-fw-loading { position: absolute; color: #cbd5e1; font: 500 14px Roboto, system-ui, sans-serif; }
/* selection frame + handles */
.ep-frame { position: absolute; border: 1.5px solid #3b82f6; pointer-events: none; z-index: 5; }
.ep-handle { position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: #2563eb; color: #fff; font: 700 14px/1 Arial, sans-serif; display: grid; place-items: center; pointer-events: auto; cursor: pointer; touch-action: none; }
.ep-handle-size { right: -15px; bottom: -15px; cursor: nwse-resize; }
.ep-handle-del { left: -15px; top: -15px; background: #e53935; }
.ep-handle-rot { left: 50%; top: -34px; transform: translateX(-50%); background: #0f172a; }
.ep-draft { pointer-events: none; }
/* toolbars */
.ep-fw-tools, .ep-fw-style, .ep-fw-actions { display: flex; align-items: center; gap: 6px; padding: 6px 8px; flex: 0 0 auto; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ep-fw-tools { border-top: 1px solid rgba(255,255,255,.08); }
.ep-fw-actions { padding-bottom: max(8px, env(safe-area-inset-bottom)); justify-content: center; }
.ep-fw .sc-fw-btn { white-space: nowrap; }
.ep-fw .sc-fw-btn[aria-pressed="true"] { background: #2563eb; border-color: #2563eb; color: #fff; }
.ep-swatches { display: inline-flex; gap: 5px; align-items: center; }
.ep-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.65); padding: 0; cursor: pointer; }
.ep-swatch[aria-pressed="true"] { outline: 2px solid #fff; outline-offset: 1px; }
.ep-fw-bold { font-weight: 800; min-width: 40px; }
.ep-fw-font { background: #11161d; color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: 8px 6px; font: 500 14px Roboto, system-ui, sans-serif; min-height: 40px; }
.ep-fw-size { display: inline-flex; align-items: center; gap: 6px; font: 500 13px Roboto, system-ui, sans-serif; white-space: nowrap; }
.ep-fw-size[hidden] { display: none; }
.ep-fw-size input[type="range"] { width: 120px; }
.ep-fw-del { color: #fecaca; border-color: rgba(248,113,113,.5); }
@media (max-width: 400px) { .ep-fw .sc-fw-btn { padding: 9px 7px; font-size: 13px; } .ep-fw-font { font-size: 13px; } .ep-fw-size input[type="range"] { width: 88px; } }

/* Update 52: text is typed in a toolbar box, then placed by tapping the page (reliable mobile keyboard) */
.ep-fw-textbar { display: flex; padding: 6px 8px 0; flex: 0 0 auto; }
.ep-fw-textbar[hidden] { display: none; }
.ep-fw-textinput { flex: 1 1 auto; min-width: 0; padding: 11px 12px; border: 1px solid #2f6bf0; border-radius: 10px; background: #0f172a; color: #fff; font: 500 16px Roboto, system-ui, sans-serif; }
.ep-fw-textinput::placeholder { color: #93a4bf; }
.ep-fw-textinput:focus { outline: 2px solid #3b82f6; outline-offset: 1px; }

/* Update 55: an empty text box shows a clear placeholder on the page so it's never "invisible" */
.ep-fw-layer .ep-an-text:empty::before { content: "Type in the box below ↓"; color: #64748b; font-style: italic; }
.ep-fw-layer .ep-an-text { min-width: 24px; }

/* Multi-line text + Blank page: the text box is a textarea (Enter = new line), with ＋ New text and 📄 Blank page beside it */
.ep-fw-textbar { flex-wrap: wrap; gap: 6px; align-items: flex-start; }
textarea.ep-fw-textinput { resize: none; line-height: 1.35; min-height: 44px; max-height: 132px; overflow-y: auto; }
.ep-fw-textbtns { display: flex; gap: 6px; flex: 0 0 auto; }
.ep-fw-textbtns .sc-fw-btn { white-space: nowrap; }
.ep-fw-textnote { flex: 1 0 100%; margin: 0; color: #fcd34d; font-size: 12.5px; line-height: 1.35; }
.ep-fw-textnote[hidden] { display: none; }
@media (max-width: 560px) { .ep-fw-textbtns { flex: 1 0 100%; } .ep-fw-textbtns .sc-fw-btn { flex: 1 1 0; } }
.ep-handle-width { right: -15px; top: 50%; transform: translateY(-50%); background: #0ea5e9; cursor: ew-resize; }
.ep-an-text { box-sizing: content-box; }
.ep-an-text .ep-line { display: block; white-space: pre; transform-origin: 0 0; min-height: 1.25em; }
@media (max-width: 560px) { textarea.ep-fw-textinput { max-height: 96px; } }
