/* 优惠码小助手 - 商品订购页悬浮助手 */
.promo-code-helper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.promo-code-helper *,
.promo-code-helper *::before,
.promo-code-helper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/* 机器人悬浮按钮 - 默认居中, 可拖动 */
.pch-robot-btn {
  position: fixed;
  right: 24px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999991;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  cursor: grab;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(31, 45, 61, 0.18);
  border: 2px solid #e8f1ff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s ease;
  overflow: visible;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pch-robot-btn:hover {
  box-shadow: 0 10px 28px rgba(31, 45, 61, 0.28);
}
.pch-robot-btn.pch-dragging {
  cursor: grabbing;
  box-shadow: 0 14px 34px rgba(31, 45, 61, 0.32);
}
.pch-robot-btn.pch-dragged {
  transform: none;
}
.pch-robot-btn img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  animation: pch-breathe 3s ease-in-out infinite;
}
.pch-robot-btn.pch-dragging img,
.pch-robot-btn.pch-dragged img {
  animation: none;
}
/* 图片下方展示文字 - 竖向 (阿里云风格) */
.pch-banner-text {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  white-space: nowrap;
  padding: 7px 4px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 500;
  letter-spacing: 3px;
  color: #1c2b52;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid #d9e4fb;
  box-shadow: 0 4px 12px rgba(28, 43, 82, 0.12);
  pointer-events: none;
}
/* 弹窗 */
.pch-panel {
  position: fixed;
  z-index: 999992;
  width: 380px;
  max-height: 540px;
  display: none;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(31, 45, 61, 0.22);
  overflow: hidden;
  animation: pch-slide-up 0.28s ease;
}
.pch-panel.pch-show {
  display: flex;
}
.pch-panel-head {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, #5b8df0 0%, #3a6fe0 100%);
  color: #fff;
}
.pch-head-robot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  margin-right: 10px;
  flex-shrink: 0;
}
.pch-head-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}
.pch-head-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.2s ease;
}
.pch-head-close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.pch-panel-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pch-prompt {
  margin: 12px 16px 4px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #eef4ff 0%, #f6f9ff 100%);
  border: 1px dashed #b8ccf0;
  border-radius: 10px;
  color: #3a5a9e;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.pch-prompt::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 8px;
  background: radial-gradient(circle at 30% 30%, #ffd05c 35%, #ff9d2f 70%);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset -2px -2px 3px rgba(180, 90, 0, 0.25);
}
.pch-list {
  overflow-y: auto;
  padding: 8px 16px 16px;
  max-height: 400px;
}
.pch-list::-webkit-scrollbar {
  width: 6px;
}
.pch-list::-webkit-scrollbar-thumb {
  background: #d8e2f5;
  border-radius: 3px;
}
.pch-list::-webkit-scrollbar-track {
  background: transparent;
}
.pch-empty {
  text-align: center;
  padding: 40px 0 30px;
  color: #9aa5b5;
  font-size: 13px;
}
.pch-empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
  opacity: 0.5;
}
/* 优惠码卡片 */
.pch-card {
  position: relative;
  display: flex;
  margin-top: 12px;
  border-radius: 12px;
  background: #f7f9fc;
  border: 1px solid #edf1f7;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.pch-card:hover {
  box-shadow: 0 6px 16px rgba(31, 45, 61, 0.1);
  transform: translateY(-1px);
}
.pch-card.pch-card-used {
  opacity: 0.62;
}
.pch-card.pch-card-used:hover {
  transform: none;
  box-shadow: none;
}
/* 类型配色 */
.pch-card-type-percent {
  background: linear-gradient(135deg, #eef4ff 0%, #f9fbff 55%);
  border-color: #d6e2fb;
}
.pch-card-type-fixed_amount {
  background: linear-gradient(135deg, #fff4e8 0%, #fffaf4 55%);
  border-color: #fbe3c8;
}
.pch-card-type-replace_price {
  background: linear-gradient(135deg, #e9f9f0 0%, #f6fdf9 55%);
  border-color: #cdeede;
}
.pch-card-type-free {
  background: linear-gradient(135deg, #ffeef0 0%, #fff8f8 55%);
  border-color: #f7d4d8;
}
.pch-card-left {
  width: 96px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  position: relative;
}
.pch-card-left::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e3e9f2;
}
.pch-discount {
  font-size: 20px;
  font-weight: 700;
  color: #1f2d3d;
  line-height: 1.2;
  text-align: center;
}
.pch-card-type-percent .pch-discount { color: #3a6fe0; }
.pch-card-type-fixed_amount .pch-discount { color: #ed7b2f; }
.pch-card-type-replace_price .pch-discount { color: #2fae67; }
.pch-card-type-free .pch-discount { color: #e0404f; }
.pch-type-label {
  margin-top: 4px;
  font-size: 11px;
  color: #8a94a6;
  text-align: center;
}
.pch-card-right {
  flex: 1;
  padding: 12px 14px 12px 14px;
  min-width: 0;
}
.pch-code-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pch-code-text {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 15px;
  font-weight: 600;
  color: #1f2d3d;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pch-copy-btn {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #c9d6ef;
  color: #3a6fe0;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pch-copy-btn:hover {
  background: #eef4ff;
}
.pch-copy-btn.pch-copied {
  color: #2fae67;
  border-color: #2fae67;
  background: #e9f9f0;
}
.pch-info {
  margin-top: 7px;
  font-size: 12px;
  color: #7a8598;
  line-height: 1.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pch-info b {
  color: #4a5568;
  font-weight: 500;
}
.pch-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pch-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  background: #eef1f6;
  color: #5a6577;
}
.pch-tag-green { background: #e9f9f0; color: #2fae67; }
.pch-tag-blue { background: #eef4ff; color: #3a6fe0; }
.pch-tag-orange { background: #fff4e8; color: #ed7b2f; }
.pch-tag-red { background: #ffeef0; color: #e0404f; }
.pch-tag-vip { background: linear-gradient(135deg, #ffe9a8, #ffd05c); color: #8a5a00; }
.pch-tag-applicable { background: linear-gradient(135deg, #e9f9f0, #d3f0e0); color: #1e8e4e; }
.pch-card-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.pch-use-btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-size: 13px;
  padding: 5px 18px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #5b8df0 0%, #3a6fe0 100%);
  box-shadow: 0 3px 8px rgba(58, 111, 224, 0.35);
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.pch-use-btn:hover { opacity: 0.9; }
.pch-use-btn:active { transform: scale(0.97); }
.pch-use-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}
.pch-used-btn {
  border: 1px solid #d8dde6;
  background: #f1f3f7;
  color: #8a94a6;
  cursor: not-allowed;
  font-size: 13px;
  padding: 4px 18px;
  border-radius: 8px;
}
/* 提示消息 */
.pch-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999993;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.pch-toast-item {
  min-width: 180px;
  max-width: 300px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(31, 45, 61, 0.2);
  animation: pch-slide-up 0.25s ease;
}
.pch-toast-success { background: #2fae67; }
.pch-toast-error { background: #e0404f; }
.pch-toast-info { background: #3a6fe0; }
.pch-toast-warn { background: #ed7b2f; }
/* 加载态 */
.pch-loading {
  text-align: center;
  padding: 30px 0;
  color: #9aa5b5;
  font-size: 13px;
}
.pch-loading::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  vertical-align: -6px;
  border: 2px solid #d8e2f5;
  border-top-color: #3a6fe0;
  border-radius: 50%;
  animation: pch-spin 0.8s linear infinite;
}
/* 动画 */
@keyframes pch-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes pch-slide-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pch-spin {
  to { transform: rotate(360deg); }
}
/* 移动端适配 */
@media (max-width: 767px) {
  .pch-robot-btn {
    width: 56px;
    height: 56px;
    right: 12px;
  }
  .pch-robot-btn img {
    width: 46px;
    height: 46px;
  }
  .pch-banner-text {
    font-size: 12px;
    letter-spacing: 2px;
    padding: 6px 3px;
    top: calc(100% + 8px);
  }
  .pch-panel {
    width: calc(100vw - 24px);
    max-height: 70vh;
  }
  .pch-list {
    max-height: 52vh;
  }
  .pch-toast {
    top: 16px;
  }
}
/* 分组、置顶、倒计时、受限 */
.pch-group { margin-bottom: 6px; }
.pch-group-title { font-size: 12px; color: #8a93a5; padding: 8px 4px 2px; font-weight: 600; }
.pch-tag-top { background: #fff7e6; color: #b26a00; border: 1px solid #ffd591; }
.pch-tag-countdown { background: #fff1e8; color: #d24a2b; }
.pch-tag-countdown-urgent { background: #ffe4e4; color: #d81e06; animation: pch-blink 1.2s ease-in-out infinite; }
@keyframes pch-blink { 50% { opacity: 0.55; } }
.pch-card-restricted .pch-card-left, .pch-card-restricted .pch-code-text { opacity: 0.55; }
.pch-use-btn-disabled { background: #f3f4f6 !important; color: #a3aab8 !important; cursor: not-allowed !important; }
.pch-code-text { cursor: pointer; border-bottom: 1px dashed transparent; transition: border-color .2s, color .2s; }
.pch-code-text:hover { color: #2f6bff; border-bottom-color: #2f6bff; }
.pch-card-restricted .pch-code-text:hover { color: #a3aab8; border-bottom-color: transparent; }
/* 分页 */
.pch-pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 4px; }
.pch-page-btn { font-size: 12px; line-height: 1; padding: 5px 10px; border: 1px solid #d9dee7; border-radius: 4px; background: #fff; color: #4b5563; cursor: pointer; transition: border-color .2s, color .2s; }
.pch-page-btn:hover:not(:disabled) { color: #2f6bff; border-color: #2f6bff; }
.pch-page-btn:disabled { color: #c0c6d0; cursor: not-allowed; background: #f8f9fb; }
.pch-page-info { font-size: 12px; color: #8a93a5; min-width: 44px; text-align: center; }
