.product-section {
  padding: 32px 0;
  background: #fafbfc;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 32px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.product-item {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-align: center;
  padding: 20px 10px 16px 10px;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid #eee;
}

.product-item:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.13);
  transform: translateY(-4px) scale(1.03);
}

.product-item img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 12px;
  border-radius: 6px;
  background: #f5f5f5;
  transition: box-shadow 0.2s;
}

.product-name {
  font-size: 1.1em;
  font-weight: 500;
  margin-bottom: 8px;
  color: #222;
  transition: color 0.2s;
}

.product-item a {
  color: inherit;
  text-decoration: none;
}

.product-item a:hover .product-name {
  color: #e67e22;
}

.product-price {
  color: #e67e22;
  font-weight: bold;
  font-size: 1.05em;
  margin-top: 4px;
}





/* 整體區塊 */
.category-section {
  position: relative;
  padding: 2rem;
  background-color: #f9f9f9;
  overflow: visible;
  
}

.category-title {
  margin-bottom: 1rem;
  font-size: 1.6rem;
  color: #333;
  text-align: center;
}

/* 主分類網格 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  overflow: visible;
}

/* 主分類卡片 */
.category-item {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  text-align: center;
  cursor: default;
  /* 取消 position:relative，讓子選單定位到 .category-section */
}

.category-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 主分類名稱 */
.category-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
}

/* 子分類清單，定位到 .category-section 下 */
.subcat-list {
  display: none;
  position: absolute;
  top: 100%;
  margin: 0;
  /* 先放在正下方 */
  margin-top: -2px;
  /* 向上疊 2px，消除縫隙 */
  /* 2rem(section padding) + 1rem(item padding) + ~item height */
  left: 0;
  /* JavaScript 會動態覆蓋此值 */
  width: 100%;
  /* JavaScript 會動態覆蓋此值 */

  padding: 0.5rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

/* 子分類項目 */
.subcat-item {
  display: flex;
  align-items: flex-start;
  padding: 0.5rem 1rem;
}

.subcat-item+.subcat-item {
  border-top: 1px solid #f0f0f0;
}

.subcat-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 0.8rem;
}

.subcat-info {
  flex: 1;
  text-align: left;
}

.subcat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.subcat-desc {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.2rem;
  line-height: 1.2;
}





/* 讓主分類連結佔滿整個卡片 */
.category-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* 子分類連結也同樣佔滿 li，並改用 flex 排版 */
.subcat-link {
  display: flex;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  padding: 0.5rem 1rem;
}

/* 把原本 .subcat-item 裡的 padding、border-top 移到 .subcat-link */
.subcat-item {
  border: none;
  padding: 0;
}

.subcat-item+.subcat-item .subcat-link {
  border-top: 1px solid #f0f0f0;
}

.subcat-link.no-thumb {
  align-items: center;
}

/* 左側兩個特別項目（超值＋全部）額外間隔 
.category-item.featured-item {
  margin-right: 1.5rem;
}*/


@media screen and (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .category-section {
    display: none !important;
  }  
}