/* ========== Shopping Cart ========== */
/* ========== Reset & Variables ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --jd-red: #E2231A;
  --jd-red-dark: #C8160F;
  --jd-green: #248C13;
  --jd-yellow: #FF8C00;
  --jd-pink: #E2231A;
  --text-dark: #333333;
  --text-medium: #666666;
  --text-light: #999999;
  --border-color: #EEEEEE;
  --bg-light: #FAFAFA;
  --white: #FFFFFF;
}

/* ========== 顶部导航栏 ========== */
.jd-navbar {
  width: 100%;
  background: var(--white);
  border-bottom: 3px solid var(--jd-red);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.jd-navbar-inner {
  max-width: 1190px;
  margin: 0 auto;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Logo区 */
.jd-logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.jd-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.jd-logo-icon {
  width: 36px;
  height: 36px;
}

.jd-logo-text {
  font-size: 20px;
  font-weight: bold;
  color: var(--jd-red);
  letter-spacing: 1px;
}

.jd-cart-title {
  font-size: 14px;
  color: var(--text-medium);
  border-left: 1px solid #ddd;
  padding-left: 12px;
}

.jd-cart-count {
  color: var(--jd-red);
  font-weight: bold;
}

/* 配送地址 */
.jd-address-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-medium);
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.jd-address-selector:hover {
  border-color: var(--jd-red);
}

.jd-address-selector .icon-location {
  width: 16px;
  height: 16px;
}

.jd-address-text {
  color: var(--text-dark);
  font-weight: 500;
}

.jd-address-selector .icon-arrow {
  width: 14px;
  height: 14px;
}

/* 搜索区 */
.jd-search-area {
  flex: 1;
  display: flex;
  max-width: 500px;
  margin-left: auto;
}

.jd-search-input {
  flex: 1;
  height: 36px;
  border: 2px solid var(--jd-red);
  border-right: none;
  border-radius: 2px 0 0 2px;
  padding: 0 12px;
  font-size: 13px;
  outline: none;
  color: var(--text-dark);
}

.jd-search-input::placeholder {
  color: var(--text-light);
}

.jd-search-btn {
  width: 60px;
  height: 36px;
  background: var(--jd-red);
  color: var(--white);
  border: none;
  border-radius: 0 2px 2px 0;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.jd-search-btn:hover {
  background: var(--jd-red-dark);
}

/* ========== 购物车主体 ========== */
.jd-cart-body {
  max-width: 1190px;
  margin: 20px auto;
  padding: 0 10px;
  padding-bottom: 80px;
}

/* ========== 购物车表头 ========== */
.jd-cart-header {
  display: grid;
  grid-template-columns: 60px 1fr 140px 130px 140px 100px;
  align-items: center;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 4px 4px 0 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-medium);
}

.jd-col-check { display: flex; align-items: center; }
.jd-col-product { padding-left: 8px; }
.jd-col-price, .jd-col-quantity, .jd-col-subtotal, .jd-col-ops {
  text-align: center;
  padding: 0 4px;
}

/* ========== 复选框 ========== */
.jd-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-medium);
  user-select: none;
}

.jd-check {
  display: none;
}

.jd-check-box {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  position: relative;
}

.jd-check:checked + .jd-check-box {
  background: var(--jd-red);
  border-color: var(--jd-red);
}

.jd-check:checked + .jd-check-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}

/* ========== 店铺分组 ========== */
.jd-shop-group {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0;
}

.jd-shop-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.jd-shop-tag {
  display: inline-block;
  padding: 1px 4px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 2px;
  background: var(--jd-red);
  color: var(--white);
}

.jd-shop-tag-red {
  background: var(--jd-red);
}

.jd-shop-name {
  font-weight: bold;
  color: var(--text-dark);
  font-size: 13px;
}

.jd-shop-notice {
  margin-left: auto;
  color: var(--text-light);
  font-size: 12px;
}

.jd-shop-notice a {
  color: var(--jd-red);
  text-decoration: none;
}

.jd-shop-notice a:hover {
  text-decoration: underline;
}

/* ========== 商品行 ========== */
.jd-item {
  display: grid;
  grid-template-columns: 60px 1fr 140px 130px 140px 100px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
  min-height: 110px;
}

.jd-item:last-child {
  border-bottom: none;
}

.jd-item:hover {
  background: #FFF8F8;
}

.jd-item > .jd-col-check {
  justify-content: center;
}

/* 商品信息 */
.jd-col-product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 8px;
}

.jd-item-img {
  width: 80px;
  height: 80px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--white);
}

.jd-item-img svg {
  width: 100%;
  height: 100%;
}

.jd-item-info {
  flex: 1;
  min-width: 0;
}

.jd-item-name {
  font-size: 12px;
  color: var(--text-dark);
  line-height: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.jd-item-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.tag-priceprotect {
  font-size: 10px;
  color: #FF8C00;
  background: #FFF4E5;
  border: 1px solid #FFDDBC;
  padding: 0 4px;
  border-radius: 2px;
  white-space: nowrap;
}

.tag-aibtn {
  font-size: 10px;
  color: var(--jd-pink);
  background: #FFF0F0;
  border: 1px solid #FFCCCC;
  padding: 0 6px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.tag-aibtn span {
  font-size: 8px;
}

.jd-item-sku {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sku-item {
  font-size: 11px;
  color: var(--text-light);
}

/* 价格列 */
.jd-col-price {
  text-align: center;
  padding: 0 4px;
}

.price-current {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.price-original {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  text-decoration: line-through;
  margin-bottom: 2px;
}

.price-limit {
  display: inline-block;
  font-size: 10px;
  color: var(--jd-red);
  background: #FFF0F0;
  border: 1px solid #FFCCCC;
  padding: 0 4px;
  border-radius: 2px;
}

.price-gift {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--jd-red);
  margin-bottom: 2px;
}

/* 数量列 */
.jd-col-quantity {
  text-align: center;
  padding: 0 4px;
}

.jd-quantity-box {
  display: inline-flex;
  align-items: center;
  border: 1px solid #E0E0E0;
  border-radius: 2px;
  overflow: hidden;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #F7F7F7;
  color: var(--text-medium);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  user-select: none;
}

.qty-btn:hover {
  background: #EDEDED;
  color: var(--text-dark);
}

.qty-input {
  width: 42px;
  height: 28px;
  border: none;
  border-left: 1px solid #E0E0E0;
  border-right: 1px solid #E0E0E0;
  text-align: center;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
}

.qty-gift {
  font-size: 13px;
  color: var(--text-light);
}

/* 小计列 */
.jd-col-subtotal {
  text-align: center;
  padding: 0 4px;
}

.subtotal-price {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--jd-red);
  margin-bottom: 2px;
}

.subtotal-save {
  display: block;
  font-size: 11px;
  color: #FF8C00;
}

/* 操作列 */
.jd-col-ops {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}

.op-link {
  font-size: 11px;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.op-link:hover {
  color: var(--jd-red);
}

/* 赠品行 */
.gift-item {
  background: #FFFCF5;
}

.gift-label {
  font-size: 11px;
  color: #FF8C00;
}

/* ========== 底部结算栏 ========== */
.jd-checkout-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 3px solid var(--jd-red);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  z-index: 100;
}

.jd-checkout-inner {
  max-width: 1190px;
  margin: 0 auto;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.jd-checkout-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-medium);
}

.checkout-sep {
  color: #ddd;
}

.checkout-op {
  color: var(--text-medium);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s;
}

.checkout-op:hover {
  color: var(--jd-red);
}

.jd-checkout-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkout-count {
  font-size: 12px;
  color: var(--text-medium);
}

.checkout-num {
  color: var(--jd-red);
  font-weight: bold;
  font-style: normal;
}

.checkout-total {
  font-size: 20px;
  font-weight: bold;
  color: var(--jd-red);
}

.checkout-save {
  font-size: 12px;
  color: #FF8C00;
}

.checkout-save em {
  font-style: normal;
  font-weight: bold;
}

.jd-checkout-btn {
  padding: 0 40px;
  height: 60px;
  background: var(--jd-red);
  color: var(--white);
  border: none;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.2s;
  margin: 0;
}

.jd-checkout-btn:hover {
  background: var(--jd-red-dark);
}

/* ========== 移动端适配 ========== */
@media (max-width: 900px) {
  .jd-cart-header {
    grid-template-columns: 50px 1fr 100px 100px;
  }

  .jd-col-price,
  .jd-col-ops {
    display: none;
  }

  .jd-item {
    grid-template-columns: 50px 1fr 100px 100px;
    padding: 12px;
  }

  .jd-col-price,
  .jd-col-ops {
    display: none;
  }

  .jd-col-product {
    flex-direction: column;
    align-items: flex-start;
  }

  .jd-item-img {
    width: 70px;
    height: 70px;
  }

  .jd-search-area {
    display: none;
  }

  .jd-navbar-inner {
    padding: 8px 10px;
  }

  .jd-shop-notice {
    display: none;
  }
}

@media (max-width: 640px) {
  .jd-cart-header {
    grid-template-columns: 44px 1fr 90px 90px;
    font-size: 11px;
    padding: 8px 10px;
  }

  .jd-item {
    grid-template-columns: 44px 1fr 90px 90px;
    padding: 10px;
    gap: 8px;
  }

  .jd-item-img {
    width: 60px;
    height: 60px;
  }

  .jd-item-name {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .jd-shop-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .jd-shop-notice {
    display: none;
  }

  .checkout-save {
    display: none;
  }

  .jd-checkout-btn {
    padding: 0 24px;
    font-size: 16px;
    height: 60px;
  }

  .jd-logo-text {
    display: none;
  }

  .jd-checkout-left {
    gap: 4px;
  }

  .checkout-op {
    font-size: 11px;
  }
}
