/* ===========================================
   PDF 翻书式预览 - Flipsnack 风格
   =========================================== */

/* ---- 全屏覆盖层 ---- */
.pdf-fs-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #1a1a1a;
  z-index: 100000;
  animation: fsFadeIn 0.3s ease;
}
@keyframes fsFadeIn { from { opacity: 0; } to { opacity: 1; } }

.pdf-fs-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ---- 翻书容器 ---- */
.pdf-fs-flipbook {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 580px;
  perspective: 2500px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 85vh;
}

.pdf-fs-page {
  position: absolute;
  width: 50%;
  height: 100%;
  top: 0;
  background: #fff;
  box-shadow: 0 2px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pdf-fs-page.left {
  left: 0;
  border-radius: 4px 0 0 4px;
  transform-origin: right center;
}
.pdf-fs-page.right {
  right: 0;
  border-radius: 0 4px 4px 0;
  transform-origin: left center;
}
.pdf-fs-page canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}
.pdf-blank-page {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #ccc; font-size: 18px;
  background: #fafafa;
}

/* ---- 翻页动画器 ---- */
.pdf-fs-flipper {
  position: absolute;
  width: 50%;
  height: 100%;
  top: 0;
  left: 50%;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 10;
}
.pdf-fs-flipper.flipping-next {
  transform: rotateY(-180deg);
  z-index: 20;
  box-shadow: -5px 0 30px rgba(0,0,0,0.3);
}
.pdf-fs-flipper.flipping-prev {
  /* 与默认状态一致：rotateY(0deg)，无 z-index 提升 */
  transform: rotateY(0deg);
  z-index: 20;
}
/* prev 动作准备态：先把翻书器置于 -180deg 模拟已翻到下一页 */
.pdf-fs-flipper.flipping-prev-prep {
  transform: rotateY(-180deg);
  z-index: 20;
  transition: none !important;
}
.pdf-fs-flip-front, .pdf-fs-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pdf-fs-flip-front {
  border-radius: 0 4px 4px 0;
  transform: rotateY(0deg);
  box-shadow: inset 2px 0 15px rgba(0,0,0,0.08);
}
.pdf-fs-flip-back {
  border-radius: 4px 0 0 4px;
  transform: rotateY(180deg);
  box-shadow: inset -2px 0 15px rgba(0,0,0,0.08);
}
.pdf-fs-flipper canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* ---- 加载动画 ---- */
.pdf-fs-loading {
  color: #aaa;
  text-align: center;
  font-size: 14px;
}
.fs-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fsSpin 0.7s linear infinite;
  margin-bottom: 12px;
}
@keyframes fsSpin { to { transform: rotate(360deg); } }

/* ---- 左右箭头 ---- */
.pdf-fs-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  background: rgba(0,0,0,0.3);
  color: #fff;
  border: none;
  width: 52px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, opacity 0.5s;
  opacity: 1;
  backdrop-filter: blur(4px);
}
.pdf-fs-arrow:hover { background: rgba(0,0,0,0.55); }
.pdf-fs-arrow:disabled { opacity: 0; pointer-events: none; }
.pdf-fs-arrow.pdf-fs-prev { left: 0; border-radius: 0 6px 6px 0; }
.pdf-fs-arrow.pdf-fs-next { right: 0; border-radius: 6px 0 0 6px; }
.pdf-fs-arrow.pdf-fs-hide { opacity: 0; }

/* ---- 封页视图 ---- */
.pdf-fs-cover {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  padding: 40px 20px;
  z-index: 999;
}
.pdf-fs-cover-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 220px);
  margin-bottom: 20px;
}
.pdf-fs-cover-inner canvas {
  max-width: 100% !important;
  max-height: 100% !important;
  box-shadow: 0 10px 60px rgba(0,0,0,0.5);
  background: white;
}
.pdf-fs-cover-loading {
  color: #ccc;
  text-align: center;
  font-size: 14px;
}
.pdf-fs-cover-start {
  display: inline-flex !important;
  align-items: center;
  padding: 14px 40px;
  background: #005676;
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(0,86,118,0.4);
  transition: all 0.2s;
}
.pdf-fs-cover-start:hover {
  background: #0079a8;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,86,118,0.6);
}
.pdf-fs-cover-hint {
  color: #888;
  font-size: 13px;
  margin-top: 4px;
}

/* ---- 浮动关闭按钮 ---- */
.pdf-fs-fab-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
  font-size: 18px;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.pdf-fs-fab-close:hover {
  background: #C0392B;
  border-color: white;
}

/* ---- 点击导航区域 ---- */
.pdf-fs-click-left, .pdf-fs-click-right {
  position: absolute;
  top: 0;
  width: 25%;
  height: 100%;
  z-index: 5;
  cursor: pointer;
}
.pdf-fs-click-left { left: 0; }
.pdf-fs-click-right { right: 0; }

/* ---- 底部控制栏 ---- */
.pdf-fs-bottom {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  z-index: 60;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 1;
  transform: translateY(0);
}
.pdf-fs-bottom.pdf-fs-hide {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}
.pdf-fs-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
}

.pdf-fs-page-info {
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.pdf-fs-page-info #pdf-current-page { color: #fff; }
.pdf-sep {
  margin: 0 6px;
  opacity: 0.4;
}
.pdf-fs-page-info #pdf-total-pages { opacity: 0.6; }

.pdf-fs-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.fs-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.fs-btn:hover { background: rgba(255,255,255,0.25); }
.fs-btn.fs-close:hover { background: rgba(192, 57, 43, 0.7); }
.fs-zoom-lvl {
  min-width: 50px;
  text-align: center;
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 500;
}
.fs-divider {
  display: inline-block;
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.15);
  margin: 0 6px;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .pdf-fs-flipbook { width: 100%; height: 65vh; }
  .pdf-fs-arrow { width: 40px; height: 60px; }
  .pdf-fs-bottom-inner { padding: 0 12px; height: 48px; }
  .fs-btn { min-width: 32px; height: 32px; font-size: 13px; }
}

/* ===========================================
   PDF 库弹窗（保留原样式）
   =========================================== */
.pdf-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pdf-library-container {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.pdf-library-body {
  flex: 1;
  background: #fafafa;
  overflow-y: auto;
  padding: 24px;
}
.pdf-library-loading {
  text-align: center;
  color: #999;
  padding: 80px 20px;
}
.pdf-library-loading .spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 86, 118, 0.2);
  border-top-color: #005676;
  border-radius: 50%;
  animation: fsSpin 0.8s linear infinite;
  margin-bottom: 12px;
}
.pdf-library-empty {
  text-align: center;
  color: #999;
  font-size: 16px;
  padding: 100px 20px;
}
.pdf-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.pdf-library-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.pdf-library-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.pdf-library-cover {
  position: relative;
  height: 220px;
  background-color: #005676;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
}
.pdf-library-cover-icon { font-size: 64px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.pdf-library-info {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pdf-library-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pdf-library-desc {
  font-size: 12px;
  color: #888;
  line-height: 1.5;
  margin-bottom: 10px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pdf-library-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
  margin-top: 4px;
}
.pdf-cat-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.pdf-cat-tag.cat-brochure { background: #e3f2fd; color: #1976d2; }
.pdf-cat-tag.cat-installer { background: #fff3e0; color: #f57c00; }
.pdf-cat-tag.cat-technical { background: #e8f5e9; color: #388e3c; }
.pdf-cat-tag.cat-other { background: #f3e5f5; color: #7b1fa2; }
.pdf-view-btn { color: #005676; font-size: 12px; font-weight: 500; }

@media (max-width: 768px) {
  .pdf-library-grid { grid-template-columns: 1fr; }
  .pdf-library-cover { height: 160px; }
}
