﻿/* 购物车 —— Figma 1023:2339「商铺页面·购物车」
 * 底栏尺寸复用 product-detail.css（1023:400 实测）
 */

.cart-phone {
  max-height: min(812px, calc(100vh - 48px));
  padding-bottom: 0;
  background: var(--bg);
  background-image: none;
  overflow: hidden;
}

/* 背景垫层：iframe 加载当前页，被遮罩压暗 */
.cart-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
}

.cart-backdrop-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none; /* 事件交由遮罩层处理（点击关闭） */
}

.cart-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
  cursor: pointer;
  border: 0;
}

.cart-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 64px;
  z-index: 2;
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: calc(100% - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  flex-shrink: 0;
}

.cart-header h1 {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: #333;
  line-height: 1;
}

.cart-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: rgba(129, 137, 148, 0.6);
  font-size: 14px;
  font-weight: 400;
}

.cart-list {
  overflow-y: auto;
  padding: 4px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  flex: 1 1 auto;
}

.cart-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.cart-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-info {
  flex: 1;
  min-width: 0;
}

.cart-info h2 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-spec {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(129, 137, 148, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-price {
  flex: 1;
  color: #f73a2c;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.cart-price .yen {
  font-size: 14px;
}

.cart-price .major {
  font-size: 16px;
}

.cart-price .minor {
  font-size: 14px;
}

.cart-stepper {
  display: inline-flex;
  align-items: center;
}

.cart-stepper .step {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.cart-stepper .qty {
  min-width: 20px;
  padding: 0 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.cart-bar {
  z-index: 3;
}

/* ---- 结算底栏（京东式：全选 + 合计 + 结算），cart 页与浮层共用 ---- */
.cart-phone .settle-bar,
.cart-layer .settle-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  z-index: 4;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 16px;
}

.settle-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  flex-shrink: 0;
}

/* 圆形勾选框（京东式红勾） */
.ci-check,
.settle-all {
  position: relative;
}

.ci-check input,
.settle-all input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.checkbox {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #c6cad1;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.ci-check input:checked + .checkbox,
.settle-all input:checked + .checkbox {
  background: #f73a2c;
  border-color: #f73a2c;
}

.ci-check input:checked + .checkbox::after,
.settle-all input:checked + .checkbox::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ci-check {
  display: inline-flex;
  align-items: center;
  align-self: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* 未勾选的条目整行压暗 */
.cart-item.off .cart-thumb,
.cart-item.off .cart-info {
  opacity: 0.45;
}

.settle-amount {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.settle-amount p {
  font-size: 13px;
  color: #333;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}

.settle-amount p span {
  color: #f73a2c;
  font-size: 18px;
  font-weight: 700;
}

.settle-amount em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: rgba(129, 137, 148, 0.6);
  margin-top: 2px;
}

.settle-btn {
  height: 40px;
  padding: 0 22px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(90deg, #ff0028 0%, #ff0093 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.settle-btn:disabled {
  background: #c6cad1;
  cursor: not-allowed;
}

/* 当前页上的购物车浮层：必须高于底栏 tabbar(z=200)，否则列表/结算被挡住 */
.cart-layer {
  position: fixed;
  z-index: 300;
}

.cart-layer[hidden] {
  display: none;
}

.cart-layer .cart-scrim,
.cart-layer .cart-sheet,
.cart-layer .settle-bar {
  position: absolute;
}

.cart-layer .cart-scrim {
  bottom: 64px;
}

/* 打开购物车时隐藏底栏/详情底栏，避免与结算条抢位 */
.phone.cart-open > .tabbar,
.phone.cart-open > .detail-bar {
  visibility: hidden;
  pointer-events: none;
}

/* 商品详情底栏样式已移至 product-detail.css，避免盖住加购/购买按钮 */
