.toolbar-container {
    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: space-between; /* 核心：左、中、右分布 */
    width: 100%;
    height: 100%;
    padding: 0 15px;
    box-sizing: border-box;
    background: #121e2b; /* 保持你的深色背景 */
    color: #fff;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    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 input {
    width: 40px;
    background: #0c1621;
    border: 1px solid #333;
    color: #fff;
    text-align: center;
    border-radius: 2px;
}

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


/* Loading 旋转动画 */
.spinner {
    animation: rotate 2s linear infinite;
}
.spinner .path {
    stroke: #76b900;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}
@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; }
}

/* 工具栏容器强制显示 */
#right-top {
    /*display: flex !important; !* 确保 renderPDF 后不被隐藏 *!*/
    background: #121e2b;
    border-bottom: 1px solid #333;
    z-index: 100;
}

/* PDF 阅读器主容器 */
.pdf-viewer-container {
    --zoom-factor: 1.0; /* 定义变量 */
    width: 100%;
    height: calc(100vh - 34px);
    overflow-y: auto; /* 必须在这里开启滚动 */
    background: #182839;
    /*padding-top: 10px;*/
    position: relative;

    /*display: flex;*/
    /*flex-direction: column;*/
    /*align-items: center; !* 关键：确保缩放时页面始终水平居中 *!*/
    /*overflow-y: auto;*/
    /*overflow-x: auto;   !* 关键：放大到超过屏幕宽时，允许横向滚动 *!*/

}


/* 页面限制逻辑 */
.pdf-page-wrapper {

    margin: 0 auto 15px auto;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    box-sizing: border-box;
    /* 核心逻辑：自动缩放且最大宽度 1000px */
    width: calc(var(--zoom-factor) * 90%) ;
    max-width: 1000px ;
    line-height: 0; /* 防止 img 标签下方的空隙 */
    font-size: 0;
    transition: width 0.2s ease; /* 可选：让缩放变平滑 */
    /*box-shadow: 0 0 10px rgba(0,0,0,0.5);*/
    /*flex-shrink: 0; !* 防止 Flex 容器压缩页面高度 *!*/
}

.svg-layer {

 width: 100% !important;
    overflow: hidden; /* 防止 SVG 内容溢出容器 */
   inset:0 !important;  /*在js中哪里加inset:5px会导致svg显示不全;*/
}

/* 处理宽高比 > 1.2 的情况 */
.pdf-page-wrapper.tall-page {

    width: auto !important;
    /* 如果高宽比很大，限制高度以适应视野，宽度随比例缩小 */

}

/* 左侧缩略图栏样式 */
#bottom-left {
    width: 0; /* 默认隐藏 */
    overflow-y: hidden;
    background: #1e2d3e;
    transition: width 0.3s ease; /* 平滑展开动画 */
}

#bottom-left.active {
    max-width: 180px; /* 展开后的宽度 */
}

/* 缩略图项样式 */
.thumb-item {
    padding: 15px;
    cursor: pointer;
    text-align: center;
    border-bottom: 1px solid #2a3b4d;
    transition: background 0.2s;
}

.thumb-item:hover { background: #2a3b4d; }
.thumb-item.current { border: 2px solid #76b900; background: #253445; }

.thumb-item img {
    width: 100%;
    height: auto;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.thumb-item span {
    display: block;
    color: #ccc;
    font-size: 12px;
    margin-top: 5px;
}

/*#pdf-toolbar仅显示在pc上;*/
@media (max-width: 767px) {
    #right-top {
        display: none !important;
    }
}

/*确保容器定位在左下角，并支持横向或纵向滚动。*/
.bottom-left-thumb {

    /* 1. 必须有明确的高度或最大高度 */
    /* 建议使用 vh (视口高度)，比如限制在屏幕高度的 60% */
    height: 100vh;

    /* 2. 关键属性：内容溢出时显示垂直滚动条 */
    overflow-y: auto;
    overflow-x: hidden;

    /* 3. 布局微调 */
    width: 160px;       /* 宽度根据你的图片大小调整 */
    padding: 10px;


    /* 4. 丝滑滚动体验 */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.thumb-item {
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.thumb-item:hover {
    border-color: #76b900;
}

.thumb-item img {

    width: 120px;
    /* 根据 PDF 常见的 4:3 或 A4 比例预设一个高度 */
    min-height: 120px;
    background: #eeeeee;
    display: block;
}

.thumb-page-num {
    font-size: 10px;
    text-align: center;
    color: #666;
    margin-top: 2px;
    width: 120px;
}

/*//为了让点击效果更明显，给 .active 类添加样式：*/

.thumb-item {
    transition: transform 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
}

.thumb-item:hover {
    transform: scale(1.02); /* 悬停微扩 */
}

/* 选中状态：使用之前提到的 NVIDIA 绿 */
.thumb-item.active {
    border-color: #76b900 !important;
    background-color: rgba(118, 185, 0, 0.05);
    box-shadow: 0 0 10px rgba(118, 185, 0, 0.3);
}

/* 确保工具栏本身是垂直居中的 */
.toolbar-container {
    display: flex;
    align-items: center; /* 关键：垂直居中 */
    justify-content: space-between;
    height: 32px; /* 建议给个固定高度 */
    background: #121e2b;
    padding: 0 15px;
}

/* 左侧按钮组 */
.toolbar-left, .nav-group {
    display: flex;
    align-items: center; /* 确保组内所有元素垂直居中 */
}

/* 页码输入框容器 */
.page-input-container {
    display: inline-flex;
    align-items: center; /* 内部 input 和 span 垂直居中 */
    margin: 0 8px;
    height: 100%; /* 跟随父级高度 */
}

/* 修复 #page-num 的样式 */
#page-num {
    width: 40px;
    height: 24px;       /* 显式设置高度 */
    line-height: 24px;  /* 保持与高度一致 */
    padding: 0;
    margin: 0;          /* 清除默认外边距 */
    text-align: center;
    background: #1d2c3d;
    color: #fff;
    border: 1px solid #3e4b5b;
    border-radius: 3px;
    font-size: 13px;
    outline: none;
    /* 移除 HTML5 数字输入框的上下箭头 (可选) */
    -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; /* 配合对齐 */
}


.text-layer-container svg {
    pointer-events: auto; /* 确保能响应鼠标手势 */
    user-select: text;    /* 开启文本选择 */
    -webkit-user-select: text;
}

/* 隐藏 SVG 中的路径或其他装饰性元素，只保留文字 */
.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;
}

.pdf-page-wrapper {
    pointer-events: auto; /* 确保包装层接收事件 */
}

.svg_content_img {
    /* 强制对齐，防止响应式造成的微小偏移 */
    aspect-ratio: auto;
    mix-blend-mode: multiply; /* 如果 SVG 是黑字白底，可以尝试让背景透明 */
}

.thumb-layer, .bg-layer, .svg-content_img {
    width: 100% !important;
    height: auto !important;
    display: block;
    pointer-events: none; /* 让点击穿透到 pdf-page-wrapper */
}

/* 处理双页显示时的样式调整*/
.pdf-viewer-container {
    overflow-x: auto; /* 允许横向滚动以适配双页 */
    display: flex;
    flex-direction: column;
    align-items: center; /* 确保单页依然居中 */
}

.pdf-page-wrapper {
    flex-shrink: 0; /* 禁止 flex 压缩页面宽度 */
    box-sizing: border-box;
}

/* 如果是双页，可能需要去掉居中，改为左对齐或者特殊的展示方式 */
.pdf-page-wrapper.double-page {
    /* 如果双页超宽，确保它从左侧开始排列 */
    align-self: flex-start;
}
