/* License: MIT (see ../license.txt); alternatively GPL v3.0. (c) 2026 ISSP Software und Service GmbH */
/* cloccojs document viewer (viewer.js): layout, toolbar and the options pane. Annotation styles live in annotation.css. */
.doc-layout{min-height:calc(100vh - 150px);grid-template-columns:minmax(0,1fr) 300px}
.viewer{display:flex;flex-direction:column;overflow:hidden;text-align:left;height:calc(100vh - 170px);min-height:680px}
.viewer-workspace{display:flex;flex:1;min-height:0}
#pdfHost{flex:1;min-width:0;min-height:0;overflow:auto;text-align:center;position:relative}
.pdf-page{position:relative;display:inline-block;margin:18px auto;line-height:0}
.viewer .pdf-page canvas{display:block;margin:0;box-shadow:0 5px 25px #0006}
.viewer embed{width:100%;height:100%;border:0}

/* toolbar: icon buttons in groups; it wraps instead of overflowing, because the document picker moved to the options pane */
.viewer .viewer-toolbar{flex:none;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:6px 4px;padding:8px 10px;background:#202936;position:relative;top:auto}
.viewer-toolbar .vt-group{display:flex;align-items:center;gap:2px;padding-right:8px;margin-right:4px;border-right:1px solid #ffffff22}
.viewer-toolbar .vt-btn{width:34px;height:34px;display:inline-grid;place-items:center;padding:0;border:0;border-radius:8px;background:transparent;color:#e6eef9;cursor:pointer;transition:background .12s}
.viewer-toolbar .vt-btn:hover:not(:disabled){background:#344457}
.viewer-toolbar .vt-btn[aria-pressed=true]{background:#3269e8;color:#fff}
.viewer-toolbar .vt-btn:disabled,.viewer-toolbar .vt-zoom:disabled,.annotation-toolbar .vt-tool:disabled{opacity:.35;cursor:default}
.viewer-toolbar .vt-zoom{min-width:54px;height:34px;padding:0 6px;border:0;border-radius:8px;background:#2b3a4d;color:#fff;font:600 12px/1 inherit;font-variant-numeric:tabular-nums;cursor:pointer}
.viewer-toolbar .vt-zoom:hover:not(:disabled){background:#344457}
.vi{width:18px;height:18px;display:block;flex:none}
#pageCount{min-width:58px;text-align:center;padding:0 4px;color:#dce7f5;font-size:12px;font-variant-numeric:tabular-nums}
.viewer-toolbar .vt-seg{gap:0;padding:0;border:1px solid #ffffff33;border-radius:8px;overflow:hidden;margin-right:10px}
.viewer-toolbar .vt-seg button{height:32px;padding:0 11px;border:0;border-radius:0;background:transparent;color:#dce7f5;font:600 12px/1 inherit;cursor:pointer}
.viewer-toolbar .vt-seg button.active{background:#3269e8;color:#fff}
.viewer-toolbar .vt-seg button:disabled{opacity:.4;cursor:default}
.viewer-toolbar .vt-group:last-of-type{border-right:0}

/* options pane */
.viewer-options label{display:block;margin:12px 0;font-size:13px}
.viewer-options input[type=checkbox]{margin-right:7px}
.viewer-options .vo-field{display:grid;gap:5px;margin:0 0 14px}
.viewer-options .vo-field>span{font-size:12px;font-weight:600;color:var(--muted)}
.viewer-options .vo-field select{width:100%;padding:8px;border:1px solid var(--line);border-radius:8px}
.viewer-options h4{margin:18px 0 6px}
#searchPanel{display:flex;gap:6px;margin:12px 0}
#searchPanel input{min-width:0;flex:1;padding:8px;border:1px solid var(--line);border-radius:7px}

/* thumbnails */
#thumbnailPane{width:125px;background:#202936;border-right:1px solid #4a5969;padding:10px;overflow:auto;flex:0 0 auto}
.thumb{width:100%;padding:6px;margin-bottom:8px;background:#fff;border:0;border-radius:4px;cursor:pointer}
.thumb canvas{display:block;width:100%;height:auto}
.viewer-workspace #thumbSplitter{width:7px;background:#415166;cursor:col-resize;flex:0 0 7px}

/* selectable text over the canvas (below the annotation layer) */
.pdf-page .textLayer{position:absolute;inset:0;overflow:clip;line-height:1;text-align:initial;transform-origin:0 0;text-size-adjust:none;forced-color-adjust:none;z-index:1;--min-font-size:1;--text-scale-factor:calc(var(--total-scale-factor,1) * var(--min-font-size));--min-font-size-inv:calc(1 / var(--min-font-size));--scale-round-x:1px;--scale-round-y:1px}
.pdf-page .textLayer :is(span,br){color:transparent;position:absolute;white-space:pre;cursor:text;transform-origin:0 0;font-size:calc(var(--text-scale-factor) * var(--font-height));transform:rotate(var(--rotate,0deg)) scaleX(var(--scale-x,1)) scale(var(--min-font-size-inv))}
.pdf-page .textLayer span.markedContent{top:0;height:0}
.pdf-page .textLayer ::selection{background:rgba(0,90,255,.3)}.pdf-page .textLayer br::selection{background:transparent}
.pdf-page .textLayer .hl{background:rgba(255,214,0,.5);border-radius:2px}
.pdf-page .annotation-layer{z-index:2}
/* in the select tool the annotation layer lets the pointer through to the text, except on the annotations themselves */
#pdfHost[data-tool=select] .annotation-layer{pointer-events:none}
#pdfHost[data-tool=select] .annotation-layer .ann{pointer-events:auto}

/* one control height in both toolbars: icon buttons are square at that height, text tools and the zoom field match it */
.viewer{--vt-h:34px}
.viewer-toolbar .vt-btn{width:var(--vt-h);height:var(--vt-h)}
.viewer-toolbar .vt-zoom{height:var(--vt-h)}
.viewer-toolbar .vt-seg button{height:calc(var(--vt-h) - 2px)}
.annotation-toolbar .vt-tool{height:var(--vt-h)}
.annotation-toolbar .vt-tool.vt-icon-only{width:var(--vt-h);padding:0;justify-content:center}
