/**
 * 证书详情页面样式
 * 参考 design-prototypes/certificate-detail.html 设计稿
 */

/* ===== 页面容器 ===== */
.certificate-detail-page {
  background: #F5F5F7;
  min-height: 100vh;
  padding-top: 116px; /* 避开顶部导航栏(56px) + 二级导航(60px) */
}

/* ===== 主内容区域 ===== */
.site-main {
  padding-top: 0; /* 重置默认的 padding */
}

/* ===== 证书头部 ===== */
.certificate-header {
  background: white;
  padding: 24px 20px;
  border-bottom: 1px solid #F5F5F7;
}

.certificate-header-inner {
  max-width: 800px;
  margin: 0 auto;
}

.certificate-number {
  font-size: 13px;
  color: #6E6E73;
  margin-bottom: 8px;
}

.certificate-title {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  margin-bottom: 12px;
  color: #1D1D1F;
}

.certificate-status-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.certificate-status-badge.status-valid {
  background: #E8F5E9;
  color: #2E7D32;
}

.certificate-status-badge.status-expired {
  background: #F5F5F5;
  color: #9E9E9E;
}

.certificate-status-badge.status-pending {
  background: #FFF3E0;
  color: #FF9800;
}

/* ===== 内容容器 ===== */
.certificate-detail-page .content-container {
  max-width: 800px !important;
  margin: 0 auto !important;
  padding: 20px 16px 100px !important;
  width: 100%;
}

/* ===== 内容卡片 ===== */
.certificate-detail-page .content-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  width: 100%;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1D1D1F;
}

/* ===== 信息网格 ===== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.info-row {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  border-bottom: 1px solid #F5F5F7;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: #6E6E73;
  margin-bottom: 4px;
}

.info-value {
  font-size: 15px;
  font-weight: 500;
  color: #1D1D1F;
  word-break: break-word;
}

/* ===== 表格样式 ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.test-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.test-table th,
.test-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #F5F5F7;
}

.test-table th {
  font-size: 13px;
  font-weight: 600;
  color: #6E6E73;
  background: #F9FAFB;
  white-space: nowrap;
}

.test-table td {
  color: #1D1D1F;
}

.test-table tr:last-child td {
  border-bottom: none;
}

.test-table .result-pass {
  color: #2E7D32;
  font-weight: 600;
}

.test-table .result-fail {
  color: #DC2626;
  font-weight: 600;
}

/* ===== 检测结论 ===== */
.conclusion-box {
  background: #F9FAFB;
  border-radius: 12px;
  padding: 16px;
  border-left: 4px solid #2E7D32;
}

.conclusion-box p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #1D1D1F;
}

/* ===== PDF 预览 ===== */
.certificate-detail-page .pdf-preview-wrapper {
  width: 100% !important;
  max-width: 100%;
  background: linear-gradient(135deg, #F5F5F7 0%, #E8E8ED 100%);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.certificate-detail-page .pdf-preview-wrapper::before {
  content: '📄';
  font-size: 64px;
}

.certificate-detail-page .pdf-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* 移动端隐藏 iframe，显示提示 */
@media (max-width: 767px) {
  .certificate-detail-page .pdf-iframe {
    display: none;
  }

  .certificate-detail-page .pdf-preview-wrapper.mobile-fallback::after {
    content: '移动端暂不支持预览，请下载查看';
    position: absolute;
    font-size: 16px;
    color: #6E6E73;
    text-align: center;
    padding: 0 20px;
  }
}

/* PDF 预览时的覆盖提示 */
.certificate-detail-page .pdf-preview-wrapper .pdf-iframe + p {
  position: absolute;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 14px;
}

/* ===== 按钮样式 ===== */
.certificate-detail-page .action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.certificate-detail-page .action-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* SVG 图标尺寸 */
.certificate-detail-page .action-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.certificate-detail-page .btn-primary {
  background: #2E7D32;
  color: white;
}

.certificate-detail-page .btn-primary:hover {
  background: #1B5E20;
}

.certificate-detail-page .btn-secondary {
  background: #F5F5F7;
  color: #1D1D1F;
}

.certificate-detail-page .btn-secondary:hover {
  background: #E8E8ED;
}

/* ===== 详细说明 ===== */
.description-content {
  font-size: 15px;
  line-height: 1.8;
  color: #1D1D1F;
}

.description-content p {
  margin-bottom: 16px;
}

.description-content p:last-child {
  margin-bottom: 0;
}

/* ===== 响应式 - 平板及以上 ===== */
@media (min-width: 768px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .info-row {
    border-bottom: none;
    padding: 8px 0;
  }

  .pdf-iframe {
    min-height: 600px;
  }

  .action-buttons {
    flex-direction: row;
  }
}

/* ===== 响应式 - 移动端 ===== */
@media (max-width: 767px) {
  .certificate-detail-page {
    padding-top: 116px;
  }

  .content-container {
    padding: 16px 12px 80px;
  }

  .content-card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .test-table {
    font-size: 12px;
  }

  .test-table th,
  .test-table td {
    padding: 8px 4px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .pdf-iframe {
    min-height: 400px;
  }

  .certificate-header {
    padding: 20px 16px;
  }

  .pdf-preview-wrapper {
    aspect-ratio: 3/4;
    font-size: 48px;
  }
}

/* ===== PDF.js 样式 ===== */
/* PDF 预览容器 */
.certificate-detail-page .pdfjs-wrapper {
  width: 100%;
  background: linear-gradient(135deg, #F5F5F7 0%, #E8E8ED 100%);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  min-height: 400px;
}

/* 加载动画 */
.certificate-detail-page .pdfjs-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.certificate-detail-page .pdf-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #E8E8ED;
  border-top-color: #2E7D32;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.certificate-detail-page .pdf-loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: #6E6E73;
}

/* Canvas */
.certificate-detail-page .pdfjs-canvas {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

/* 控制按钮 */
.certificate-detail-page .pdfjs-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  background: white;
  border-top: 1px solid #F5F5F7;
  flex-wrap: wrap;
}

.certificate-detail-page .pdfjs-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #F5F5F7;
  color: #1D1D1F;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.certificate-detail-page .pdfjs-btn:hover {
  background: #E8E8ED;
}

.certificate-detail-page .pdfjs-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.certificate-detail-page .pdfjs-btn svg {
  width: 16px;
  height: 16px;
}

.certificate-detail-page .pdfjs-page-info {
  font-size: 14px;
  color: #6E6E73;
  padding: 0 8px;
}

.certificate-detail-page .pdfjs-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 16px;
  border-left: 1px solid #F5F5F7;
}

.certificate-detail-page .pdfjs-zoom #zoom-level {
  min-width: 50px;
  text-align: center;
  font-size: 14px;
  color: #6E6E73;
}

/* 备用方案 */
.certificate-detail-page .pdfjs-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.certificate-detail-page .pdfjs-fallback-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.certificate-detail-page .pdfjs-fallback-message {
  font-size: 15px;
  color: #6E6E73;
  margin-bottom: 20px;
  max-width: 400px;
}

.certificate-detail-page .pdfjs-fallback-btn {
  padding: 14px 28px;
  background: #2E7D32;
  color: white;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.certificate-detail-page .pdfjs-fallback-btn:hover {
  background: #1B5E20;
}

.certificate-detail-page .pdf-error-text {
  color: #DC2626;
  font-size: 14px;
  text-align: center;
}

/* 通知动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

