/* =============================================
   shop_cart.css — 购物车全页模块样式
   模块名: shop_cart
   依赖: common.css、home.css (header/footer变量)
   ============================================= */

/* ─────────────────────────────────────────────
   页面骨架
───────────────────────────────────────────── */
.page-shop-cart {
  background-color: #f5f5f5;
  min-height: 100vh;
}

.sc-main {
  max-width: 1920px;
  margin: 0 auto;
}

.sc-container {
  max-width: 1152px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ─────────────────────────────────────────────
   顶部导航（返回 + 标题行）
───────────────────────────────────────────── */
.sc-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted, #666);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 24px;
  transition: color var(--transition-base, 0.2s ease);
}
.sc-back-btn:hover { color: var(--color-text-body, #333); }
.sc-back-btn img {
  width: 20px;
  height: 20px;
}

.sc-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sc-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-dark, #1a1a1a);
  line-height: 1.5;
}

.sc-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary, #e31e24);
  font-size: 14px;
  font-weight: 500;
  transition: opacity var(--transition-base, 0.2s ease);
  padding: 4px 0;
}
.sc-clear-btn:hover { opacity: 0.75; }
.sc-clear-btn img {
  width: 16px;
  height: 16px;
}

/* ─────────────────────────────────────────────
   全选行
───────────────────────────────────────────── */
.sc-selectall-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--color-border, #ddd);
  border-radius: var(--radius-md, 8px);
  padding: 16px;
  margin-bottom: 16px;
}

.sc-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

/* 隐藏原生 checkbox */
.sc-checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.sc-checkbox-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.sc-checkbox-label .sc-checkbox-icon--unchecked { display: block; }
.sc-checkbox-label .sc-checkbox-icon--checked   { display: none;  }
.sc-checkbox-label input:checked ~ .sc-checkbox-icon--unchecked { display: none;  }
.sc-checkbox-label input:checked ~ .sc-checkbox-icon--checked   { display: block; }

.sc-selectall-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-body, #333);
}

.sc-delete-selected-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary, #e31e24);
  font-size: 14px;
  font-weight: 500;
  transition: opacity var(--transition-base, 0.2s ease);
  padding: 4px 0;
}
.sc-delete-selected-btn:hover { opacity: 0.75; }
.sc-delete-selected-btn img {
  width: 16px;
  height: 16px;
}

/* ─────────────────────────────────────────────
   购物车商品列表区
───────────────────────────────────────────── */
.sc-items-card {
  background: #fff;
  border: 1px solid var(--color-border, #ddd);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────
   单个商品行
───────────────────────────────────────────── */
.sc-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px;
  border-bottom: 1px solid var(--color-border, #ddd);
  transition: background-color var(--transition-base, 0.2s ease);
}
.sc-item:last-child { border-bottom: none; }
.sc-item:hover      { background-color: #fafafa; }

/* 已售罄商品偏暗 */
.sc-item--soldout {
  opacity: 0.6;
}
.sc-item--soldout .sc-item__product-name { color: #666; }

/* 商品checkbox */
.sc-item__checkbox {
  flex-shrink: 0;
}
.sc-item__checkbox .sc-checkbox-label { margin: 0; }

/* 商品图片 */
.sc-item__img {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border: 1px solid #e8e8e8;
  border-radius: var(--radius-sm, 4px);
  overflow: hidden;
  position: relative;
}
.sc-item__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* 已售罄蒙版 */
.sc-item__img-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  border-radius: var(--radius-sm, 4px);
}
.sc-item--soldout .sc-item__img-overlay { display: block; }

/* 商品信息 */
.sc-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-item__product-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-body, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.sc-item__spec,
.sc-item__sku {
  font-size: 14px;
  color: var(--color-text-hint, #999);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.sc-item__sku { font-size: 13px; }

.sc-item__price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sc-item__price {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-body, #333);
}

.sc-item__price-original {
  font-size: 14px;
  color: var(--color-text-hint, #999);
  text-decoration: line-through;
}

/* 库存状态徽章 */
.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  height: 24px;
  border-radius: var(--radius-sm, 4px);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sc-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sc-badge--instock {
  background: #e8f5e9;
  color: #28a745;
}
.sc-badge--instock::before { background: #28a745; }

.sc-badge--lowstock {
  background: #fff9e5;
  color: #ff9800;
}
.sc-badge--lowstock::before { background: #ff9800; }

.sc-badge--soldout {
  background: transparent;
  color: var(--color-primary, #e31e24);
  padding: 0;
}
.sc-badge--soldout::before { display: none; }

/* 数量调节控件 */
.sc-qty {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border, #ddd);
  border-radius: var(--radius-sm, 4px);
  height: 34px;
  overflow: hidden;
}

.sc-qty__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-base, 0.2s ease);
  flex-shrink: 0;
}
.sc-qty__btn:hover  { background-color: #f5f5f5; }
.sc-qty__btn:active { background-color: #ebebeb; }
.sc-qty__btn:disabled { cursor: not-allowed; opacity: 0.4; }

.sc-qty__btn img {
  width: 14px;
  height: 14px;
}

.sc-qty__input {
  width: 56px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--color-border, #ddd);
  border-right: 1px solid var(--color-border, #ddd);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-body, #333);
  background: #fff;
  -moz-appearance: textfield;
  outline: none;
}
.sc-qty__input::-webkit-inner-spin-button,
.sc-qty__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* 商品小计价格 */
.sc-item__subtotal {
  flex-shrink: 0;
  width: 110px;
  text-align: right;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary, #e31e24);
  line-height: 1.5;
}

/* 删除按钮 */
.sc-item__delete {
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  transition: opacity var(--transition-base, 0.2s ease);
}
.sc-item__delete:hover { opacity: 1; }
.sc-item__delete img {
  width: 20px;
  height: 20px;
}

/* ─────────────────────────────────────────────
   订单汇总面板
───────────────────────────────────────────── */
.sc-summary-card {
  background: #fff;
  border: 1px solid var(--color-border, #ddd);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.sc-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  gap: 24px;
  flex-wrap: wrap;
}

.sc-summary-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sc-summary-label {
  font-size: 14px;
  color: var(--color-text-muted, #666);
  line-height: 1.5;
}

.sc-summary-total {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary, #e31e24);
  line-height: 1.5;
}

.sc-summary-gst {
  font-size: 13px;
  color: var(--color-text-hint, #999);
}

.sc-checkout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  min-width: 280px;
  padding: 0 32px;
  background: var(--color-primary, #e31e24);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-base, 0.2s ease),
              box-shadow var(--transition-base, 0.2s ease);
}
.sc-checkout-btn:hover  {
  background: var(--color-primary-hover, #c51a1f);
  box-shadow: 0 4px 12px rgba(227,30,36,0.35);
}
.sc-checkout-btn:active {
  background: var(--color-primary-active, #a81519);
  transform: translateY(1px);
}

/* 价格明细折叠行 */
.sc-breakdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px 12px;
  border-top: 1px solid var(--color-border, #ddd);
  cursor: pointer;
  user-select: none;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted, #666);
  transition: background-color var(--transition-base, 0.2s ease);
}
.sc-breakdown-toggle:hover { background-color: #fafafa; }

.sc-breakdown-toggle img {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-base, 0.2s ease);
}
.sc-breakdown-toggle[aria-expanded="true"] img {
  transform: rotate(180deg);
}

/* 价格明细内容 */
.sc-breakdown-body {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 4px 24px 20px;
}
.sc-breakdown-body.is-visible { display: flex; }

.sc-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sc-breakdown-row__label {
  font-size: 14px;
  color: var(--color-text-muted, #666);
}

.sc-breakdown-row__value {
  font-size: 14px;
  color: var(--color-text-dark, #1a1a1a);
  font-weight: 400;
}

/* ─────────────────────────────────────────────
   购物车为空状态
───────────────────────────────────────────── */
.sc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px;
  text-align: center;
}
.sc-empty svg,
.sc-empty img {
  width: 56px;
  height: 56px;
  stroke: #ccc;
}
.sc-empty__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-body, #333);
}
.sc-empty__sub {
  font-size: 15px;
  color: var(--color-text-muted, #666);
}
.sc-empty__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 32px;
  background: var(--color-primary, #e31e24);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm, 4px);
  text-decoration: none;
  margin-top: 8px;
  transition: background-color var(--transition-base, 0.2s ease);
}
.sc-empty__cta:hover { background: var(--color-primary-hover, #c51a1f); }

/* ─────────────────────────────────────────────
   Footer
───────────────────────────────────────────── */
.sc-footer {
  background: var(--color-text-dark, #1a1a1a);
  padding: 64px 0 0;
}

.sc-footer__inner {
  max-width: 1352px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
}

.sc-footer__col-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
}

/* Footer 反馈表单 */
.sc-footer__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sc-footer__input,
.sc-footer__textarea {
  width: 100%;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--color-border, #ddd);
  border-radius: var(--radius-sm, 4px);
  background: #fff;
  font-size: 14px;
  color: var(--color-text-body, #333);
  font-family: var(--font-family);
  outline: none;
  transition: border-color var(--transition-base, 0.2s ease);
}
.sc-footer__input::placeholder,
.sc-footer__textarea::placeholder {
  color: rgba(51,51,51,0.5);
}
.sc-footer__input:focus,
.sc-footer__textarea:focus { border-color: #999; }

.sc-footer__textarea {
  height: 96px;
  padding: 8px 12px;
  resize: vertical;
  line-height: 1.5;
}

.sc-footer__submit {
  width: 100%;
  height: 40px;
  background: var(--color-primary, #e31e24);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  transition: background-color var(--transition-base, 0.2s ease);
}
.sc-footer__submit:hover { background: var(--color-primary-hover, #c51a1f); }

/* Footer 联系方式 */
.sc-footer__contact-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sc-footer__contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sc-footer__contact-item img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  /* 将图标染为浅色 */
  filter: invert(1) brightness(0.8);
}

.sc-footer__contact-text {
  font-size: 14px;
  color: #ddd;
  line-height: 1.5;
}
.sc-footer__contact-text a {
  color: #ddd;
  text-decoration: none;
}
.sc-footer__contact-text a:hover { color: #fff; text-decoration: underline; }

/* Footer 帮助中心 */
.sc-footer__links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sc-footer__link {
  font-size: 14px;
  color: #ddd;
  text-decoration: none;
  transition: color var(--transition-base, 0.2s ease);
}
.sc-footer__link:hover { color: #fff; }

/* Footer 底栏 */
.sc-footer__bottom {
  margin-top: 64px;
  border-top: 1px solid #333;
  padding: 24px 0;
}

.sc-footer__bottom-inner {
  max-width: 1352px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sc-footer__copy {
  font-size: 14px;
  color: #ddd;
}

.sc-footer__bottom-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.sc-footer__bottom-links a {
  font-size: 14px;
  color: #ddd;
  text-decoration: none;
  transition: color var(--transition-base, 0.2s ease);
}
.sc-footer__bottom-links a:hover { color: #fff; }

/* ─────────────────────────────────────────────
   响应式 — 平板 (max 1024px)
───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sc-container {
    padding: 20px 24px 60px;
  }

  .sc-item__product-name {
    white-space: normal;
    font-size: 15px;
  }

  .sc-item {
    gap: 16px;
  }

  .sc-item__subtotal {
    width: 90px;
    font-size: 16px;
  }

  .sc-summary-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .sc-checkout-btn {
    width: 100%;
    min-width: unset;
  }

  .sc-footer__inner {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

/* ─────────────────────────────────────────────
   响应式 — 手机 (max 768px)
───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sc-container {
    padding: 16px 16px 48px;
  }

  .sc-title {
    font-size: 22px;
  }

  .sc-item {
    flex-wrap: wrap;
    gap: 12px;
  }

  .sc-item__img {
    width: 80px;
    height: 80px;
  }

  .sc-item__info {
    min-width: calc(100% - 80px - 16px - 16px - 20px);
  }

  .sc-item__subtotal {
    margin-left: auto;
    font-size: 16px;
    width: auto;
  }

  .sc-qty {
    height: 32px;
  }
  .sc-qty__btn { width: 28px; }
  .sc-qty__input { width: 44px; font-size: 13px; }

  .sc-summary-total {
    font-size: 24px;
  }

  .sc-footer__inner {
    grid-template-columns: 1fr;
  }

  .sc-footer__bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
