/* Self-contained colour tokens — no dependency on a global CSS variable file. */
.pdfjs-wrapper {
    --clr-canvas-bg: #E8EAF0;
    --clr-toolbar-bg: rgba(255, 255, 255, 0.88);
    --clr-toolbar-border: rgba(0, 0, 0, 0.09);
    --clr-accent-500: #49B6D6;
    --clr-accent-400: #49B6D6;
    --clr-text-secondary: #444444;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .pdfjs-wrapper {
    --clr-canvas-bg: #1a1c22;
    --clr-toolbar-bg: rgba(26, 28, 38, 0.92);
    --clr-toolbar-border: rgba(255, 255, 255, 0.07);
    --clr-accent-500: #49B6D6;
    --clr-accent-400: #49B6D6;
    --clr-text-secondary: #b0b0b0;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.40);
}

.pdfjs-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--clr-canvas-bg);
}

/* ── Zoom sidebar ─────────────────────────────────────────────────────────── */

.pdfjs-zoom-sidebar {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdfjs-zoom-sidebar button {
    width: 32px;
    height: 32px;
    background: var(--clr-accent-500);
    color: #ffffff;
    border: 1px solid var(--clr-accent-400);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

    .pdfjs-zoom-sidebar button:hover:not(:disabled) {
        background: var(--clr-accent-400);
        border-color: var(--clr-accent-400);
    }

    .pdfjs-zoom-sidebar button:disabled {
        opacity: 0.38;
        cursor: not-allowed;
    }

/* ── Canvas scroll area ───────────────────────────────────────────────────── */

.pdfjs-canvas-scroll {
    flex: 1;
    overflow: auto;
    position: relative;
    user-select: none;
    background: var(--clr-canvas-bg);
    cursor: grab;
}

    .pdfjs-canvas-scroll.panning {
        cursor: grabbing;
    }

    .pdfjs-canvas-scroll.panning .pdfjs-page {
        cursor: grabbing;
    }

.pdfjs-page {
    position: relative;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18), 0 1px 4px rgba(0, 0, 0, 0.10);
    margin: 20px auto;
    cursor: grab;
}

.pdfjs-page.place-mode {
    cursor: crosshair;
}

/* OpenSeadragon variant (OsdViewer): the tile host stays pinned to the scroll area, under the marks. It sits in
   a wrapper at least as wide as the page, because a sticky element cannot move past its parent's width. The
   host's negative bottom margin (set inline) keeps it from taking any space in the flow. */
.osd-scroll-content {
    box-sizing: border-box;
    width: max-content;
    min-width: 100%;
    padding: 0 20px;
}

.osd-tile-host {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

/* OpenSeadragon's MouseTracker sets inline pointer-events:auto on its own container and canvas, which beats the
   value inherited from the host. Without this, they sit over the page and swallow hover and click, so the
   crosshair and mark placement do not work. Only the descendants are overridden, and !important is needed
   because the OpenSeadragon value is an inline style. */
.osd-tile-host * {
    pointer-events: none !important;
}

.pdfjs-tile-layer {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.pdfjs-stale-wrap {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.pdfjs-tile {
    display: block;
}

.pdfjs-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 2;
}

.pdfjs-mark {
    cursor: pointer;
}

    .pdfjs-mark.dragging {
        cursor: grabbing;
    }

/* ── Status overlays ──────────────────────────────────────────────────────── */

.pdfjs-loading,
.pdfjs-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--clr-text-secondary);
    background: var(--clr-toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--clr-toolbar-border);
    box-shadow: var(--shadow-card);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
}

.pdfjs-error {
    color: #9A4A4A;
    background: rgba(160, 60, 60, 0.07);
    border-color: rgba(160, 60, 60, 0.18);
}

[data-theme="dark"] .pdfjs-error {
    color: #C47070;
    background: rgba(160, 60, 60, 0.10);
    border-color: rgba(160, 60, 60, 0.25);
}

.pdfjs-render-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--clr-toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--clr-toolbar-border);
    box-shadow: var(--shadow-card);
    color: var(--clr-text-secondary);
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 3;
}

.pdfjs-render-spinner {
    width: 13px;
    height: 13px;
    border: 1.5px solid rgba(125, 165, 168, 0.18);
    border-top-color: var(--clr-accent-500);
    border-radius: 50%;
    animation: pdfjs-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes pdfjs-spin {
    to {
        transform: rotate(360deg);
    }
}

/*
 * Remaps BrandSync's brand alias scale to Ajour's orange palette.
 *
 * Load ordering (tokens.css first, this file second) is enforced by
 * webpack.config.js — do not add an @import here.
 *
 * All semantic tokens that reference --bs-brand-* (primary colors, action
 * colors, focus rings, etc.) will automatically resolve to orange without
 * any further changes.
 */
:root {
    --bs-brand-50:  var(--bs-orange-50);
    --bs-brand-100: var(--bs-orange-100);
    --bs-brand-200: var(--bs-orange-200);
    --bs-brand-300: var(--bs-orange-300);
    --bs-brand-400: var(--bs-orange-400);
    --bs-brand-500: var(--bs-orange-500);
    --bs-brand-600: var(--bs-orange-600);
    --bs-brand-700: var(--bs-orange-700);
    --bs-brand-800: var(--bs-orange-800);
    --bs-brand-900: var(--bs-orange-900);
    --bs-brand-950: var(--bs-orange-950);
}

