/* ==========================================================================
   有為家居商城（shop.html）
   --------------------------------------------------------------------------
   混合型商城：可直接下單的配件 ＋ 需要報價的定制項目，共用同一台車。
   這份只放商城專屬樣式；按鈕、表單、頁首頁尾沿用 style.css。
   ========================================================================== */

/* ---------- 兩種商品說明 ---------- */
.shop-howto {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}
.shop-how {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.shop-how h3 { margin-top: 12px; }
.shop-how p { margin-top: 10px; font-size: .92rem; line-height: 1.75; }
.shop-how-tag {
  display: inline-block;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 10px;
  border-radius: 999px;
}
.shop-how-tag.is-buy { background: var(--brand-soft); color: var(--brand-dark); }
.shop-how-tag.is-quote { background: #fdf3e7; color: var(--warn); }

.shop-note {
  margin: 0 0 26px;
  padding: 14px 18px;
  font-size: .88rem;
  line-height: 1.75;
  color: var(--ink-2);
  background: var(--bg-alt);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- 篩選列 ---------- */
.shop-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.shop-kinds { display: flex; gap: 8px; flex-wrap: wrap; }
.shop-kind {
  font: inherit;
  font-size: .88rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.shop-kind:hover { border-color: var(--ink-3); color: var(--ink); }
.shop-kind.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.shop-searchbox { min-width: 240px; flex: 0 1 320px; }
.shop-searchbox .input { width: 100%; }

.shop-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.shop-cat {
  font: inherit;
  font-size: .84rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}
.shop-cat:hover { border-color: var(--line-strong); color: var(--ink); }
.shop-cat.is-active {
  background: var(--brand-soft);
  border-color: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.shop-meta { margin: 20px 0 18px; font-size: .85rem; color: var(--ink-3); }

/* ---------- 商品格 ---------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.shop-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.shop-media {
  position: relative;
  /* 4:3 而不是 1:1：家具商品照多半是橫式（手機拍也是橫著拍居多），
     正方形配 cover 會把左右兩側裁掉一大塊，櫃體常常只剩中間一段。 */
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-alt);
}
.shop-media img { width: 100%; height: 100%; object-fit: cover; }
.shop-media-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: var(--line-strong);
  background: var(--bg-alt);
}
.shop-flag {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: .74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.shop-flag.is-buy { color: var(--brand-dark); border-color: var(--brand-soft); }
.shop-flag.is-quote { color: var(--warn); border-color: #f0dcc4; }

.shop-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.shop-cat-tag { font-size: .74rem; color: var(--ink-3); }
.shop-name { margin-top: 6px; font-size: 1rem; font-weight: 600; line-height: 1.4; }
.shop-spec {
  margin-top: 8px;
  font-size: .82rem;
  color: var(--ink-3);
  line-height: 1.6;
  min-height: 2.6em;
}
.shop-price {
  margin-top: 14px;
  font-size: 1.06rem;
  font-weight: 600;
}
.shop-price small { font-weight: 400; font-size: .74rem; color: var(--ink-3); margin-left: 4px; }
.shop-stock { margin-top: 4px; font-size: .76rem; color: var(--ink-3); }
.shop-stock.is-out { color: var(--danger); }

/* 大型物件／出貨說明（成品家具、模塊化家具用得到） */
.shop-ship {
  margin-top: 6px;
  font-size: .76rem;
  line-height: 1.5;
  color: var(--ink-3);
}
.shop-ship.is-bulky {
  display: inline-block;
  color: var(--warn);
  background: #fdf3e7;
  border-radius: 999px;
  padding: 2px 9px;
  margin-top: 8px;
}

/* 規格選項（尺寸／顏色／組合數） */
.shop-vars { margin-top: 14px; display: grid; gap: 6px; }
.shop-var-label { font-size: .76rem; color: var(--ink-3); }
.shop-var {
  width: 100%;
  padding: 7px 10px;
  font-size: .85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.shop-actions { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }

.shop-empty { padding: 48px 0; text-align: center; color: var(--ink-3); }
.shop-empty-sm { padding: 40px 0; text-align: center; color: var(--ink-3); font-size: .9rem; }

/* ---------- 購物車浮動鈕 ---------- */
.shop-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 10px 26px -8px rgba(24, 33, 27, .45);
  display: grid;
  place-items: center;
  transition: transform .2s var(--ease);
}
.shop-fab:hover { transform: translateY(-2px); }
.shop-fab-n {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .74rem;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}

/* ---------- 抽屜 ---------- */
.shop-drawer { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.shop-drawer.is-open { pointer-events: auto; }
.shop-drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(24, 33, 27, .38);
  opacity: 0;
  transition: opacity .28s var(--ease);
}
.shop-drawer.is-open .shop-drawer-mask { opacity: 1; }
.shop-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100%);
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s var(--ease);
  box-shadow: -18px 0 50px -24px rgba(24, 33, 27, .4);
}
.shop-drawer.is-open .shop-drawer-panel { transform: translateX(0); }

.shop-drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.shop-x {
  border: 0;
  background: transparent;
  font-size: 1rem;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 6px;
}
.shop-x:hover { color: var(--ink); }

.shop-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 22px 32px;
  -webkit-overflow-scrolling: touch;
}

.shop-sec { padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.shop-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.shop-sec-n { font-size: .82rem; color: var(--ink-3); }

.shop-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
}
.shop-line:first-child { border-top: 0; }
.shop-l-name { font-size: .92rem; font-weight: 600; }
.shop-l-sub { font-size: .78rem; color: var(--ink-3); margin-top: 3px; }
.shop-l-var {
  font-size: .76rem;
  font-weight: 400;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.shop-l-price { font-size: .86rem; color: var(--ink-2); text-align: right; white-space: nowrap; }
.shop-l-ctl {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.shop-qty { display: flex; align-items: center; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.shop-qty button {
  width: 30px; height: 30px;
  border: 0; background: #fff; color: var(--ink-2);
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.shop-qty button:hover { background: var(--bg-alt); color: var(--ink); }
.shop-qty span { min-width: 34px; text-align: center; font-size: .88rem; }
.shop-rm {
  border: 0; background: transparent; color: var(--ink-3);
  font-size: .78rem; cursor: pointer; padding: 4px 2px;
}
.shop-rm:hover { color: var(--danger); }

.shop-sum {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 14px;
  font-size: .9rem;
  color: var(--ink-2);
}
.shop-sum b { font-size: 1.12rem; color: var(--ink); }
.shop-sum-note { margin-top: 8px; font-size: .78rem; color: var(--ink-3); }

/* ---------- 結帳表單 ---------- */
.shop-form { display: grid; gap: 16px; }
.shop-form-note {
  font-size: .8rem;
  line-height: 1.7;
  color: var(--ink-2);
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.shop-msg {
  font-size: .85rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fdf4f4;
  color: var(--danger);
}
.shop-msg.is-ok { background: var(--brand-soft); color: var(--brand-dark); }

.shop-done-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- 斷點 ---------- */
@media (max-width: 1024px) {
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shop-howto { grid-template-columns: 1fr; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .shop-bar { flex-direction: column; align-items: stretch; }
  .shop-searchbox { flex: 1 1 auto; min-width: 0; }
  .shop-fab { right: 16px; bottom: 16px; }
  .shop-drawer-panel {
    top: auto;
    width: 100%;
    height: 86vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .shop-drawer.is-open .shop-drawer-panel { transform: translateY(0); }
}
@media (max-width: 560px) {
  .shop-grid { grid-template-columns: 1fr; }
}
