/* ==========================================================================
   Document Converter (js/docconvert/). The section is a `.convert-page` too, so it shares the Media Converter's
   layout, cards, file rows and focus rules (css/convert.css); this file adds only what's new. Colours come from
   the brand tokens (Light / Dark / Auto).
   ========================================================================== */

/* ---- entry points ---- */
.menu-icon-docconvert { color: var(--info); }
.home-card-icon-docconvert { border-radius: var(--radius-lg); background: var(--info-soft); color: var(--info); }
.home-card-icon-docconvert svg { width: 28px; height: 28px; }
.doc-media-link { margin: 0; font-size: 13px; color: var(--muted); }

/* ---- the six cards ---- */
.doc-kinds { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1280px) { .doc-kinds { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .doc-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.doc-kind-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.doc-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.doc-badge.is-good { background: var(--success-soft); color: var(--success); }
.doc-badge.is-ok { background: var(--info-soft); color: var(--info); }
.doc-badge.is-basic { background: var(--warning-soft); color: var(--warning); }
.doc-badge.is-server { background: var(--surface-sunken); color: var(--muted); border: 1px dashed var(--border-strong); }

/* ---- drop zone, list ---- */
.doc-drop.is-server { border-style: dashed; }
.doc-server-msg { display: flex; align-items: flex-start; gap: 8px; max-width: 560px; margin: 4px auto 0; color: var(--muted); font-size: 13px; text-align: start; }
.doc-ext { color: var(--muted); }
.doc-file .conv-file-target { flex-wrap: wrap; }
.doc-engine.is-local { background: var(--success-soft); color: var(--success); border-color: transparent; }
.doc-engine.is-server { background: var(--info-soft); color: var(--info); border-color: transparent; }
.doc-engine.is-none { border-style: dashed; color: var(--muted); }
.conv-status.is-ocr .conv-status-text { color: var(--warning); font-weight: 600; }
.doc-output { display: flex; flex-direction: column; gap: 10px; }

/* ---- right panel ---- */
.doc-where button[disabled] { opacity: 0.55; cursor: not-allowed; }
.doc-soon { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12.5px; }
.doc-matrix { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-matrix th, .doc-matrix td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.doc-matrix thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.doc-matrix tbody th { font-weight: 600; white-space: nowrap; }
.doc-matrix tr.is-current { background: var(--accent-soft-bg); }
.doc-arabic-note { margin: 4px 0 0; padding: 10px 12px; border-radius: var(--radius-md, 10px); background: var(--surface-sunken); font-size: 12.5px; line-height: 1.55; }

/* ---- Options dialog (options.js) ---- */
.doc-options { width: min(1040px, 96vw); }
.doc-opt-tabs { margin: 12px 0 4px; }
.doc-opt-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; margin-top: 12px; }
.doc-opt-panel { display: grid; gap: 12px; min-width: 0; }
.doc-modes { display: grid; gap: 8px; }
.doc-mode { display: grid; gap: 4px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md, 10px); background: var(--surface, #fff); color: inherit; font: inherit; text-align: start; cursor: pointer; }
.doc-mode.is-on { border-color: var(--info); box-shadow: 0 0 0 1px var(--info) inset; background: var(--info-soft); }
.doc-mode[disabled] { cursor: not-allowed; opacity: 0.62; }
.doc-mode:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.doc-mode-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-mode-desc { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.doc-where { flex: none; padding: 2px 8px; border-radius: var(--radius-pill, 999px); font-size: 11px; font-weight: 600; white-space: nowrap; }
.doc-where.is-local { background: var(--success-soft); color: var(--success); }
.doc-where.is-server { background: var(--surface-sunken); color: var(--muted); }
.doc-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.doc-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-range { width: 9em; }
.doc-range[aria-invalid="true"] { border-color: var(--warning); }
.doc-server-note { margin: 0; padding: 10px 12px; border-radius: var(--radius-md, 10px); background: var(--surface-sunken); font-size: 13px; line-height: 1.5; }
.doc-opt-preview { min-width: 0; position: sticky; top: 0; }
.doc-opt-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.doc-opt-pic { margin: 0; display: grid; gap: 6px; min-width: 0; }
.doc-opt-pic > img, .doc-opt-pic > canvas { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.doc-opt-pic.is-checker > img { background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.doc-opt-pic figcaption { color: var(--muted); font-size: 12px; }
.doc-opt-empty { display: grid; place-items: center; aspect-ratio: 0.72; border: 1px dashed var(--border-strong); border-radius: 6px; color: var(--muted); font-size: 12.5px; text-align: center; padding: 8px; }
.doc-opt-preview-note { margin: 8px 0 0; }
.doc-opt-word, .doc-opt-doc { aspect-ratio: 0.72; overflow: hidden; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: #1d1b19; font-family: Amiri, "Noto Naskh Arabic", serif; font-size: 7px; line-height: 1.55; }
.doc-opt-word h1, .doc-opt-doc h1 { font-size: 13px; margin: 0 0 4px; }
.doc-opt-word h2, .doc-opt-doc h2 { font-size: 10.5px; margin: 6px 0 3px; }
.doc-opt-word h3, .doc-opt-doc h3 { font-size: 9px; margin: 4px 0 2px; }
.doc-opt-word p, .doc-opt-doc p { margin: 0 0 3px; }
.doc-opt-doc ul, .doc-opt-doc ol { margin: 0 0 3px; padding-inline-start: 12px; }
.doc-opt-word table, .doc-opt-doc table { width: 100%; border-collapse: collapse; margin: 3px 0; }
.doc-opt-word td, .doc-opt-doc td, .doc-opt-doc th { border: 0.5px solid #b9b1a6; padding: 1px 3px; }
.doc-opt-word-img, .doc-opt-imgph { display: inline-grid; place-items: center; min-width: 30%; min-height: 24px; margin: 3px 0; background: #eee8df; color: #7a7066; }
.doc-opt-word-note { color: #6b655e; }
@media (max-width: 760px) {
  .doc-opt-body { grid-template-columns: 1fr; }
  .doc-opt-preview { position: static; }
}

/* ---- results (results.js) ---- */
.doc-band { margin-bottom: 16px; }
.doc-result-tabs { flex-wrap: wrap; margin-bottom: 12px; }
.doc-result-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.doc-result-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.doc-chip { padding: 1px 8px; border-radius: var(--radius-pill, 999px); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.doc-chip.is-ok { background: var(--success-soft); color: var(--success); }
.doc-chip.is-warn { background: var(--warning-soft); color: var(--warning); }
.doc-result-panel { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.doc-result-main, .doc-result-side { display: grid; gap: 16px; min-width: 0; }
.doc-cmp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.doc-cmp-head .btn { min-width: 44px; min-height: 40px; font-size: 18px; }
.doc-cmp-where { font-size: 13px; }
.doc-only { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.doc-cmp-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.doc-cmp-pane { margin: 0; display: grid; gap: 6px; min-width: 0; align-content: start; }
.doc-cmp-pane figcaption { color: var(--muted); font-size: 12px; }
.doc-pagepic { position: relative; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; }
.doc-pagepic img { display: block; width: 100%; height: auto; }
.doc-pagepic.is-checker { background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.doc-mark { position: absolute; border: 2px solid #D97706; border-radius: 3px; background: rgba(217, 119, 6, 0.08); box-sizing: border-box; }
.doc-mark.is-removed { border-style: dashed; }
.doc-swatch { display: inline-block; width: 12px; height: 12px; border: 2px solid #D97706; border-radius: 2px; vertical-align: -1px; }
.doc-paper { min-height: 280px; max-height: 70vh; overflow: auto; padding: 18px 20px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: #1d1b19; font-family: Amiri, "Noto Naskh Arabic", serif; font-size: 13px; line-height: 1.7; }
.doc-paper h1 { font-size: 20px; margin: 0 0 8px; } .doc-paper h2 { font-size: 16.5px; margin: 10px 0 6px; } .doc-paper h3 { font-size: 14.5px; margin: 8px 0 4px; }
.doc-paper p { margin: 0 0 8px; }
.doc-paper img { max-width: 100%; height: auto; }
.doc-paper table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.doc-paper td, .doc-paper th { border: 1px solid #b9b1a6; padding: 3px 6px; vertical-align: top; }
.doc-paper-empty { color: #6b655e; }
.doc-report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-report-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: start; font-size: 13.5px; line-height: 1.5; }
.doc-report-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 12px; }
.doc-report-item.is-ok .doc-report-icon { background: var(--success-soft); color: var(--success); }
.doc-report-item.is-warn .doc-report-icon { background: var(--warning-soft); color: var(--warning); }
.doc-report-item.is-info .doc-report-icon { background: var(--info-soft); color: var(--info); }
.doc-report-go { white-space: nowrap; }
.doc-downloads, .doc-next { display: grid; gap: 8px; }
.doc-downloads .btn { min-height: 44px; justify-content: center; }
.doc-next-item { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md, 10px); background: var(--surface, #fff); color: inherit; font: inherit; text-align: start; cursor: pointer; }
.doc-next-item:hover { border-color: var(--border-strong); }
.doc-next-item:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.doc-next-item span { color: var(--muted); font-size: 12.5px; }
.doc-ocr-dialog { width: min(760px, 94vw); }
.doc-ocr-text { max-height: 60vh; overflow: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; font-family: Amiri, "Noto Naskh Arabic", serif; font-size: 15px; line-height: 1.8; }
.doc-ocr-text h4 { margin: 8px 0 4px; font-family: inherit; font-size: 13px; color: var(--muted); }
.doc-ocr-text mark { background: #ffe9a8; color: inherit; border-radius: 2px; }
@media (max-width: 1000px) { .doc-result-panel { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .doc-cmp-panes { grid-template-columns: 1fr; } }
