/* PDF查看器样式 */
.pdf-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pdf-viewer-container {
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(10px);
  border-radius: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  border: none;
  animation: fadeIn 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pdf-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  border-bottom: 1px solid rgba(14, 165, 233, 0.2);
  background: rgba(15, 23, 42, 0.95);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.pdf-viewer-header h3 {
  color: #ffffff;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(14, 165, 233, 0.5);
}

.pdf-viewer-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
  font-weight: 300;
}

.pdf-viewer-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  transform: rotate(90deg);
}

.pdf-viewer-content {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  position: relative;
  padding-top: 70px; /* 为header留出空间 */
  padding-bottom: 70px; /* 为controls留出空间 */
}

.pdf-loading {
  color: #cbd5e1;
  text-align: center;
  padding: 40px;
  font-size: 1.1rem;
}

#pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: none;
  border-radius: 0;
  background: white;
  display: block;
  object-fit: contain;
}

.pdf-viewer-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 15px 30px;
  border-top: 1px solid rgba(14, 165, 233, 0.2);
  background: rgba(15, 23, 42, 0.95);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

/* 修改：在触摸设备上显示按钮，桌面设备也显示（移除隐藏） */
.pdf-viewer-controls .pdf-btn {
  display: inline-flex; /* 改为显示按钮 */
  align-items: center;
  justify-content: center;
  min-width: 100px; /* 确保按钮足够大，方便点击 */
  min-height: 44px; /* iOS推荐的最小触摸目标尺寸 */
}

.pdf-btn {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  border: none;
  padding: 12px 24px; /* 增加内边距，按钮更大 */
  border-radius: 6px;
  font-size: 1rem; /* 稍微增大字体 */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
  -webkit-tap-highlight-color: rgba(6, 182, 212, 0.3); /* iOS点击高亮 */
  touch-action: manipulation; /* 优化触摸响应 */
}

.pdf-btn:hover:not(:disabled),
.pdf-btn:active:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.6);
  filter: brightness(1.1);
}

.pdf-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdf-page-info {
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

/* 响应式设计 - 移动设备/iPad优化 */
@media (max-width: 768px) {
  .pdf-viewer-container {
    width: 95%;
    max-height: 95vh;
  }
  
  .pdf-viewer-header {
    padding: 15px 20px;
  }
  
  .pdf-viewer-header h3 {
    font-size: 1.1rem;
  }
  
  .pdf-viewer-content {
    padding: 15px;
    padding-top: 80px; /* 增加顶部空间 */
    padding-bottom: 100px; /* 增加底部空间，确保按钮可见 */
  }
  
  .pdf-viewer-controls {
    padding: 20px; /* 增加内边距 */
    flex-wrap: wrap;
    gap: 20px; /* 增加按钮间距 */
    min-height: 80px; /* 确保控制栏有足够高度 */
  }
  
  .pdf-viewer-controls .pdf-btn {
    display: inline-flex; /* 确保在移动设备上显示 */
    flex: 1; /* 让按钮平均分配空间 */
    min-width: 120px; /* 移动设备上按钮更大 */
    min-height: 50px; /* 更大的触摸目标 */
    font-size: 1rem;
  }
  
  .pdf-page-info {
    width: 100%;
    order: -1;
    font-size: 1rem; /* 稍微增大页码字体 */
    margin-bottom: 10px;
  }
}

/* iPad专用样式（横屏和竖屏） */
@media (min-width: 768px) and (max-width: 1024px) {
  .pdf-viewer-controls .pdf-btn {
    min-width: 140px;
    min-height: 50px;
    font-size: 1.1rem;
    padding: 14px 28px;
  }
  
  .pdf-viewer-controls {
    padding: 20px 30px;
    gap: 30px;
  }
}

/* 触摸设备检测（使用CSS媒体查询） */
@media (hover: none) and (pointer: coarse) {
  /* 这是触摸设备（包括iPad） */
  .pdf-viewer-controls .pdf-btn {
    display: inline-flex !important; /* 强制显示 */
    min-width: 120px;
    min-height: 48px;
    font-size: 1.1rem;
  }
}

