/* Study component styles; load after the shared master styles. */
html, body { height: 100%; background: var(--pdf-stage); font-family: Arial, sans-serif; overflow: hidden; direction: rtl; }
:root { --tb-width: 50px; }
#pdfViewport { position: absolute; top: 0px; left: var(--tb-width); right: 0px; bottom: 0px; overflow: auto; display: flex; flex-direction: column; align-items: flex-start; padding: 20px 20px 40px; gap: 16px; direction: ltr; }
.pdf-page-wrapper { position: relative; background: var(--surface); box-shadow: 0 2px 12px var(--shadow-strong); display: inline-block; line-height: 0; margin-left: auto; margin-right: auto; }
.pdf-page-wrapper canvas { display: block !important; max-width: none !important; }
#snapOverlay { position: fixed; inset: 0px; z-index: 200; cursor: crosshair; background: var(--shadow-color); }
#snapOverlay .snap-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--overlay-dim); color: var(--surface); padding: 10px 20px; border-radius: 5px; font-size: 15px; pointer-events: none; white-space: nowrap; direction: rtl; }
#snapSelection { position: fixed; border: 2px solid var(--accent-primary); background: var(--accent-soft); pointer-events: none; z-index: 201; display: none; }
#snapPreview { display: none; position: fixed; inset: 0px; z-index: 300; background: var(--overlay-dim); align-items: flex-start; justify-content: center; padding-top: 60px; }
#snapPreview.visible { display: flex; }
#snapPreviewBox { max-width: 90vw; max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
#snapPreviewBox img { max-width: 100%; max-height: 60vh; border: 1px solid var(--line-subtle); object-fit: contain; }
#snapPreviewBox .preview-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#snapPreviewBox input[type="text"] { flex: 1 1 0%; min-width: 80px; padding: 6px 10px; border: 1px solid var(--control-border); border-radius: 8px; font: inherit; direction: rtl; }
#pdfLoading { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--surface); font-size: 18px; z-index: 50; }
#pdfViewport.inverted canvas { filter: invert(1); }
.pdf-page-wrapper .textLayer { position: absolute; top: 0px; left: 0px; overflow: hidden; opacity: 1; line-height: 1; pointer-events: none; mix-blend-mode: multiply; }
#pdfViewport.highlight-mode .textLayer { pointer-events: all; cursor: text; }
#pdfViewport.highlight-mode .textLayer ::selection { background: var(--accent-light); color: transparent; }
#pdfViewport.pan-mode { cursor: grab; user-select: none; }
#pdfViewport.pan-dragging { cursor: grabbing; }
/* Keep searchable glyphs invisible even when the browser highlights a match. */
.textLayer span { color: transparent; -webkit-text-fill-color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::search-text { color: transparent; background-color: rgba(255, 220, 0, 0.45); text-shadow: none; }
.textLayer ::search-text:current { background-color: rgba(255, 150, 0, 0.55); }
@media print {
html, body { background: var(--surface) !important; overflow: visible !important; }
#pdfLoading, #snapPreview { display: none !important; }
#pdfViewport { position: static !important; left: 0px !important; top: 0px !important; width: 100% !important; height: auto !important; overflow: visible !important; display: block !important; padding: 0px !important; gap: 0px !important; background: var(--surface) !important; }
.pdf-page-wrapper { break-after: page; display: block !important; width: 100% !important; height: auto !important; margin: 0px !important; padding: 0px !important; box-shadow: none !important; }
.pdf-page-wrapper canvas { display: block !important; width: 100% !important; height: auto !important; image-rendering: auto !important; }
.textLayer { display: none !important; }
}
.pdf-spread { display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 4px; width: max-content; margin-inline: auto; }
.pdf-document { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
#pdfCompanionStatus { position: fixed; bottom: 8px; inset-inline: 8px; padding: 8px; background: var(--panel-bg); color: var(--text-body); font: 14px Assistant, Arial, sans-serif; text-align: center; z-index: 60; }
