/* CSS 变量：与网站主风格统一 */
:root {
  --primary-color: #2c7da0;
  --secondary-color: #61a5c2;
  --text-color: #2d3e50;
  --bg-color: #e9ecef;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --page-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #e2e8f0;
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  padding: 40px 20px;
}

.catalog-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

/* 页面纸张样式 */
.page {
  width: 210mm;
  min-height: 297mm;
  background: white;
  box-shadow: var(--page-shadow);
  padding: 15mm 20mm;
  position: relative;
  border-radius: 4px;
  page-break-after: always;
  break-inside: avoid;
  transition: transform 0.2s;
}

.page:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.2);
}

/* 封面样式 */
.cover {
  text-align: center;
  margin: 20px 0;
}

.cover h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 16px;
}

.cover p {
  font-size: 1.2rem;
  color: #555;
}

.cover hr {
  width: 80px;
  margin: 20px auto;
  border-color: var(--primary-color);
}

/* 页面头部 */
.page-header h2 {
  font-size: 1.6rem;
  color: var(--primary-color);
  border-left: 5px solid var(--primary-color);
  padding-left: 12px;
  margin-bottom: 20px;
}

/* 表格样式 */
.product-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.85rem;
}

.product-table th,
.product-table td {
  border: 1px solid #ddd;
  padding: 8px 6px;
  text-align: left;
  vertical-align: middle;
}

.product-table th {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

.product-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.product-table tr:hover {
  background-color: #f1f5f9;
}

/* 库存为0的行标黄色 */
.product-table tr.stock-zero {
  background-color: #fff3cd !important;
}
.product-table tr.stock-zero:hover {
  background-color: #ffe6b3 !important;
}
.stock-cell {
  font-weight: 500;
}
tr.stock-zero .stock-cell {
  color: #e67e22;
  font-weight: bold;
}

/* 表格内图片 */
.product-image-table {
  width: 50px;
  height: 50px;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s;
}

.product-image-table:hover {
  transform: scale(1.05);
}

/* 按钮样式 */
.btn {
  padding: 6px 12px;
  border-radius: 40px;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-block;
  text-align: center;
  transition: 0.2s;
  cursor: pointer;
  border: none;
  background: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-1px);
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.7rem;
}

/* 页码 */
.page-number {
  text-align: center;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

/* 模态框基础样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.modal-content {
  margin: auto;
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  padding: 20px;
}

.modal .close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #333;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  background: rgba(255,255,255,0.8);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
}
.modal .close:hover {
  color: #000;
  background: white;
}

/* 详情卡片样式 */
.detail-card .detail-card-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  width:500px;
}
.detail-image {
  flex: 0 0 200px;
  text-align: center;
}
.detail-image img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
}
.detail-info {
  flex: 1;
}
.detail-info h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: var(--primary-color);
}
.detail-info .brand {
  font-size: 1rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.detail-info .subtitle {
  font-style: italic;
  color: #495057;
  margin-bottom: 12px;
}
.detail-info p {
  margin: 8px 0;
}
.detail-actions {
  margin-top: 20px;
}

/* 响应式：屏幕宽度小于纸张宽度时自适应 */
@media screen and (max-width: 230mm) {
  .page {
    width: 100%;
    margin: 20px 0;
    box-sizing: border-box;
  }
  .product-table {
    font-size: 0.7rem;
  }
  .product-table th,
  .product-table td {
    padding: 4px 3px;
  }
  .product-image-table {
    width: 35px;
    height: 35px;
  }
  .detail-card .detail-card-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* 打印样式 */
@media print {
  body {
    background: white;
    padding: 0;
    margin: 0;
  }
  .catalog-container {
    display: block;
    margin: 0;
    padding: 0;
  }
  .page {
    margin: 0;
    box-shadow: none;
    page-break-after: always;
    break-inside: avoid;
    width: 100%;
    padding: 1cm;
  }
  .product-table th {
    background-color: #eee;
    color: black;
  }
  .product-table tr {
    break-inside: avoid;
  }
  .modal {
    display: none;
  }
  .product-image-table {
    cursor: default;
  }
  .page:hover {
    transform: none;
  }
}