/* ocr-tool.css – Image to Text (OCR) (loaded after /assets/css/site.css). */
.ocr { --o-line: #e2e8f0; --o-ink: #1a202c; --o-muted: #4a5568; --o-soft: #5b6b80; --o-bg: #eef2f7; --o-acc: var(--accent, #3666d1); --o-acc-soft: var(--accent-soft, #eef3fc);
       position: relative; max-width: 1240px; margin: 0 auto 2.5rem; padding: 0 12px; }
.ocr [hidden] { display: none !important; }
.ocr-start { max-width: 860px; margin: 0 auto; }
.ocr.is-loaded .ocr-start { display: none; }
.ocr-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(--o-muted); font-size: .9rem; }
.ocr-start-points li::before { content: "✓ "; color: #38a169; font-weight: 700; }
.ocr-camera { display: none; margin: .8rem auto 0; width: max-content; }
@media (hover: none) and (pointer: coarse) { .ocr-camera { display: flex; } }
.ocr-error { max-width: 860px; margin: .8rem auto 0; padding: .75rem 1rem; border: 1px solid #feb2b2; border-radius: 10px; background: #fff5f5; color: #9b2c2c; }

.ocr-work { display: none; border: 1px solid var(--o-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); }
.ocr.is-loaded .ocr-work { display: flex; }
.ocr-view { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--o-bg); }
.ocr-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--o-line); flex-wrap: wrap; }
.ocr-imgmeta { flex: 1; min-width: 120px; font-size: .82rem; color: var(--o-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr-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; }
.ocr-btn svg { width: 17px; height: 17px; }
.ocr-btn:hover { background: #f7fafc; }
.ocr-btn.is-on { background: var(--o-acc-soft); border-color: #a9bfef; color: var(--accent-dark, #2b4c94); }
.ocr-btn-icon { width: 34px; padding: 0; justify-content: center; }
.ocr-stage { position: relative; height: min(64vh, 600px); min-height: 320px; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.ocr-canvas { display: block; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .2); cursor: crosshair; touch-action: none; max-width: 100%; }
.ocr.is-busy .ocr-canvas { cursor: progress; }
.ocr-hint { margin: 0; padding: 0 12px 8px; text-align: center; font-size: .78rem; color: var(--o-soft); }
.ocr-thumbs { display: none; gap: 8px; padding: 8px 10px 10px; overflow-x: auto; background: #fff; border-top: 1px solid var(--o-line); }
.ocr.is-multi .ocr-thumbs { display: flex; }
.ocr-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; }
.ocr-thumb canvas { max-width: 100%; max-height: 100%; display: block; }
.ocr-thumb.is-cur { border-color: var(--o-acc); }
.ocr-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; }
.ocr-thumb.is-done .ocr-thumb-st { background: #38a169; } .ocr-thumb.is-working .ocr-thumb-st { background: var(--o-acc); } .ocr-thumb.is-error .ocr-thumb-st { background: #c53030; }
.ocr-thumb-x { position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px #cbd5e0; color: #4a5568; font-size: 14px; line-height: 20px; display: none; }
.ocr-thumb:hover .ocr-thumb-x { display: block; }

.ocr-panel { width: 330px; flex: none; border-left: 1px solid var(--o-line); display: flex; flex-direction: column; gap: 14px; padding: 16px; background: #fff; }
.ocr-f { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--o-muted); }
.ocr-f select { height: 40px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-weight: 500; color: var(--o-ink); }
.ocr-note { margin: -4px 0 0; font-size: .76rem; line-height: 1.45; color: var(--o-soft); font-weight: 400; }
.ocr-check { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; font-weight: 600; color: var(--o-muted); cursor: pointer; line-height: 1.35; }
.ocr-check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--o-acc); flex: none; }
.ocr-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); }
.ocr-run svg { width: 20px; height: 20px; }
.ocr-run:hover:not(:disabled) { background: var(--brand-dark, #2b4c94); }
.ocr-run:disabled { opacity: .6; cursor: progress; }
.ocr-progress { padding: 10px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--o-line); }
.ocr-progress-text { display: block; font-size: .8rem; font-weight: 600; color: var(--o-ink); margin-bottom: 6px; line-height: 1.35; }
.ocr-progress-bar { display: block; height: 6px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.ocr-progress-bar i { display: block; height: 100%; width: 0; background: var(--o-acc); transition: width .25s; }
.ocr-start .ocr-progress { max-width: 420px; margin: 1rem auto 0; }

/* output */
.ocr-out { display: none; margin-top: 18px; border: 1px solid var(--o-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); }
.ocr.has-output .ocr-out { display: block; }
.ocr-out-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--o-line); }
.ocr-out-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--o-ink); margin-right: auto; }
.ocr-seg { display: flex; border: 1px solid #cbd5e0; border-radius: 8px; overflow: hidden; }
.ocr-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(--o-muted); cursor: pointer; }
.ocr-seg button:last-child { border-right: 0; }
.ocr-seg button.is-on { background: var(--o-acc-soft); color: var(--accent-dark, #2b4c94); }
.ocr-conf { margin: 12px 14px 0; padding: 7px 10px; border-radius: 8px; font-size: .84rem; font-weight: 600; }
.ocr-conf-note { display: block; margin-top: 4px; font-weight: 400; line-height: 1.45; }
.ocr-conf.is-good { background: #f0fff4; color: #276749; } .ocr-conf.is-ok { background: #fffaf0; color: #975a16; } .ocr-conf.is-low { background: #eef3fc; color: #9b2c2c; }
.ocr-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(--o-ink); resize: vertical; white-space: pre-wrap; }
.ocr-text[dir=rtl] { font-family: "Noto Naskh Arabic", "Noto Nastaliq Urdu", "Segoe UI", Tahoma, sans-serif; font-size: 18px; line-height: 1.9; }
.ocr-text:focus { outline: none; border-color: var(--o-acc); box-shadow: 0 0 0 3px var(--o-acc-soft); }
.ocr-out-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px; }
.ocr-stats { margin-right: auto; font-size: .8rem; color: var(--o-soft); }
.ocr-primary { height: 40px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--o-acc); color: #fff; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.ocr-primary:hover { background: var(--accent-dark, #2b4c94); }
.ocr-primary svg, .ocr-out-foot .ocr-btn svg { width: 17px; height: 17px; }
.ocr-out-foot .ocr-btn { height: 40px; }
.ocr-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); }
.ocr-toast.is-warn { background: #9b2c2c; }

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