/* pdf-ocr.css – PDF to Text OCR (loaded after /assets/css/site.css). */
.po { --p-line: #e2e8f0; --p-ink: #1a202c; --p-muted: #4a5568; --p-soft: #5b6b80; --p-bg: #eef2f7; --p-acc: var(--accent, #3666d1); --p-acc-soft: var(--accent-soft, #eef3fc);
       position: relative; max-width: 1240px; margin: 0 auto 2.5rem; padding: 0 12px; }
.po [hidden] { display: none !important; }
.po-start { max-width: 860px; margin: 0 auto; }
.po.is-loaded .po-start { display: none; }
.po-start-points { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; margin: .9rem 0 0; padding: 0; list-style: none; color: var(--p-muted); font-size: .9rem; }
.po-start-points li::before { content: "✓ "; color: #38a169; font-weight: 700; }
.po-error { max-width: 860px; margin: .8rem auto 0; padding: .75rem 1rem; border: 1px solid #feb2b2; border-radius: 10px; background: #fff5f5; color: #9b2c2c; }

.po-work { display: none; border: 1px solid var(--p-line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 8px 30px rgba(15, 23, 42, .08); scroll-margin-top: calc(var(--header-h, 64px) + 12px); }
.po.is-loaded .po-work { display: flex; }
.po-view { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--p-bg); }
.po-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--p-line); flex-wrap: wrap; }
.po-meta { flex: 1; min-width: 120px; font-size: .82rem; color: var(--p-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-size: .82rem; font-weight: 600; color: #2d3748; cursor: pointer; white-space: nowrap; }
.po-btn svg { width: 17px; height: 17px; }
.po-btn:hover { background: #f7fafc; }
.po-btn.is-on { background: var(--p-acc-soft); border-color: #a9bfef; color: var(--accent-dark, #2b4c94); }
.po-btn-icon { width: 34px; padding: 0; justify-content: center; }
.po-stage { position: relative; height: min(64vh, 600px); min-height: 320px; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.po-canvas { display: block; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .2); cursor: crosshair; touch-action: none; max-width: 100%; }
.po.is-busy .po-canvas { cursor: progress; }
.po-hint { margin: 0; padding: 0 12px 8px; text-align: center; font-size: .78rem; color: var(--p-soft); }
.po-thumbs { display: none; gap: 8px; padding: 8px 10px 10px; overflow-x: auto; background: #fff; border-top: 1px solid var(--p-line); }
.po.is-multi .po-thumbs { display: flex; }
.po-thumb { position: relative; flex: none; width: 76px; height: 76px; padding: 4px; border: 2px solid transparent; border-radius: 9px; background: #f1f5f9; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.po-thumb canvas { max-width: 100%; max-height: 100%; display: block; }
.po-thumb.is-cur { border-color: var(--p-acc); }
.po-thumb-st { position: absolute; left: 3px; bottom: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #4a5568; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; }
.po-thumb.is-done .po-thumb-st { background: #38a169; } .po-thumb.is-working .po-thumb-st { background: var(--p-acc); } .po-thumb.is-error .po-thumb-st { background: #c53030; }

.po-panel { width: 330px; flex: none; border-left: 1px solid var(--p-line); display: flex; flex-direction: column; gap: 14px; padding: 16px; background: #fff; }
.po-f { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--p-muted); }
.po-f select { height: 40px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-weight: 500; color: var(--p-ink); }
.po-note { margin: -4px 0 0; font-size: .76rem; line-height: 1.45; color: var(--p-soft); font-weight: 400; }
.po-check { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; font-weight: 600; color: var(--p-muted); cursor: pointer; line-height: 1.35; }
.po-check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--p-acc); flex: none; }
.po-run { margin-top: auto; height: 52px; border: 0; border-radius: 10px; background: var(--brand, #3666d1); color: #fff; font: inherit; font-weight: 700; font-size: 1.02rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 14px rgba(54, 102, 209, .25); }
.po-run svg { width: 20px; height: 20px; }
.po-run:hover:not(:disabled) { background: var(--brand-dark, #2b4c94); }
.po-run:disabled { opacity: .6; cursor: progress; }
.po-progress { padding: 10px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--p-line); }
.po-progress-text { display: block; font-size: .8rem; font-weight: 600; color: var(--p-ink); margin-bottom: 6px; line-height: 1.35; }
.po-progress-bar { display: block; height: 6px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.po-progress-bar i { display: block; height: 100%; width: 0; background: var(--p-acc); transition: width .25s; }
.po-start .po-progress { max-width: 420px; margin: 1rem auto 0; }

/* output */
.po-out { display: none; margin-top: 18px; border: 1px solid var(--p-line); border-radius: 14px; background: #fff; box-shadow: 0 8px 30px rgba(15, 23, 42, .06); overflow: hidden; scroll-margin-top: calc(var(--header-h, 64px) + 12px); }
.po.has-output .po-out { display: block; }
.po-out-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--p-line); }
.po-out-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--p-ink); margin-right: auto; }
.po-seg { display: flex; border: 1px solid #cbd5e0; border-radius: 8px; overflow: hidden; }
.po-seg button { height: 32px; padding: 0 10px; border: 0; border-right: 1px solid #e2e8f0; background: #fff; font: inherit; font-size: .8rem; font-weight: 600; color: var(--p-muted); cursor: pointer; }
.po-seg button:last-child { border-right: 0; }
.po-seg button.is-on { background: var(--p-acc-soft); color: var(--accent-dark, #2b4c94); }
.po-conf { margin: 12px 14px 0; padding: 7px 10px; border-radius: 8px; font-size: .84rem; font-weight: 600; }
.po-conf-note { display: block; margin-top: 4px; font-weight: 400; line-height: 1.45; }
.po-conf.is-good { background: #f0fff4; color: #276749; } .po-conf.is-ok { background: #fffaf0; color: #975a16; } .po-conf.is-low { background: #eef3fc; color: #9b2c2c; }
.po-text { display: block; width: calc(100% - 28px); margin: 12px 14px; min-height: 260px; padding: 12px 14px; box-sizing: border-box; border: 1px solid #cbd5e0; border-radius: 10px; font: 15px/1.6 ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace; color: var(--p-ink); resize: vertical; white-space: pre-wrap; }
.po-text[dir=rtl] { font-family: "Noto Naskh Arabic", "Noto Nastaliq Urdu", "Segoe UI", Tahoma, sans-serif; font-size: 18px; line-height: 1.9; }
.po-text:focus { outline: none; border-color: var(--p-acc); box-shadow: 0 0 0 3px var(--p-acc-soft); }
.po-out-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px; }
.po-stats { margin-right: auto; font-size: .8rem; color: var(--p-soft); }
.po-primary { height: 40px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--p-acc); color: #fff; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.po-primary:hover { background: var(--accent-dark, #2b4c94); }
.po-primary svg, .po-out-foot .po-btn svg { width: 17px; height: 17px; }
.po-out-foot .po-btn { height: 40px; }
.po-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3100; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: #1a202c; color: #fff; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.po-toast.is-warn { background: #9b2c2c; }

/* PDF-specific */
.po-start .po-progress { max-width: 420px; margin: 1rem auto 0; }
.po-pass { max-width: 460px; margin: 1rem auto 0; padding: 14px 16px; border: 1px solid #fbd38d; border-radius: 12px; background: #fffaf0; }
.po-pass-msg { margin: 0 0 10px; font-size: .9rem; color: #744210; }
.po-pass-row { display: flex; gap: 8px; }
.po-pass-row input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #cbd5e0; border-radius: 9px; font: inherit; }
.po-pageno { font-size: .84rem; font-weight: 600; color: var(--p-ink); min-width: 92px; text-align: center; white-space: nowrap; }
.po-btn:disabled { opacity: .45; cursor: default; }
.po-stage { outline: none; }
.po-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--p-acc); }
.po-canvas { cursor: default; }
.po-badge { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; background: #4a5568; box-shadow: 0 2px 8px rgba(15, 23, 42, .25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-badge.is-text { background: #2b4c94; } .po-badge.is-good { background: #2f855a; } .po-badge.is-ok { background: #c05621; } .po-badge.is-low { background: #c53030; } .po-badge.is-empty { background: #718096; }
.po-thumbs { display: none; }
.po.is-multi .po-thumbs { display: flex; }
.po-thumb { width: 64px; height: 84px; flex-direction: column; padding: 3px; }
.po-thumb-img { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; border-radius: 4px; }
.po-thumb-img canvas { max-width: 100%; max-height: 100%; display: block; }
.po-thumb-n { font-size: .68rem; font-weight: 700; color: var(--p-muted); line-height: 1.3; }
.po-thumb-st { left: auto; right: 3px; top: 3px; bottom: auto; min-width: 16px; height: 16px; line-height: 16px; font-size: .62rem; text-align: center; }
.po-thumb-st:empty { display: none; }
.po-thumb.is-text .po-thumb-st { background: #2b4c94; } .po-thumb.is-low .po-thumb-st { background: #dd6b20; }
.po-f input[type=text] { height: 40px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 8px; font: inherit; font-weight: 500; color: var(--p-ink); }
.po-run.is-stop { background: #4a5568; box-shadow: none; }
.po-run.is-stop:hover { background: #2d3748 !important; }
.po-conf { line-height: 1.5; }
.po-error a { color: inherit; font-weight: 700; }

@media (max-width: 900px) {
    .po { padding: 0; }
    .po-work { flex-direction: column; border-radius: 0; border-left: 0; border-right: 0; }
    .po-stage { height: 50vh; min-height: 260px; }
    .po-panel { width: auto; border-left: 0; border-top: 1px solid var(--p-line); }
    .po-out { border-radius: 0; border-left: 0; border-right: 0; }
    .po-btn .po-lbl { display: none; }
    .po-meta { flex-basis: 100%; }
    .po-pageno { min-width: 0; flex: 1; }
    .po-out-foot .po-btn .po-lbl { display: inline; }
}
