/* ===================================================================
   shoppingCar.css — 购物车页 cany_spike 主题样式
   对齐 spike-layout / spike-components / settlement.css 设计系统
   =================================================================== */

/* ===== 英雄卡片 ===== */
.sc-hero {
  background: var(--color-card-bg);
  border-radius: var(--spike-radius);
  box-shadow: var(--shadow-card);
  padding: 20px 28px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sc-hero-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sc-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--spike-radius);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sc-hero-icon svg {
  width: 22px;
  height: 22px;
}

.sc-hero-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.sc-hero-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* ===== 搜索框 ===== */
.sc-search {
  width: 280px;
  flex-shrink: 0;
}

.sc-search .el-input__inner {
  height: 38px !important;
  line-height: 38px !important;
}

/* ===== 商品列表容器 ===== */
.goods-box {
  padding-bottom: 140px;
}

.goods-box .discount-code-number {
  padding-top: 0;
  padding-bottom: 0;
}

/* ===== 每个商品块：独立卡片（对齐 settlement.css）===== */
.shopping-goods {
  background: var(--color-card-bg);
  border-radius: var(--spike-radius);
  box-shadow: var(--shadow-card);
  padding: 24px 28px;
  margin-bottom: 16px;
}

/* ===== 商品名称行（卡片顶部标题行）===== */
.table-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.goods-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.el-link.el-link--primary {
  color: var(--color-primary);
  font-size: 13px;
}

.mar-left-24 {
  margin-left: 24px;
}

/* ===== 表格区域 ===== */
.table-content {
  font-size: 14px;
}

.goods-table {
  width: 100%;
  text-align: left;
  border-collapse: separate;
  border-spacing: 0;
}

.goods-table thead th {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  white-space: nowrap;
}

.goods-table tbody tr td {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.goods-table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== 列宽分配（百分比，自适应宽度）===== */
.description-box {
  width: 40%;
}

.price-box {
  width: 18%;
}

.num-box {
  width: 18%;
}

.total-box {
  width: 14%;
  white-space: nowrap;
}

.action-box {
  width: 10%;
}

/* ===== 配置项信息行 ===== */
.info-box {
  width: 100%;
}

.goods-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 8px;
}

.goods-info:last-child {
  margin-bottom: 0;
}

.goodsInfo-type {
  overflow: hidden;
  text-overflow: ellipsis;
  /* white-space: nowrap; */
  flex: 1;
  color: var(--color-text-primary);
}

.goodsInfo-name {
  color: var(--color-text-secondary);
}

.goodsInfo-val {
  color: var(--color-text-primary);
}

.goodsInfo-price {
  color: var(--color-text-primary);
  flex-shrink: 0;
  margin-left: 12px;
}

/* ===== 单价列 ===== */
.item-price {
  color: var(--color-text-primary);
  font-size: 14px;
  white-space: nowrap;
}

.item-price .price {
  font-weight: 600;
}

.item-price .default-color {
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* ===== 小计列 ===== */
.item-total {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.original-price {
  display: block;
  text-decoration: line-through;
  color: var(--color-text-secondary);
  font-weight: 400;
  font-size: 13px;
  margin-top: 4px;
}

.total-icon {
  color: var(--color-text-secondary);
  margin-left: 4px;
  cursor: pointer;
}

.show-config-list p {
  font-size: 13px;
  color: var(--color-text-primary);
  margin: 4px 0;
}

/* ===== 操作列 ===== */
.delete-btn {
  cursor: pointer;
  font-size: 18px;
  color: var(--color-danger);
}

/* ===== 优惠码区域 ===== */
.discount-box {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 400;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 5px;
  row-gap: 5px;
}

.discount-codeNumber {
  font-size: 12px;
  font-weight: bold;
  color: var(--color-discount-num);
}

.remove-discountCode {
  cursor: pointer;
  margin-left: 9px;
}

/* ===== 商品失效状态 ===== */
.no-goods-td {
  display: flex;
  align-items: center;
}

.no-goods-tips {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.buy-again-btn {
  margin-left: 10px;
  background: var(--color-primary-light);
  height: 32px;
  min-width: 60px;
  border-radius: var(--spike-radius);
  font-size: 14px;
  font-weight: 400;
  color: var(--color-primary);
}

/* ===== 数量自定义控件（Spike mf-qty-custom 风格）===== */
.sc-qty-ctrl {
  display: flex;
  align-items: center;
  width: 130px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--spike-radius);
  overflow: hidden;
}

.sc-qty-btn {
  flex-shrink: 0;
  width: 36px;
  height: 40px;
  background: #fff;
  border: none;
  font-size: 18px;
  font-weight: 300;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s;
  outline: none;
  user-select: none;
}

.sc-qty-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.sc-qty-num {
  flex: 1;
  min-width: 0;
  border-left: 1px solid var(--color-border);
}

.sc-qty-num.el-input-number {
  width: auto !important;
  height: 40px;
  line-height: 40px;
}

.sc-qty-num .el-input {
  height: 40px;
}

.sc-qty-num .el-input__inner {
  border: none !important;
  border-radius: var(--spike-radius) !important;
  height: 40px !important;
  line-height: 40px !important;
  text-align: center !important;
  padding: 0 !important;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.sc-qty-plus {
  border-left: 1px solid var(--color-border);
}

/* ===== 库存提示 ===== */
.qty-num {
  color: var(--color-text-secondary);
  font-size: 13px;
  margin-top: 8px;
}

.qty-tips {
  margin-top: 16px;
  font-size: 13px;
  color: var(--color-info);
}

/* ===== 工具类 ===== */
.red-text {
  color: var(--color-danger);
}

.text-red {
  color: var(--color-primary);
}

/* ===== 空状态卡片 ===== */
.sc-empty-card {
  background: var(--color-card-bg);
  border-radius: var(--spike-radius);
  box-shadow: var(--shadow-card);
  padding: 48px 28px;
}

/* ===================================================================
   固定底部结算栏（el-footer）— 浮动卡片式，对齐 settlement.css
   left: sidebar-width + content-left-gap(40px)
   =================================================================== */
.el-footer {
  position: fixed !important;
  bottom: 20px;
  left: calc(var(--sidebar-width, 270px) + 40px);
  right: 20px;
  min-height: 72px;
  height: auto !important;
  padding: 0 32px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  background-color: var(--color-card-bg);
  border-radius: var(--spike-radius);
  box-shadow: var(--shadow-card);
  z-index: 99;
}

.footer-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}

/* ===== 左侧：全选 + 删除 + 已选件数 ===== */
.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--color-text-primary);
  font-size: 14px;
  flex-shrink: 0;
}

.all-check .el-checkbox__label {
  color: var(--color-text-primary);
  font-size: 14px;
}

.delect-goods {
  color: var(--color-primary) !important;
  font-size: 14px;
}

.delect-goods:hover,
.delect-goods:focus {
  color: var(--color-primary) !important;
  opacity: 0.82;
}

.selected-count {
  color: var(--color-text-secondary);
  font-size: 14px;
  white-space: nowrap;
}

/* ===== 右侧：合计 + 结算按钮 ===== */
.footer-right {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.totalprice-box {
  white-space: nowrap;
  font-size: 14px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.total-price {
  font-weight: 700;
  font-size: 26px;
  color: var(--color-price-text, var(--color-primary));
  letter-spacing: -0.02em;
}

.buy-btn {
  height: 46px !important;
  padding: 0 36px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

/* ===================================================================
   响应式
   =================================================================== */
@media screen and (max-width: 1200px) {
  .el-footer {
    padding: 0 20px;
  }

  .footer-box {
    gap: 16px;
  }

  .footer-right {
    gap: 16px;
  }
}

/* ===================================================================
   动画与交互增强
   =================================================================== */

/* ===== Keyframes ===== */
@keyframes scCardEnter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cartIconBounce {
  0%,
  80%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  85% {
    transform: translateY(-6px) rotate(-8deg);
  }
  92% {
    transform: translateY(-3px) rotate(5deg);
  }
  96% {
    transform: translateY(-1px) rotate(-2deg);
  }
}

@keyframes footerSlideUp {
  from {
    opacity: 0;
    transform: translateY(36px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes priceFlashIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 英雄图标弹跳动画 ===== */
.sc-hero-icon svg {
  animation: cartIconBounce 4.5s ease-in-out infinite;
  transform-origin: center bottom;
}

/* ===== 商品卡片入场 + hover 浮起（统一扩展原 .shopping-goods 规则）===== */
.shopping-goods {
  animation: scCardEnter 0.35s ease both;
  transition:
    box-shadow 0.22s ease,
    transform 0.22s ease,
    border-left-color 0.2s ease;
}

.shopping-goods:nth-child(1) {
  animation-delay: 0.05s;
}
.shopping-goods:nth-child(2) {
  animation-delay: 0.13s;
}
.shopping-goods:nth-child(3) {
  animation-delay: 0.21s;
}
.shopping-goods:nth-child(4) {
  animation-delay: 0.29s;
}
.shopping-goods:nth-child(5) {
  animation-delay: 0.37s;
}
.shopping-goods:nth-child(6) {
  animation-delay: 0.45s;
}
.shopping-goods:nth-child(7) {
  animation-delay: 0.53s;
}
.shopping-goods:nth-child(8) {
  animation-delay: 0.61s;
}

.shopping-goods:hover {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

/* ===== 选中态：左边框 + 背景淡染 ===== */
.shopping-goods.is-checked {
  border-left: 3px solid var(--color-primary);
  padding-left: 25px;
  background: linear-gradient(
    to right,
    rgba(var(--spike-primary-rgb), 0.045) 0%,
    var(--color-card-bg) 64px
  );
}

/* ===== 删除按钮 hover ===== */
.delete-btn i {
  display: inline-block;
  transition: transform 0.2s ease;
}

.delete-btn:hover i {
  transform: scale(1.25);
}

/* ===== 数量按钮 click 缩放反馈 ===== */
.sc-qty-btn:active {
  transform: scale(0.82);
  transition: transform 0.08s ease;
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ===== 小计金额入场动效（价格刷新时 span 重渲染触发）===== */
.item-total > span:first-child {
  display: inline-block;
  animation: priceFlashIn 0.28s ease both;
}

/* ===== footer 入场动效 ===== */
.el-footer {
  animation: footerSlideUp 0.42s ease-out 0.15s both;
}

/* ===== 结算按钮 hover 增强 ===== */
.buy-btn.el-button--primary:not(.is-loading):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(var(--spike-primary-rgb), 0.45) !important;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

/* ===== 修改配置链接 hover ===== */
.el-link.el-link--primary.edit-goods:hover {
  opacity: 0.72;
  text-decoration: underline;
}

/* ===== transition-group 列表动画（搜索过滤）===== */
.sc-list-enter-active {
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

.sc-list-leave-active {
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  position: absolute; 
  width: 100%;
} 
  
.sc-list-enter,
.sc-list-leave-to {
  opacity: 0; 
  transform: translateY(10px);
} 

@media screen and (max-width: 750px) {
  /* el-main 保留左右12px，与会员中心统一 */
  .el-container:nth-child(2) > .el-main {
    margin: 0 !important;
    padding: 0 12px !important;
    border-radius: var(--spike-radius) !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .sc-hero {
    flex-wrap: wrap;
    padding: 16px 14px;
  }

  .sc-hero-left {
    gap: 12px;
  }

  .sc-hero-icon {
    width: 40px;
    height: 40px;
  }

  .sc-hero-icon svg {
    width: 20px;
    height: 20px;
  }

  .sc-hero-title {
    font-size: 16px;
  }

  .sc-search {
    width: 100%;
  }

  /* ===== 商品卡片手机端适配 ===== */
  .shopping-goods {
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
  }

  /* 标题行：商品名 + 删除按钮 */
  .table-name {
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    padding-right: 36px; /* 给删除按钮留空间 */
    position: relative;
  }

  .goods-name {
    font-size: 15px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 表格改为卡片式布局 */
  .goods-table {
    display: block;
  }

  .goods-table thead {
    display: none;
  }

  .goods-table tbody {
    display: block;
  }

  .goods-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .goods-table tbody tr td {
    display: block;
    padding: 0;
    border-bottom: none;
    width: 100% !important;
  }

  /* 删除按钮 - 卡片右上角（相对shopping-goods定位） */
  .shopping-goods {
    position: relative !important;
  }
  .shopping-goods td.delete-btn {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 100 !important;
    width: auto !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }
  .shopping-goods td.delete-btn i.el-icon-delete {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: var(--spike-radius);
    font-size: 16px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
  }
  .shopping-goods td.delete-btn i.el-icon-delete:hover {
    color: var(--color-danger);
    background: var(--color-danger-light, #ffefed);
  }

  /* 配置详情区域 */
  .goods-info {
    margin-bottom: 6px;
    font-size: 13px;
  }

  .goodsInfo-name {
    font-size: 12px;
  }

  .goodsInfo-price {
    font-size: 13px;
    margin-left: 8px;
  }

  /* 价格行 */
  .item-price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
  }

  .item-price::before {
    content: attr(data-label);
    color: var(--color-text-secondary);
    font-size: 12px;
  }

  /* 数量行 */
  .sc-qty-ctrl {
    width: 110px;
    height: 36px;
  }

  .sc-qty-btn {
    width: 32px;
    height: 36px;
    font-size: 16px;
  }

  .sc-qty-num.el-input-number {
    height: 36px;
    line-height: 36px;
  }

  .sc-qty-num .el-input__inner {
    height: 36px !important;
    line-height: 36px !important;
  }

  /* 小计行 */
  .item-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
  }

  .item-total::before {
    content: "小计";
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: normal;
  }

  /* 小计行 + 删除按钮并排 */
  .total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .item-total {
    flex: 1;
  }

  /* 优惠码区域优化 */
  .discount-box {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  /* 使用优惠码按钮（span.discount-text） */
  .discount-box .discount-text {
    display: inline-flex !important;
    align-items: center !important;
    height: 40px !important;
    padding: 0 20px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: var(--spike-radius) !important;
    border: 1px solid var(--color-primary) !important;
    color: var(--color-primary) !important;
    background: transparent !important;
    cursor: pointer !important;
  }
  .discount-box .discount-text:hover {
    background: var(--color-primary-light) !important;
  }
  /* 已应用优惠码 */
  .discount-box .discount-code-number {
    font-size: 14px !important;
    padding: 6px 12px !important;
    background: var(--color-primary-light) !important;
    border-radius: var(--spike-radius) !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .discount-box .remove-discountCode {
    font-size: 16px !important;
    cursor: pointer !important;
    color: var(--color-text-secondary) !important;
  }
  .discount-codeNumber {
    font-size: 14px;
    padding: 6px 12px;
    background: var(--color-primary-light);
    border-radius: var(--spike-radius);
    font-weight: 500;
  }
  .remove-discountCode {
    margin-left: 8px;
    font-size: 16px;
    cursor: pointer;
    color: var(--color-text-secondary);
  }
  .remove-discountCode:hover {
    color: var(--color-danger);
  }
  /* ===== 底部结算栏手机端适配 ===== */
  .el-footer {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 12px 16px;
    border-radius: var(--spike-radius);
  }

  .footer-box {
    flex-direction: column;
    gap: 12px;
    padding: 12px 0;
  }

  .footer-left {
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }

  .all-check .el-checkbox__label {
    font-size: 13px;
  }

  .delect-goods {
    font-size: 13px;
  }

  .selected-count {
    font-size: 13px;
  }

  .footer-right {
    justify-content: space-between;
    width: 100%;
    gap: 12px;
  }

  .totalprice-box {
    font-size: 13px;
  }

  .total-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
  }

  .buy-btn {
    height: 46px !important;
    padding: 0 48px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: var(--spike-radius) !important;
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb, var(--spike-primary-rgb)), 0.35) !important;
    letter-spacing: 0.5px !important;
  }

  /* 弹窗移动端适配 */
  .el-dialog {
    width: 92vw !important;
    margin: 4vh auto !important;
  }
  .el-dialog__body {
    padding: 16px 20px !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
  }
  .el-dialog__footer {
    padding: 12px 20px 16px !important;
  }
  .el-dialog__footer .el-button {
    height: 44px !important;
    font-size: 14px !important;
  }

  /* 优惠码弹窗手机端适配 */
  .discount-content {
    width: auto !important;
    height: auto !important;
    padding: 20px !important;
    min-width: 260px !important;
  }
  .discount-content .close-btn-img {
    top: 12px !important;
    right: 12px !important;
    width: 24px !important;
    height: 24px !important;
  }
  .discount-content .discount-input {
    width: 100% !important;
    max-width: 200px !important;
    font-size: 15px !important;
  }
  .discount-content .discount-input .el-input__inner {
    height: 44px !important;
    line-height: 44px !important;
    font-size: 15px !important;
  }
  .discount-content .discount-btn {
    width: auto !important;
    min-width: 80px !important;
    height: 44px !important;
    font-size: 15px !important;
    margin-left: 10px !important;
    padding: 0 16px !important;
  }
}
