/*
 * Minimal PDF.js viewer CSS — covers the page canvas, text layer (selection),
 * and our citation highlights. If you want the upstream's full styling
 * (annotations, find-bar, thumbnails, dark mode), drop pdf_viewer.min.css
 * from pdfjs-dist into wwwroot/pdfjs/ and link it after this file.
 */

#viewerContainer {
    position: absolute;
    inset: 0;
    overflow: auto;
    background: #525659;
    direction: ltr;          /* viewer container itself is LTR for PDF.js */
}

.pdfViewer { padding: 16px 0; }

.pdfViewer .page {
    direction: ltr;
    margin: 0 auto 20px;
    border: 1px solid #2a2a2a;
    background-color: #fff;
    background-clip: content-box;
    position: relative;
    overflow: visible;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    box-sizing: content-box;
}

.pdfViewer .canvasWrapper {
    overflow: hidden;
    position: relative;
    width: 100%; height: 100%;
}
.pdfViewer .canvasWrapper canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---------- text layer (selectable text overlay above the canvas) ---------- */
.pdfViewer .textLayer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    line-height: 1.0;
    text-align: initial;
    user-select: text;
    forced-color-adjust: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    transform-origin: 0 0;
    z-index: 2;
}
.pdfViewer .textLayer span,
.pdfViewer .textLayer br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
.pdfViewer .textLayer ::selection { background: rgba(0,0,255,0.3); }

/* Citation pill highlight applied to text-layer divs.
   Low alpha so the underlying PDF text stays legible through the green wash. */
.pdfViewer .textLayer .highlight {
    background-color: rgba(0, 100, 0, 0.3);
    border-radius: 2px;
    padding: 1px 0;
    margin: -1px 0;
}
.pdfViewer .textLayer .highlight.selected { background-color: rgba(0, 100, 0, 0.45); }

/* Search highlights. The find controller marks PART of a text-layer line by wrapping
   the match in <span class="highlight appended"> INSIDE that line. Upstream's CSS keeps
   such spans in the text flow (position: initial); without that rule the generic
   ".textLayer span { position: absolute }" above pulled each match to the corner of
   its line box — the green box landed on the wrong words, one word or more away in
   RTL lines. Citation highlights were unaffected: they mark whole lines.
   (Rules below as in pdf.js 4.2 pdf_viewer.css.) */
.pdfViewer .textLayer .highlight.appended { position: initial; }
.pdfViewer .textLayer .highlight.begin  { border-radius: 4px 0 0 4px; }
.pdfViewer .textLayer .highlight.end    { border-radius: 0 4px 4px 0; }
.pdfViewer .textLayer .highlight.middle { border-radius: 0; }
.pdfViewer .textLayer span.markedContent { top: 0; height: 0; }

/* ---------- per-paragraph rectangle (used by highlightArea) ---------- */
.lizzyHighlightArea {
    position: absolute;
    background-color: rgba(0, 100, 0, 0.3);
    pointer-events: none;
    z-index: 3;
}

/* ---------- toolbar shown after a citation jump ---------- */
.lizzyHighlightToolbar {
    pointer-events: auto;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);

    position: absolute;
    z-index: 1000;
    display: flex;
    gap: 5px;
    background-color: #ffffff;
    border: 1px solid #E7E7E7;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
}

.lizzyToolbarButton {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: none;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lizzyToolbarButton svg { transition: all 0.2s ease; }

/* The pdf.js page sets explicit pixel sizes on its inner divs, expecting
   content-box. Forcing it here keeps page geometry from going off when
   the surrounding app uses border-box globally. */
.pdfViewer *,
.pdfViewer ::before,
.pdfViewer ::after { box-sizing: content-box; }
