/* ── Viewer wrapper ─────────────────────────────────────────────────────── */
#pdf-viewer-wrapper {
    display: flex;
    height: 75vh;
    min-height: 480px;
    border: 1px solid #ccc;
    background: #e8e8e8;
    font-family: Arial, sans-serif;
    border-radius: 3px;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#pdf-sidebar {
    width: 140px;
    min-width: 140px;
    background: #e0e0e0;
    border-right: 1px solid #ccc;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
    flex-shrink: 0;
}

#pdf-sidebar.collapsed { width: 0; min-width: 0; }

#thumbnail-list {
    overflow-y: auto;
    height: 100%;
    padding: 10px 6px;
    box-sizing: border-box;
}

.pdf-thumb {
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 2px;
    overflow: hidden;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: border-color 0.15s;
}

.pdf-thumb:hover  { border-color: #4466aa; }
.pdf-thumb.active { border-color: #000033; }

.pdf-thumb canvas { display: block; width: 100%; height: auto; min-height: 0; }

.pdf-thumb-label {
    text-align: center;
    font-size: 10px;
    color: #666;
    padding: 2px 0;
    background: #f0f0f0;
}

/* ── Main area ───────────────────────────────────────────────────────────── */
#pdf-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
#pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    flex-shrink: 0;
}

.tool-btn {
    padding: 4px 10px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.tool-btn:hover { background: #000033; color: white; border-color: #000033; }

.toolbar-sep {
    width: 1px;
    height: 18px;
    background: #ccc;
    margin: 0 2px;
    flex-shrink: 0;
}

.pdf-zoom-label {
    font-size: 12px;
    color: #555;
    min-width: 38px;
    text-align: center;
}

.pdf-page-indicator {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    padding: 0 4px;
}

/* ── Scroll container ────────────────────────────────────────────────────── */
#pdf-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    background: #777;
    padding: 20px 16px;
    box-sizing: border-box;
    position: relative;
}

#pdf-pages-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.pdf-page-wrap {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    border-radius: 1px;
    line-height: 0;
    flex-shrink: 0;
}

.pdf-page-canvas { display: block; }

/* ── Spinner (shown while loading, inside scroll area) ───────────────────── */
.pdf-spinner-wrap {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

.pdf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pdf-spin 0.75s linear infinite;
}

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

/* ── Fullscreen ──────────────────────────────────────────────────────────── */
#pdf-viewer-wrapper.fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border: none;
    border-radius: 0;
}

body.pdf-fullscreen-active { overflow: hidden; }

#pdf-viewer-wrapper.fullscreen #pdf-sidebar     { background: #1c1c1c; border-right-color: #444; }
#pdf-viewer-wrapper.fullscreen #pdf-toolbar     { background: #1c1c1c; border-bottom-color: #444; }
#pdf-viewer-wrapper.fullscreen .tool-btn        { background: rgba(255,255,255,0.12); color: #ddd; border-color: #555; }
#pdf-viewer-wrapper.fullscreen .tool-btn:hover  { background: #000033; color: white; border-color: #000033; }
#pdf-viewer-wrapper.fullscreen .pdf-zoom-label,
#pdf-viewer-wrapper.fullscreen .pdf-page-indicator { color: #aaa; }
#pdf-viewer-wrapper.fullscreen .toolbar-sep     { background: #555; }
#pdf-viewer-wrapper.fullscreen #pdf-scroll-container { background: #333; }
#pdf-viewer-wrapper.fullscreen .pdf-thumb-label { background: #222; color: #999; }
