/* PDF 在线阅读器样式（/gonggao/{slug}/view） */

.viewer-body {
  margin: 0;
  background: #2b2f36;
  font-family: var(--font);
  color: #e8ecf2;
  min-height: 100vh;
}

/* ---------- 顶部工具栏 ---------- */
.viewer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 14px;
  background: rgba(20, 24, 30, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.viewer-back {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #e8ecf2;
  font-size: 20px;
  line-height: 1;
  transition: background .18s;
}
.viewer-back:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.viewer-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cfd8e3;
}

.viewer-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vtool {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #e8ecf2;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background .18s, border-color .18s;
  text-decoration: none;
}
.vtool:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .28); color: #fff; }
.vtool:active { transform: scale(.96); }
.vtool--wide { font-size: 13px; }
.vtool--dl {
  background: var(--accent);
  border-color: var(--accent);
  padding: 0 14px;
}
.vtool--dl:hover { background: #8f2c22; border-color: #8f2c22; }

.vzoom {
  min-width: 52px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #aeb9c7;
}

/* ---------- 页码条 ---------- */
.viewer-pager {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(20, 24, 30, .94);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  box-shadow: 0 8px 28px -6px rgba(0, 0, 0, .6);
}

.vpage {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #e8ecf2;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .18s;
  font-family: inherit;
}
.vpage:hover { background: rgba(255, 255, 255, .22); }

.vpage-info {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  font-size: 13px;
  color: #aeb9c7;
  font-variant-numeric: tabular-nums;
}

.vpage-input {
  width: 46px;
  height: 30px;
  padding: 0 4px;
  text-align: center;
  font-family: inherit;
  font-size: 13px;
  color: #e8ecf2;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 5px;
  -moz-appearance: textfield;
}
.vpage-input::-webkit-outer-spin-button,
.vpage-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vpage-input:focus { outline: none; border-color: var(--navy-3); }

/* ---------- 渲染区 ---------- */
.viewer-stage {
  padding: 18px 16px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 56px);
}

.viewer-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.viewer-page {
  position: relative;
  background: #fff;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, .5);
  border-radius: 2px;
  overflow: hidden;
  /* 未渲染时显示占位底色 */
  min-height: 200px;
}

.viewer-canvas {
  display: block;
  max-width: none;
}

/* ---------- 加载与错误 ---------- */
.viewer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px;
  color: #aeb9c7;
  font-size: 14px;
}

.vspinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, .16);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vspin .8s linear infinite;
}
@keyframes vspin { to { transform: rotate(360deg); } }

.viewer-error {
  max-width: 420px;
  margin: 60px auto;
  padding: 28px 26px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  text-align: center;
}
.ve-title { font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 10px; }
.ve-msg { font-size: 13.5px; color: #aeb9c7; line-height: 1.7; margin-bottom: 22px; word-break: break-word; }
.ve-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- 窄屏 ---------- */
@media (max-width: 640px) {
  .viewer-bar { height: 52px; padding: 0 8px; gap: 8px; }
  .viewer-title { font-size: 13px; }
  .viewer-tools { gap: 4px; }
  .vtool { min-width: 32px; height: 32px; padding: 0 7px; font-size: 13px; }
  .vtool--dl { padding: 0 10px; }
  .vzoom { display: none; }        /* 窄屏隐藏百分比，用适宽按钮即可 */
  .viewer-stage { padding: 10px 8px 84px; }
  .viewer-pages { gap: 10px; }
}

/* ---------- 打印 ---------- */
@media print {
  .viewer-bar, .viewer-pager, .viewer-loading, .viewer-error { display: none !important; }
  .viewer-body { background: #fff; }
  .viewer-stage { padding: 0; }
  .viewer-page { box-shadow: none; page-break-after: always; }
}
