/* ==========================================================================
   悬浮购物车快捷版块（产品列表页 / 产品配置页）  v=20261126c
   - 只新增独立组件，不改动购物车既有卡片、底栏与提交流程
   - 默认停在右下角；整块可拖（桌面与触屏同一套手势），松手靠近边缘时吸附
   - 拖动中关闭过渡、跟随指针；松手吸附时单独开启短过渡
   - 长按约 0.8s 复位到默认位置（页面内有反馈）
   - 数量由 floating-cart.js 读取购物车页商品行后回填
   ========================================================================== */

.nq-floatcart {
  --nq-fc-right: 24px;
  --nq-fc-bottom: 24px;
  position: fixed;
  right: var(--nq-fc-right);
  bottom: var(--nq-fc-bottom);
  z-index: 900;
  display: flex;
  align-items: stretch;
  padding: 5px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.075);
  border-radius: 999px;
  box-shadow: 0 12px 30px -16px rgba(15, 23, 42, 0.4), 0 2px 6px rgba(15, 23, 42, 0.05);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--nq-text-1, #1f2329);
  font-size: 13px;
  line-height: 1;
  cursor: grab;
  /* 整块可拖：不再依赖右侧手柄，触屏在此区域内不触发页面滚动 */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: box-shadow 0.2s ease;
  will-change: left, top;
}

.nq-floatcart:hover {
  box-shadow: 0 16px 36px -16px rgba(15, 23, 42, 0.45), 0 3px 8px rgba(15, 23, 42, 0.06);
}

/* 拖动中：取消过渡，压住选中与 hover 位移，避免跟手延迟 */
.nq-floatcart.is-dragging {
  transition: none;
  box-shadow: 0 20px 44px -18px rgba(15, 23, 42, 0.5);
  cursor: grabbing;
}

/* 松手吸附：只给 left/top 一段短过渡 */
.nq-floatcart.is-snapping {
  transition: left 0.24s cubic-bezier(0.22, 0.61, 0.36, 1),
    top 0.24s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.2s ease;
}

/* 长按复位前 / 复位完成时的反馈 */
.nq-floatcart.is-holding {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08), 0 12px 30px -16px rgba(15, 23, 42, 0.4);
  cursor: grabbing;
}

body.nq-floatcart-dragging {
  -webkit-user-select: none;
  user-select: none;
  cursor: grabbing;
}

/* ---------- 主体：点击进入购物车 ---------- */

.nq-floatcart-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 12px 3px 3px;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  cursor: pointer;
}

.nq-floatcart-link:hover,
.nq-floatcart-link:focus {
  color: inherit;
  text-decoration: none;
}

.nq-floatcart-link:focus-visible {
  outline: 2px solid rgb(var(--arcoblue-6, 22, 93, 255));
  outline-offset: 2px;
}

.nq-floatcart-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(var(--arcoblue-6, 22, 93, 255), 0.12);
  color: rgb(var(--arcoblue-6, 22, 93, 255));
  font-size: 18px;
}

.nq-floatcart-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f53f3f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  box-shadow: 0 0 0 2px #fff;
}

.nq-floatcart-badge[hidden] {
  display: none;
}

.nq-floatcart-badge[data-empty="1"] {
  background: #c9cdd4;
}

.nq-floatcart-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.nq-floatcart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--nq-text-1, #1f2329);
  letter-spacing: 0;
}

.nq-floatcart-sub {
  font-size: 11px;
  color: var(--nq-text-3, #86909c);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- 小屏：只留图标与徽标，避免压住内容 ---------- */

@media (max-width: 575.98px) {
  .nq-floatcart {
    --nq-fc-right: 12px;
    padding: 4px;
  }

  .nq-floatcart-link {
    gap: 0;
    padding: 2px;
  }

  .nq-floatcart-icon {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .nq-floatcart-text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nq-floatcart,
  .nq-floatcart.is-snapping {
    transition: none;
  }
}

@media print {
  .nq-floatcart {
    display: none !important;
  }
}
