/* wx-product-card-refine.css
   官網商品卡統一（2026-10-30 老闆看完官網質感提案，按鈕之後選「做商品卡」）。只改外觀，不動卡片做的事。
   - 圖片、名稱、價錢、按鈕包成一張白卡；名稱固定兩行高，價錢和按鈕永遠貼在卡片底部，一排的價錢會對齊。
   - 圖片貼齊卡片上緣和左右，卡片只剩外面一圈框（老闆 10/31：設計圖的圖沒有往內縮，不要雙框）。
   - 電腦版「加入購物車」不再藏到滑到圖上才出現，跟手機一樣一直放在價錢下面。
   - 滑鼠移上去只換框線顏色、陰影深一點，不跳、不放大。冷色系，框線顏色從網站按鈕色算出來。
   - 舊的商品卡規則分好幾支寫（wx-product-card-visual.css、wx-home-product-grid.css、首頁內嵌 style），
     每支都帶 !important、選擇器又長。這裡每條都用 html :is(body, #wx-card-refine) 開頭：
     #wx-card-refine 頁面上不存在，只是讓 :is() 用 id 的優先順序計算，這支就一定蓋得過舊規則，不用跟著疊 class。
   - 售完卡片的灰罩、「已售完待補貨」、停用按鈕都不受影響（這裡不碰那些屬性）。
   - 拿掉這一支，商品卡就回到原本的樣子。 */

:root {
  --wxc-main: var(--primary-color, var(--pos-highlight, var(--pos-btn-bg, #587493)));
  --wxc-line: #e3e9f0;
  --wxc-line-hover: color-mix(in srgb, var(--wxc-main) 40%, #ffffff);
  --wxc-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  --wxc-shadow-hover: 0 8px 20px rgba(15, 23, 42, .08);
}

/* ---------- 整張卡：上、左、右不留白，圖片貼邊；文字和按鈕的左右空間由下面各自給 ---------- */
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card {
  align-self: stretch !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border: 1px solid var(--wxc-line) !important;
  border-radius: 14px !important;
  box-shadow: var(--wxc-shadow) !important;
  padding: 0 0 12px !important;
  transform: none !important;
  transition: border-color .15s ease, box-shadow .15s ease !important;
}
@media (hover: hover) and (pointer: fine) {
  html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card:hover {
    background: #ffffff !important;
    border-color: var(--wxc-line-hover) !important;
    box-shadow: var(--wxc-shadow-hover) !important;
    transform: none !important;
  }
}

/* 卡片內容由上往下排；電腦版原本是「按鈕疊在圖上」的格線，這裡改回一般直排 */
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  height: 100% !important;
  row-gap: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

/* ---------- 圖：貼齊卡片上緣和左右；上面兩角跟卡片一起圓（卡片 14px 減 1px 框線），圖自己不畫框，才不會變兩層框 ---------- */
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col > .card-img-box {
  border: 0 !important;
  border-radius: 13px 13px 0 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
}
/* 手機舊規則給圖片本身 14px 圓角，貼邊後下面兩角會缺一塊，這裡歸零（外框已經負責上面兩角） */
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col > .card-img-box img {
  border-radius: 0 !important;
}

/* ---------- 名稱＋價錢：名稱固定兩行高，價錢推到底 ---------- */
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col > .card-body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  padding: 12px 12px 0 !important;
}
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .card-title {
  min-height: calc(1.4em * 2) !important;
}
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .card-price-block {
  margin-top: auto !important;
  padding-top: 6px !important;
}

/* ---------- 加入購物車：一直顯示、放在價錢下面，左右跟文字一樣留 12px ---------- */
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col > .product-action-btn-wrap {
  grid-area: auto !important;
  align-self: stretch !important;
  position: relative !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: none !important;
  margin: 10px 12px 0 !important;
  padding: 0 !important;
  width: auto !important;
  max-width: none !important;
}
html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .product-action-btn-wrap .card-btn {
  border-radius: 10px !important;
}

/* 手機兩欄卡片比較窄，左右和底部各收一點 */
@media (max-width: 480px) {
  html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card {
    padding-bottom: 10px !important;
  }
  html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col > .card-body {
    padding: 10px 10px 0 !important;
  }
  html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card .wx-card-content-col > .product-action-btn-wrap {
    margin: 8px 10px 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html :is(body, #wx-card-refine) .product-card-item-wrap > .product-card { transition: none !important; }
}
