/* ============================================================
   viewer.css —— 阅读器（工具栏 + 页面区）样式
   说明：视觉参数照原网页使用的 pdf.js 阅读器（Apache-2.0）还原，
        按钮为「图标 + 悬浮深色方块」，不是文字按钮。
   改颜色/高度：见【1】【2】两处的注释。
   ============================================================ */

/* ---------- 1. 工具栏整体 ---------- */
/* 想让工具栏变高/变矮，改这里的 height，同时改下面的 #toolbarViewer。 */
#toolbarContainer {
  flex: none;
  position: relative;
  height: 32px;
  z-index: 15;
  background-color: #474747;                         /* 兜底色 */
  /* 从深到浅的竖向渐变 + 一层极淡的布纹，做出原网页那种磨砂灰 */
  background-image: url(../assets/images/texture.png),
                    linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
  box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08),
              inset 0 1px 1px hsla(0,0%,0%,.15),
              inset 0 -1px 0 hsla(0,0%,100%,.05),
              0 1px 0 hsla(0,0%,0%,.15),
              0 1px 1px hsla(0,0%,0%,.1);
}

#toolbarViewer {
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 左中右三块：左靠左、右靠右、中居中 —— 与原网页相同的排法
   （原版用 float，这里改用 flex，保证任何宽度下都严格一行、垂直居中） */
#toolbarViewerLeft {
  display: flex;
  align-items: center;
  height: 32px;
  flex: none;
}
#toolbarViewerRight {
  display: flex;
  align-items: center;
  height: 32px;
  flex: none;
}
#toolbarViewerMiddle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 32px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* ---------- 2. 工具按钮（32×25 的图标方块） ---------- */
.toolbarButton {
  display: inline-block;
  width: 32px;              /* 每个图标按钮的宽度 */
  height: 25px;
  min-width: 16px;
  padding: 2px 6px 0;
  margin: 3px 1px 4px 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  color: hsla(0,0%,100%,.8);
  font-size: 12px;
  line-height: 14px;
  cursor: default;
  /* pdf.js 的老按钮不接收焦点，避免出现虚线框 */
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
/* 悬浮/按下时的深色方块（原网页就是这个反馈） */
.toolbarButton:hover,
.toolbarButton:focus {
  background-color: hsla(0,0%,0%,.2);
  box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
              0 0 1px hsla(0,0%,100%,.15) inset,
              0 0 1px hsla(0,0%,0%,.05);
  z-index: 199;
}
.toolbarButton:hover:active {
  background-color: hsla(0,0%,0%,.3);
  border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.45) hsla(0,0%,0%,.5);
}
/* 按钮里虽然写了中文，但只用于无障碍朗读；画面只显示图标 */
.toolbarButton > span {
  display: inline-block;
  width: 0;
  height: 0;
  overflow: hidden;
}
.toolbarButton[disabled] { opacity: .35; }
.toolbarButton[disabled]:hover { background: none; box-shadow: none; }

/* ---------- 3. 每个按钮对应的 16×16 图标 ---------- */
#viewFind.toolbarButton::before            { content: url(../assets/images/toolbarButton-search.png); }
#previous.toolbarButton::before            { content: url(../assets/images/toolbarButton-pageUp.png); }
#next.toolbarButton::before                { content: url(../assets/images/toolbarButton-pageDown.png); }
#zoomOut.toolbarButton::before             { content: url(../assets/images/toolbarButton-zoomOut.png); }
#zoomIn.toolbarButton::before              { content: url(../assets/images/toolbarButton-zoomIn.png); }
#presentationMode.toolbarButton::before    { content: url(../assets/images/toolbarButton-presentationMode.png); }
#print.toolbarButton::before               { content: url(../assets/images/toolbarButton-print.png); }
#secondaryToolbarToggle.toolbarButton::before { content: url(../assets/images/toolbarButton-secondaryToolbarToggle.png); }
#findPrevious.toolbarButton::before        { content: url(../assets/images/findbarButton-previous.png); }
#findNext.toolbarButton::before            { content: url(../assets/images/findbarButton-next.png); }

/* ---------- 4. 连在一起的按钮（上一页|下一页、缩小|放大） ---------- */
.splitToolbarButton {
  display: inline-block;
  margin: 3px 2px 4px 0;
}
.splitToolbarButton > .toolbarButton {
  position: relative;
  float: left;
  margin: 0;
  margin-right: -1px;
  border-radius: 0;
}
.splitToolbarButton > .toolbarButton:first-child {
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
  border-right-color: transparent;
}
.splitToolbarButton > .toolbarButton:last-child {
  margin-right: 0;
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
  border-left-color: transparent;
}
/* 中间那条 1px 竖线 */
.splitToolbarButtonSeparator {
  display: inline-block;
  float: left;
  width: 1px;
  padding: 8px 0;
  margin: 5px 0;
  background-color: hsla(0,0%,0%,.5);
  box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
  z-index: 99;
}
.splitToolbarButton:hover > .splitToolbarButtonSeparator {
  padding: 12px 0;
  margin: 1px 0;
  box-shadow: 0 0 0 1px hsla(0,0%,100%,.03);
}

/* ---------- 5. 页码输入框与「of 3」 ---------- */
.toolbarField {
  padding: 3px 6px;
  margin: 4px 0;
  border: 1px solid hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
  border-radius: 2px;
  background-color: hsla(0,0%,100%,.09);
  background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
  box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset,
              0 1px 0 hsla(0,0%,100%,.05);
  color: hsl(0,0%,95%);
  font-size: 12px;
  line-height: 14px;
  outline: none;
}
#pageNumber {
  width: 40px;
  text-align: right;          /* 原网页里数字靠右 */
  padding-right: 8px;
  /* 去掉数字输入框右侧的小箭头 */
  -moz-appearance: textfield;
}
#pageNumber::-webkit-outer-spin-button,
#pageNumber::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#pageNumber:focus { border-color: hsla(0,0%,100%,.45); }

.toolbarLabel {
  display: inline-block;
  min-width: 16px;
  padding: 3px 6px 3px 2px;
  margin: 4px 2px 4px 0;
  color: hsl(0,0%,85%);
  font-size: 12px;
  line-height: 14px;
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}

/* ---------- 6. 显示比例下拉框 ---------- */
#scaleSelectContainer {
  position: relative;
  display: inline-block;
  min-width: 16px;
  padding: 2px 18px 0 6px;
  margin: 3px 2px 4px 0;
  border: 1px solid hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
  border-radius: 2px;
  background-color: hsla(0,0%,100%,.09);
  background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
  box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset,
              0 1px 0 hsla(0,0%,100%,.05);
  color: hsl(0,0%,95%);
  font-size: 12px;
  line-height: 14px;
  cursor: default;
}
/* 右侧那对上下小箭头（原网页同一个图标） */
#scaleSelectContainer::after {
  content: url(../assets/images/toolbarButton-menuArrows.png);
  position: absolute;
  right: 4px;
  top: 6px;
}
#scaleSelect {
  -webkit-appearance: none;
  appearance: none;
  min-width: 56px;
  margin: 0;
  padding: 0 2px 4px;
  border: none;
  background: transparent;
  color: hsl(0,0%,95%);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
#scaleSelect > option { background: hsl(0,0%,24%); color: #f2f2f2; }

/* ---------- 7. 载入进度条（工具栏下沿的 4px 细条） ---------- */
#loadingBar {
  position: absolute;
  left: 0;
  right: 0;
  top: 32px;
  height: 4px;
  background-color: #333;
  border-bottom: 1px solid #333;
  z-index: 14;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
#loadingBar.show { opacity: 1; }
#loadingBar .progress {
  width: 0;
  height: 100%;
  background-color: #ddd;
  transition: width .2s;
}

/* ---------- 8. 页面显示区 ---------- */
#viewerContainer {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  background: #404040;
  -webkit-overflow-scrolling: touch;
  outline: none;
}
#viewer { padding: 10px 0 14px; }

/* 单页：白底 + 细边框 + 轻微投影，页与页之间 10px 灰缝 */
.page {
  position: relative;
  margin: 0 auto 10px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .28), 0 2px 6px rgba(0, 0, 0, .38);
  overflow: hidden;
}
.page canvas { display: block; background: #fff; }

/* 正在渲染时的小转圈（只在页面还没画出来时出现） */
.page.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid hsla(0,0%,0%,.12);
  border-top-color: hsla(0,0%,0%,.4);
  border-radius: 50%;
  animation: pv-spin .8s linear infinite;
}
@keyframes pv-spin { to { transform: rotate(360deg); } }

/* ---------- 9. 斜向水印层（可开关；PDF 自带水印时不必开） ---------- */
.wm {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  display: none;
}
.wm.on { display: block; }
.wm-inner {
  position: absolute;
  left: -60%;
  top: -60%;
  width: 220%;
  height: 220%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .55em;
  transform: rotate(-47deg);
}
.wm-row {
  white-space: nowrap;
  text-align: center;
  color: #9d9d9d;
  font-weight: 700;
  letter-spacing: .08em;
  opacity: .52;
  line-height: 1;
}

/* ---------- 10. 查找条（点放大镜后从右侧滑出） ---------- */
#findbar {
  position: absolute;
  top: 0;
  right: 0;
  height: 32px;
  padding: 0 4px;
  display: none;
  align-items: center;
  gap: 4px;
  z-index: 20;
  background-color: #474747;
  background-image: url(../assets/images/texture.png),
                    linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
  box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08), -1px 0 4px rgba(0, 0, 0, .25);
}
#findbar.open { display: flex; }
#findbar label { color: #fff; font-size: 12px; margin-right: 2px; flex: none; }
#findInput {
  width: 150px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid hsla(0,0%,0%,.45);
  border-radius: 2px;
  background: #fff;
  color: #333;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
#findInput:focus { border-color: #0a96d3; }
#findResultsCount { color: #ddd; font-size: 12px; white-space: nowrap; }
#findbar .close {
  width: 24px;
  padding: 2px 0 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  line-height: 14px;
}

/* ---------- 11. 工具菜单（点右侧 » 展开） ---------- */
#secondaryToolbar {
  position: absolute;
  top: 32px;
  right: 4px;
  min-width: 196px;
  max-height: calc(100% - 40px);
  overflow: auto;
  padding: 4px;
  display: none;
  z-index: 30;
  background-color: #474747;
  background-image: url(../assets/images/texture.png),
                    linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
  border: 1px solid hsla(0,0%,0%,.5);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
#secondaryToolbar.open { display: block; }

.secondaryToolbarButton {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: hsla(0,0%,100%,.85);
  font-size: 12px;
  font-family: inherit;
  line-height: 16px;
  text-align: left;
  cursor: pointer;
}
.secondaryToolbarButton:hover { background-color: hsla(0,0%,0%,.28); }
.secondaryToolbarButton::before { content: ""; width: 16px; height: 16px; flex: none; }
#rotateCw::before    { content: url(../assets/images/secondaryToolbarButton-rotateCw.png); }
#rotateCcw::before   { content: url(../assets/images/secondaryToolbarButton-rotateCcw.png); }
#handTool::before    { content: url(../assets/images/secondaryToolbarButton-handTool.png); }
#docInfo::before     { content: url(../assets/images/secondaryToolbarButton-documentProperties.png); }
#openFile::before    { content: url(../assets/images/toolbarButton-openFile.png); }
#downloadFile::before{ content: url(../assets/images/toolbarButton-download.png); }
#wmToggle .tick { margin-left: auto; color: #8fd3f4; font-size: 12px; }

/* ---------- 12. 响应式：与原网页相同的隐藏规则 ---------- */
/* 宽度 ≤770px  隐藏「全屏演示」
   宽度 ≤700px  隐藏「打印」
   宽度 ≤640px  隐藏「查找」，同时收起按钮预留空格
   宽度 ≤535px  隐藏「显示比例」下拉框 */
@media (max-width: 770px) { .hiddenLargeView  { display: none; } }
@media (max-width: 700px) { .hiddenMediumView { display: none; } }
@media (max-width: 640px) {
  .hiddenSmallView { display: none; }
  .toolbarButtonSpacer { width: 0; }
  #findbar label { display: none; }
  #findInput { width: 110px; }
}
@media (max-width: 535px) { #scaleSelectContainer { display: none; } }
/* 手机上输入框字号提到 16px，避免 iOS 点一下就整页放大 */
@media (max-width: 640px) {
  #pageNumber { font-size: 16px; width: 44px; height: 26px; }
  #numPages   { font-size: 14px; }
  #findInput  { font-size: 16px; height: 24px; }
}

/* ---------- 打不开时的淡字说明（config 里开关默认关闭） ---------- */
.empty-hint {
  margin: 0; padding: 60px 20px;
  text-align: center; color: #bbb;
  font-size: 13px; line-height: 1.8;
  word-break: break-all;
}
