/* ============================================================
 *  PDFCore 阅读器样式表（合并整理版）
 *  - 消除重复选择器
 *  - 确保移动端手势不被 CSS 阻止
 *  - touch-action: none 集中管理
 * ============================================================ */

/* ========== 骨架屏加载动画 ========== */
@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== Loading 旋转动画 ========== */
@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0%   { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50%  { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

.spinner {
    animation: rotate 2s linear infinite;
}

.spinner .path {
    stroke: #76b900;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

/* ========== 链接注释层动画 ========== */
@keyframes link-hint {
    0%   { background-color: rgba(0, 123, 255, 0); }
    50%  { background-color: rgba(0, 123, 255, 0.2); }
    100% { background-color: rgba(0, 123, 255, 0); }
}

/* ============================================================
 *  工具栏
 * ============================================================ */

#right-top {
    background: #121e2b;
    border-bottom: 1px solid #333;
    z-index: 100;
}

.toolbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 32px;
    padding: 0 15px;
    box-sizing: border-box;
    background: #121e2b;
    color: #fff;
}

.toolbar-left,
.toolbar-center,
.toolbar-right,
.nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 工具栏按钮 */
.tool-btn {
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: all 0.2s;
}

.tool-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 页码输入框 */
.page-input-container {
    display: inline-flex;
    align-items: center;
    margin: 0 8px;
    height: 100%;
}

.page-input-container input {
    width: 40px;
    background: #0c1621;
    border: 1px solid #333;
    color: #fff;
    text-align: center;
    border-radius: 2px;
}

#page-num {
    width: 40px;
    height: 24px;
    line-height: 24px;
    padding: 0;
    margin: 0;
    text-align: center;
    background: #000;
    color: #fff;
    border: 1px solid #3e4b5b;
    border-radius: 3px;
    font-size: 13px;
    outline: none;
    -moz-appearance: textfield;
}

#page-num::-webkit-inner-spin-button,
#page-num::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.page-total {
    color: #ccc;
    font-size: 13px;
    margin-left: 6px;
    display: inline-block;
}

/* 缩放下拉框 */
#scale-select {
    background: #0c1621;
    color: #fff;
    border: 1px solid #333;
    padding: 2px 5px;
    outline: none;
}

/* ============================================================
 *  #bottom-right 主容器
 * ============================================================ */

#bottom-right {
    position: relative;
    overflow: hidden;       /* 必须 hidden，用 translate 代替 scroll */
    width: 100%;
    height: 100%;
}

/* ============================================================
 *  PDF 阅读器容器
 * ============================================================ */

.pdf-viewer-container {
    display: block;                         /* 严禁 flex，配合内部 translate 居中 */
    position: relative;
    overflow: hidden;                       /* 关闭原生滚动，由 JS transform 控制 */
    width: 100%;
    height: calc(100vh - 34px);             /* 减去工具栏高度 */
    background: #182839;

    /* 手势控制：交给 JS 处理所有触摸 */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;

    /* 禁止选中和拖拽 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* ============================================================
 *  PDF 画布（承载所有页面）
 * ============================================================ */

.pdf-canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;                         /* 严禁 flex 或 margin:auto */
    margin: 0;
    transform-origin: 0 0;                  /* 必须锁定左上角，否则 JS 偏移计算会乱 */
    will-change: transform;                 /* 硬件加速 */
    pointer-events: auto;
}

/* ============================================================
 *  页面占位符
 * ============================================================ */

.page-placeholder {
    position: relative;
    overflow: hidden;
    background: #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;

    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* ============================================================
 *  图层：缩略图 / 背景 / SVG / 内容
 * ============================================================ */

/* 缩略图层 */
.thumb-layer {
    width: 100% !important;
    height: 100% !important;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    filter: blur(4px);                      /* 模糊处理，切换高清时视觉更自然 */
    transition: opacity 0.5s ease-out;
}

/* 高清内容容器（初始透明，加载完成后淡入） */
.content-layers {
    opacity: 0;
    transition: opacity 0.5s ease-in;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* 背景层 */
.bg-layer {
    width: 100% !important;
    height: 100% !important;
    display: block;
    pointer-events: none;                   /* 事件穿透到容器 */
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* SVG 文字层 */
.svg-layer {
    width: 100% !important;
    height: 100% !important;
    display: block;
    overflow: hidden;                       /* 防止 SVG 内容溢出 */
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    inset: 0 !important;
}

/* SVG 内容图片 */
.svg_content_img {
    aspect-ratio: auto;
    mix-blend-mode: multiply;
}

/* ============================================================
 *  注释层（链接/目录跳转）
 * ============================================================ */

.anno-item:hover {
    animation: link-hint 1.5s infinite ease-in-out;
    border-radius: 2px;
}

/* ============================================================
 *  文字选择层
 * ============================================================ */

.text-layer-container svg {
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

.text-layer-container path,
.text-layer-container rect {
    pointer-events: none;
}

.text-layer-container text::selection {
    background: rgba(0, 102, 255, 0.25);
    fill: transparent;
}

.text-layer span.highlight {
    background-color: rgba(255, 255, 0, 0.4);
    color: transparent;
}

/* ============================================================
 *  左侧缩略图栏
 * ============================================================ */

#bottom-left {
    width: 140px;
    max-width: 360px;
    min-width: 140px;
    overflow-y: hidden;
    background: #121e2b;
    position: relative;     /* ★ 必须，handle 用 absolute 定位依赖此 */
    flex-shrink: 0;         /* ★ 若父容器是 flex，防止被压缩 */
}

#bottom-left.active {
    max-width: 360px;
}

/* 拖动调整宽度的手柄 */
#bottom-left-resize-handle {
    position: absolute;
    top: 0;
    right: -2px;
    width: 4px;
    height: 100%;
    cursor: ew-resize;
    z-index: 200;
    background: #2a3b4d;
}

#bottom-left-resize-handle:hover,
#bottom-left-resize-handle.dragging {
    background: #333;
}

.bottom-left-thumb {
    height: calc(100vh - 55px);
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    padding: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* 缩略图列表 - 支持多列布局 */
#thumb-list-render {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

/* 缩略图项 */
.thumb-item {
    width: calc(100% - 4px);  /* 单列时占满宽度 */
    padding: 6px;
    margin-bottom: 0;
    cursor: pointer;
    text-align: center;
    border: none;
    border-radius: 0;
    background: transparent;
    transition: none;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* 多列布局时的缩略图宽度 */
#bottom-left[data-cols="2"] .thumb-item {
    width: calc(50% - 6px);
}

#bottom-left[data-cols="3"] .thumb-item {
    width: calc(33.33% - 6px);
}

/* 缩略图内部容器 */
.thumb-item .thumb-inner {
    display: inline-block;
}

/* 图片容器 - hover/current 样式仅作用于图片 */
.thumb-item img {
    display: block;
    width: auto;
    max-width: 100px;
    height: auto;
    background: #eeeeee;
    border: 2px solid transparent;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.thumb-item:hover img {
    border-color: #5a6a7a;
}

.thumb-item.current img {
    border-color: var(--theme-color, #76b900);
    box-shadow: 0 0 8px color-mix(in srgb, var(--theme-color, #76b900) 40%, transparent);
}

.thumb-item.active img {
    border-color: var(--theme-color, #76b900);
    box-shadow: 0 0 8px color-mix(in srgb, var(--theme-color, #76b900) 40%, transparent);
}

.thumb-item span {
    display: block;
    color: #888;
    font-size: 11px;
    margin-top: 6px;
}

.thumb-item.current span,
.thumb-item.active span {
    color: var(--theme-color, #76b900);
}

/* .thumb-page-num 已废弃，使用 .thumb-item span 替代 */

/* ============================================================
 *  响应式：移动端
 * ============================================================ */

@media (max-width: 767px) {
    /* 隐藏 PC 工具栏 */
    #right-top {
        display: none !important;
    }

    /* 移动端全屏，无工具栏 */
    .pdf-viewer-container {
        height: 100vh;
        height: 100dvh;                     /* 动态视口高度，适配移动端地址栏 */
    }

    /* 移动端缩略图栏窄一点 */
    .bottom-left-thumb {
        width: 120px;
        height: 100vh;
        height: 100dvh;
    }

    .thumb-item img {
        width: 90px;
        min-height: 90px;
    }

}

.outline-name,.outline-page{color:#fff}
.tool-btn.active-tab{background:#000 }

.outline-item:hover{background:#2a3b4d}
#outline-container {
    overflow-y: auto;
    height: 100%;     /* 或具体高度，否则内容撑开容器不会出滚动条 */
}

#outline-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s;
}

#outline-resize-handle:hover,
#outline-resize-handle:active {
    background: rgba(255, 255, 255, 0.15);
}
#outline-resize-handle {
    cursor: ew-resize;  /* ↔ 左右双向箭头，比 col-resize 更直观 */
}

#outline-container {
    position: relative;  /* 确保 CSS 层面也有，不只靠 JS */
}

#outline-resize-handle {
    position: absolute;
    right: -4px;
    top: 0;
    width: 8px;
    height: 100%;
    min-height: 100%;
    cursor: ew-resize;
    z-index: 10;
}

