/* ===== 右側購物車 Drawer：外框與遮罩 ===== */

.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 1000;
}
.cart-drawer-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 380px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 12px rgba(0,0,0,.15);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 1001;
  display: flex;
  flex-direction: column;
}
.cart-drawer.open {
  transform: translateX(0);
}

/* ===== Drawer 內部結構 ===== */

.cart-drawer-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}
.cart-drawer-header h2 {
  font-size: 15px;
  font-weight: 700;
}
.cart-drawer-header button {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 80px;
}

.cart-drawer-footer {
  border-top: 1px solid #e5e7eb;
  padding: 10px 12px;
  background: #f9fafb;
  position: sticky;
  bottom: 0;
}

/* 小計 / 總額列 */

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}
.cart-total-row strong {
  font-size: 16px;
  color: #b91c1c;
}

/* ===== Drawer 內每一筆商品：對應 JS 的 .cart-item ===== */

.cart-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.cart-item:last-child {
  border-bottom: none;
}

.cart-item-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f3f4f6;
}
.cart-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-item-name {
  font-weight: 600;
}
.cart-item-spec {
  font-size: 12px;
  color: #6b7280;
}

.cart-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.cart-item-price {
  font-size: 13px;
}

.cart-item-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 2px 6px;
}
.cart-item-qty button {
  border: none;
  background: transparent;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 16px;
}
.cart-item-qty span {
  min-width: 20px;
  text-align: center;
}

.cart-item-remove {
  font-size: 12px;
  color: #9ca3af;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* 空購物車文字 */

.cart-empty {
  font-size: 13px;
  color: #6b7280;
  padding: 10px 0;
}

/* ===== 共用按鈕（抽屜底部「前往購物車與結帳」） ===== */

.btn-cart-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 14px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

/* ===== 獨立購物車頁面（cart.php 用） ===== */

.cart-page {
  padding: 16px 0 32px;
}

.cart-page-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
}
@media(max-width:900px){
  .cart-page-layout {
    grid-template-columns: 1fr;
  }
}

.cart-page-panel {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 12px 14px;
}

.cart-page-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* cart.php 內每一筆商品：對應 JS 的 .cart-row */

.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.cart-row:last-child {
  border-bottom: none;
}

.cart-row-left {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cart-row-thumb {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
  flex-shrink: 0;
}
.cart-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-row-name {
  font-weight: 600;
}
.cart-row-spec {
  font-size: 12px;
  color: #6b7280;
}

.cart-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-row-price {
  min-width: 90px;
}

.cart-row-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 2px 6px;
}
.cart-row-qty button {
  border: none;
  background: transparent;
  width: 22px;
  height: 22px;
  cursor: pointer;
}
.cart-row-qty span {
  min-width: 24px;
  text-align: center;
}

.cart-row-subtotal {
  min-width: 110px;
}

.cart-row-remove {
  font-size: 12px;
  color: #9ca3af;
  border: none;
  background: transparent;
  cursor: pointer;
}

.cart-page-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin: 6px 0 4px;
}
.cart-page-total-row strong {
  font-size: 18px;
  color: #b91c1c;
}

.cart-page-empty {
  font-size: 14px;
  color: #6b7280;
  padding: 10px 0;
}
