/*  pdf-suite/css/view.css
 *  View-specific additions on top of viewer.css / layout.css / toolbar.css.
 *  No inline styles — every toggle is class-based so the page stays CSP-safe.
 */

.view-file-kind {
    display: inline-flex;
    align-items: center;

    padding: 6px 10px;

    border-radius: 999px;
    border: 1px solid var(--border);

    background: var(--panel-light);
    color: var(--muted);

    font-size: .82rem;
    line-height: 1;

    text-transform: uppercase;
    letter-spacing: .04em;
}

.view-file-kind:empty {
    display: none;
}

/* ── Image viewer page card.  Mirrors the .page look used by pdf.js
 * so a single-image preview sits inside the same chrome as a PDF page.
 * ──────────────────────────────────────────────────────────── */
.image-page {
    position: relative;

    background: white;

    box-shadow: var(--shadow);

    padding: 0;
}

.image-page img,
.image-page svg {
    display: block;

    max-width: 100%;

    /* Image scale is applied via inline width-percentage on the host
     * element, controlled by the zoom buttons.  The browser handles
     * proportional scaling. */
    width: 100%;
    height: auto;
}

#viewer.viewer-image {
    /* Constrain very wide images so they don't blow out the workspace. */
    padding: 16px 0;
}

#viewer.viewer-image .image-page {
    width: min(100%, 920px);
}

/* ── 3D viewer surface.  Three.js paints to a <canvas> inside this
 * wrapper; we size the wrapper to fill the available viewer area
 * so the canvas can claim the same space the PDF pages would.
 * ──────────────────────────────────────────────────────────── */
#viewer.viewer-three {
    /* Override the column layout used by the PDF flow so the 3D
     * surface can fill the available space without gaps. */
    display: block;
    padding: 0;
    gap: 0;

    width: 100%;

    /* Sticky-height surface — keeps the workspace from collapsing
     * to canvas content size when the user is rotating. */
    min-height: 70vh;
}

.three-surface {
    position: relative;

    width: 100%;
    height: 100%;
    min-height: 70vh;

    background:
        radial-gradient(
            circle at 30% 20%,
            rgba(59, 130, 246, .12),
            transparent 55%
        ),
        var(--panel);

    border-radius: 6px;
    overflow: hidden;

    /* Pointer-events stay on so OrbitControls receive drags. */
    touch-action: none;
}

.three-surface canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.three-hud {
    position: absolute;
    left: 12px;
    bottom: 10px;

    pointer-events: none;

    padding: 6px 10px;

    border-radius: 6px;

    background: rgba(11, 18, 32, .6);
    color: var(--text-dim);

    font-size: .78rem;
    line-height: 1.35;

    backdrop-filter: blur(4px);
}

/* ── Sidebar info panel — file metadata, vertex / face counts etc. ── */
.view-info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;

    padding: 4px 0;

    color: var(--text);
    font-size: .9rem;
}

.view-info-row span:first-child {
    color: var(--muted);
}

.view-info-row span:last-child {
    text-align: right;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    max-width: 60%;
}

/* ── Error pane shown when a file can't be opened (corrupted PDF,
 * unsupported variant, missing GLTFLoader add-on, etc.).
 * ──────────────────────────────────────────────────────────── */
.view-error {
    margin: 24px auto;
    max-width: 540px;

    padding: 18px;

    border: 1px solid var(--accent);
    border-radius: 10px;

    background: rgba(59, 130, 246, .06);
    color: var(--text);

    line-height: 1.5;
}

.view-error h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.view-error code {
    padding: 1px 5px;

    border-radius: 4px;

    background: var(--panel-light);
    color: var(--text);

    font-size: .85em;
}

/* ── Drop-zone highlight reuses #viewerContainer.drag-active from
 * layout.css.  Nothing extra needed here.
 * ──────────────────────────────────────────────────────────── */
