/* ========== Banner 样式 ========== */
.banner {
  height: 320px;
  background: linear-gradient(to right, #1e7539, #2d8b47);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.banner h1 {
  font-size: 40px;
  margin-bottom: 15px;
}
.banner p {
  font-size: 18px;
  opacity: 0.9;
}

/* ========== 产品容器（统一居中） ========== */
.container {
  width: 90%;
  max-width: 1200px;
  min-height: 1145px;
  margin: 60px auto;
}

/* ========== 产品标题 ========== */
.product-title {
  text-align: center;
  margin-bottom: 30px;
}
.product-title h2 {
  font-size: 28px;
  color: #2d8b47;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}
.product-title h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: #2d8b47;
}

/* ========== 产品分类 ========== */
.product-category {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 40px;
}
.category-item {
  padding: 10px 25px;
  background: #f5f5f5;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
}
.category-item.active,
.category-item:hover {
  background: #2d8b47;
  color: #fff;
}

/* ==========产品列表（固定3列+宽度约束）========== */
.product-list {
  display: grid;
  /* 核心：固定3列，每列最小280px，最大1fr，适配不同屏幕 */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px; /* 卡片间距保留，避免拥挤 */
  padding: 20px 0;
  margin: 0 auto 50px; /* 水平居中，解决左右贴边 */
  width: 100%; /* 继承父容器宽度 */
  max-width: 1200px; /* 限制最大宽度，大屏不拉伸变形 */
  box-sizing: border-box;
  min-height: 900px; /* 保留最小高度 */
}

/* ==========产品卡片（固定高度+防溢出）========== */
.product-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 20px;
  transition: transform 0.3s ease;
  height: 420px; /* 固定高度保留 */
  box-sizing: border-box; /* 内边距不撑大卡片 */
  overflow: hidden; /* 关键：隐藏溢出内容，防止变形 */
  display: flex;
  flex-direction: column; /* 垂直布局，内容自动分配空间 */
  width: 100%; /* 强制继承Grid列宽，不超宽 */
}

.product-card:hover {
  transform: translateY(-5px);
}

/* ==========产品图片（比例固定+防变形）========== */
.product-img {
  width: 100%;
  height: 200px; /* 固定高度 */
  background: #f5f5f5;
  border-radius: 4px;
  margin-bottom: 15px;
  overflow: hidden;
  flex-shrink: 0; /* 图片区域不被挤压变形 */
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 图片等比缩放，不拉伸 */
}

/* ==========产品名称（单行溢出+强制换行）========== */
.product-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 10px 0;
  /* 核心：单行溢出显示省略号，避免撑大卡片 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========产品描述/特性（多行溢出控制）========== */
.product-desc,
.product-feature {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin: 0 0 10px 0;
  /* 多行溢出控制，最多显示2行 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* 英文强制换行，防止横向溢出 */
  word-wrap: break-word;
  word-break: break-word;
}

/* ==========详情按钮（固定在卡片底部）========== */
.product-btn {
  display: inline-block;
  padding: 8px 16px;
  background: #2d882d;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  margin-top: auto; /* 按钮自动推到卡片底部 */
  align-self: flex-start; /* 左对齐 */
}

.product-btn:hover {
  background: #236b23;
}

/* ========== 分页（Pboot 完美适配） ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.page-item,
.page-num {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eee;
  border-radius: 4px;
  cursor: pointer;
}
.page-num.page-num-current {
  background: #2d8b47;
  color: #fff;
  border-color: #2d8b47;
}
.page-prev,
.page-next {
  padding: 0 15px;
  width: auto;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
  }
  .banner h1 { font-size: 28px; }
  .banner p { font-size: 15px; }
  .container { width: 95%; padding: 0 10px; margin: 40px auto; }
  .product-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .product-card {
    height: auto;
    min-height: 380px;
  }
  .product-name {
    font-size: 16px;
  }
  .category-item {
    padding: 8px 18px;
    font-size: 14px;
  }
}
@media (max-width: 500px) {
  .product-card {
    min-height: 350px;
  }
  .product-img {
    height: 180px;
  }
}