/* ========================================================================
   全站右侧浮窗客服（参考"咨询抢 7 折特惠"风格 + 主流电商最先进功能）
   - 胶囊主按钮（可关闭/展开）
   - 5 项工具：订单查询 / 询价 IM / 个人中心 / 微信扫码加微 / 电话回拨
   - 回到顶部
   - IM 弹窗：点开直接显示「您好，请描述您的需求」+ 预设问题 + 联系信息
   - 智能招呼：停留 8s 弹「还在选吗？给你专属报价」
   - 离开挽留：监听 mouseleave
   - 移动端：横排吸底，不占右侧
   ======================================================================== */
.stk {
  position: fixed; right: 16px; bottom: 24px; z-index: 9998;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.stk * { box-sizing: border-box; }

/* 主按钮（胶囊样式） */
.stk-main {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 10px 10px; border: none; cursor: pointer;
  background: #e1251b;
  color: #fff; font-size: 14px; font-weight: 600; line-height: 1;
  border-radius: 999px; box-shadow: 0 8px 22px rgba(225, 37, 27, .35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.stk-main:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(225, 37, 27, .45); }
.stk-main .stk-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  color: #e1251b; font-weight: 800; font-size: 16px;
  box-shadow: 0 0 0 2px #fff; overflow: hidden;
}
.stk-main .stk-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stk-main .stk-discount {
  background: #ffe14d; color: #7a0c12; font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px; letter-spacing: .5px;
}
.stk-main .stk-tip {
  position: absolute; right: -6px; top: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; color: #999; font-size: 12px; line-height: 18px;
  text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.15);
  cursor: pointer; user-select: none;
}
.stk-main .stk-tip:hover { background: #f5f5f5; color: #333; }
.stk.closed .stk-main { display: none; }
.stk.closed .stk-fab { display: flex; }
.stk-fab {
  display: none; width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: #e1251b;
  color: #fff; box-shadow: 0 8px 22px rgba(225, 37, 27, .35);
  align-items: center; justify-content: center; position: relative;
}
.stk-fab .stk-pulse {
  position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #e1251b;
  animation: stk-pulse 2s ease-out infinite; pointer-events: none;
}
@keyframes stk-pulse {
  0% { transform: scale(.95); opacity: .8; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* 工具列 */
.stk-tools {
  display: flex; flex-direction: column; gap: 6px;
  background: #fff; border-radius: 14px; padding: 8px 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  border: 1px solid #eef0f5;
}
.stk-tool {
  width: 46px; height: 46px; border: none; background: transparent; cursor: pointer;
  border-radius: 10px; color: #475569; font-size: 11px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: all .15s ease; position: relative; line-height: 1.1;
}
.stk-tool:hover { background: #fff5f4; color: #e1251b; }
.stk-tool svg { width: 20px; height: 20px; }
.stk-tool .stk-new {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #e1251b; color: #fff; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #fff;
}
.stk-tool-top {
  margin-top: 4px; padding-top: 8px; border-top: 1px solid #eef0f5;
  font-size: 9px; letter-spacing: .5px;
}

/* IM 弹窗 */
.stk-im {
  position: fixed; right: 84px; bottom: 24px; z-index: 9999;
  width: 460px; max-width: calc(100vw - 110px); height: 660px; max-height: calc(100vh - 60px);
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 16px 50px rgba(15, 23, 42, .25);
  border: 1px solid #eef0f5;
  display: none; flex-direction: column;
  animation: stk-im-in .25s ease;
}
.stk-im.open { display: flex; }
@keyframes stk-im-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.stk-im-head {
  background: #e1251b; color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.stk-im-head .stk-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff;
  color: #e1251b; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; }
.stk-im-head .stk-meta { flex: 1; }
.stk-im-head .stk-meta b { font-size: 15px; }
.stk-im-head .stk-meta div { font-size: 12px; opacity: .9; margin-top: 2px; }
.stk-im-head .stk-close { background: transparent; border: none; color: #fff; cursor: pointer; font-size: 20px; opacity: .85; }
.stk-im-head .stk-close:hover { opacity: 1; }

.stk-im-body {
  flex: 1; min-height: 160px; overflow-y: auto; padding: 14px;
  background: #fafbfc; display: flex; flex-direction: column; gap: 10px;
}
.stk-msg { max-width: 78%; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.55; word-break: break-word; }
.stk-msg.bot { background: #fff; border: 1px solid #eef0f5; color: #1f2937; align-self: flex-start; border-top-left-radius: 2px; }
.stk-msg.user { background: #e1251b; color: #fff; align-self: flex-end; border-top-right-radius: 2px; }
.stk-msg .stk-time { display: block; font-size: 10px; color: #94a3b8; margin-top: 4px; }
.stk-msg.user .stk-time { color: rgba(255,255,255,.7); }

.stk-typing { display: inline-flex; gap: 4px; align-items: center; }
.stk-typing i { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; animation: stk-bounce 1.2s ease-in-out infinite; }
.stk-typing i:nth-child(2) { animation-delay: .15s; }
.stk-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes stk-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.stk-im-quick { padding: 10px 14px; border-top: 1px solid #eef0f5; background: #fff; }
.stk-im-quick-tip { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }
.stk-im-quick-grid { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.stk-im-quick-grid::-webkit-scrollbar { height: 4px; }
.stk-im-quick-grid::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.stk-im-quick button { flex: 0 0 auto; padding: 6px 12px; border: 1px solid #eef0f5; background: #f8fafc; border-radius: 999px; font-size: 12px; color: #475569; cursor: pointer; white-space: nowrap; transition: all .15s; }
.stk-im-quick button:hover { background: #fff5f4; color: #e1251b; border-color: #e1251b; }

.stk-im-foot { padding: 10px 12px; border-top: 1px solid #eef0f5; background: #fff; display: flex; gap: 8px; }
.stk-im-foot input { flex: 1; padding: 9px 12px; border: 1px solid #eef0f5; border-radius: 20px; font-size: 13px; outline: none; }
.stk-im-foot input:focus { border-color: #e1251b; }
.stk-im-foot button { padding: 8px 16px; background: #e1251b; color: #fff; border: none; border-radius: 20px; font-size: 13px; cursor: pointer; font-weight: 600; }
.stk-im-foot button:hover { background: #c91d14; }

/* 微信二维码弹窗 */
.stk-modal { position: fixed; inset: 0; z-index: 10000; background: rgba(15,23,42,.6); display: none; align-items: center; justify-content: center; }
.stk-modal.open { display: flex; }
.stk-modal .stk-modal-box { background: #fff; border-radius: 14px; padding: 28px; max-width: 360px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: stk-im-in .25s ease; position: relative; }
/* ====== 加微信弹窗 ====== */
.stk-modal h3 { margin: 0 0 4px; font-size: 18px; color: #1f2937; display:flex; align-items:center; justify-content:center; gap:6px; }
.stk-modal .stk-sub { font-size: 13px; color: #64748b; margin-bottom: 16px; }

/* 顶部智能提示卡（与回拨弹窗对称） */
.stk-smart { background: linear-gradient(135deg, #ecfeff 0%, #f0fdf4 100%); border: 1px solid #bbf7d0; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; text-align: left; position: relative; overflow: hidden; }
.stk-smart::before { content: ''; position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; background: radial-gradient(circle, rgba(225,37,27,.08), transparent 70%); }
.stk-smart-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #1e293b; padding: 3px 0; }
.stk-smart-row + .stk-smart-row { border-top: 1px dashed #d1fae5; }
.stk-smart-row .ic { width: 22px; height: 22px; background: #fff; border: 1px solid #d1fae5; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.stk-smart-row b { color: #e1251b; }

/* 二维码区 + 扫描框动画 */
.stk-qr-wrap { position: relative; width: 200px; height: 200px; margin: 0 auto 14px; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 24px rgba(15,23,42,.12); background: #fff; }
.stk-qr { width: 100%; height: 100%; background: #f8fafc; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; }
.stk-qr img { width: 100%; height: 100%; object-fit: contain; display: block; }
.stk-qr-corners { position: absolute; inset: 0; pointer-events: none; }
.stk-qr-corners::before, .stk-qr-corners::after,
.stk-qr-corners > i::before, .stk-qr-corners > i::after {
  content: ''; position: absolute; width: 22px; height: 22px;
  border-color: #10b981; border-style: solid; border-width: 0;
  animation: stk-corner-pulse 1.6s ease-in-out infinite;
}
.stk-qr-corners::before { top: 8px; left: 8px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; }
.stk-qr-corners::after { top: 8px; right: 8px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; }
.stk-qr-corners > i { position: absolute; inset: 0; }
.stk-qr-corners > i::before { bottom: 8px; left: 8px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; }
.stk-qr-corners > i::after { bottom: 8px; right: 8px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; }
@keyframes stk-corner-pulse { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }

/* 扫码线（一道绿色横线上下扫） */
.stk-qr-line { position: absolute; left: 14px; right: 14px; height: 2px; background: linear-gradient(90deg, transparent, #10b981, transparent); box-shadow: 0 0 8px #10b981; animation: stk-scan 2.2s ease-in-out infinite; }
@keyframes stk-scan { 0% { top: 16px; opacity: 0; } 10% { opacity: 1; } 50% { top: 50%; } 90% { opacity: 1; } 100% { top: calc(100% - 18px); opacity: 0; } }

/* 占位空状态（无二维码时） */
.stk-qr-empty { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, #fafafa 0%, #f1f5f9 100%); color: #94a3b8; font-size: 12px; }
.stk-qr-empty .phone-icon { width: 44px; height: 44px; border-radius: 12px; background: #fff; border: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: center; font-size: 22px; }

/* 微信号 + 一键复制 */
.stk-id-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 10px; font-size: 14px; color: #1f2937; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 999px; padding: 8px 14px; }
.stk-id-row b { color: #e1251b; font-size: 15px; letter-spacing: .5px; }
.stk-copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; background: #fff; border: 1px solid #e1251b; color: #e1251b; border-radius: 999px; font-size: 11px; cursor: pointer; transition: all .2s; font-weight: 600; }
.stk-copy-btn:hover { background: #e1251b; color: #fff; }
.stk-copy-btn.copied { background: #10b981; border-color: #10b981; color: #fff; }

/* 备用联系方式 */
.stk-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; font-size: 12px; }
.stk-alt > div { background: #f8fafc; border: 1px solid #eef0f5; border-radius: 8px; padding: 8px 10px; }
.stk-alt .lab { color: #94a3b8; font-size: 10px; margin-bottom: 2px; letter-spacing: .5px; }
.stk-alt .val { color: #1f2937; font-weight: 600; }

/* 操作按钮组（双按钮） */
.stk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stk-actions .stk-btn-primary, .stk-actions .stk-btn-ghost { padding: 10px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.stk-actions .stk-btn-primary { background: #e1251b; border: none; color: #fff; box-shadow: 0 4px 12px rgba(225,37,27,.25); }
.stk-actions .stk-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(225,37,27,.35); }
.stk-actions .stk-btn-ghost { background: #fff; border: 1px solid #e5e7eb; color: #475569; }
.stk-actions .stk-btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }

.stk-modal .stk-tip2 { font-size: 12px; color: #94a3b8; margin-top: 10px; }
.stk-modal .stk-modal-close { position: absolute; top: 10px; right: 12px; background: #f1f5f9; border: none; color: #64748b; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; transition: background .15s, color .15s, transform .15s; display: flex; align-items: center; justify-content: center; }
.stk-modal .stk-modal-close:hover { background: #e1251b; color: #fff; transform: rotate(90deg); }

/* ============ 电话回拨表单（重做） ============ */
.stk-cb { text-align: left; }
.stk-cb-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stk-cb-row .stk-cb-lbl { flex: 0 0 64px; padding-top: 11px; color: #475569; font-size: 13px; font-weight: 500; }
.stk-cb-row .stk-cb-ipt { flex: 1; }
.stk-cb-row input, .stk-cb-row textarea { width: 100%; padding: 11px 14px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 14px; font-family: inherit; outline: none; transition: all .15s; box-sizing: border-box; }
.stk-cb-row input:focus, .stk-cb-row textarea:focus { border-color: #e1251b; box-shadow: 0 0 0 3px rgba(225, 37, 27, .12); }
.stk-cb-row textarea { resize: none; line-height: 1.5; }

/* 智能提示卡：表单上方蓝色提示 */
.stk-cb-tip { display: flex; gap: 8px; align-items: flex-start; background: linear-gradient(135deg, #eff6ff, #f0fdf4); border: 1px solid #bae6fd; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 12px; color: #075985; line-height: 1.55; }
.stk-cb-tip::before { content: '⚡'; flex: 0 0 auto; font-size: 16px; }
.stk-cb-tip b { color: #0c4a6e; }

/* 提交按钮 - 始终居中、占满、圆角胶囊 */
.stk-cb-submit-wrap { display: flex; justify-content: center; margin: 16px 0 4px; }
.stk-cb-btn {
  width: 100%; padding: 13px 20px;
  background: #e1251b;
  color: #fff; border: none; border-radius: 999px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .2s ease; box-shadow: 0 6px 16px rgba(225, 37, 27, .25);
  position: relative; overflow: hidden;
}
.stk-cb-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(225, 37, 27, .35); }
.stk-cb-btn:active:not(:disabled) { transform: translateY(0); }
.stk-cb-btn:disabled { cursor: not-allowed; opacity: .92; }
.stk-cb-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.25) 50%, transparent 70%); transform: translateX(-100%); }
.stk-cb-btn:not(:disabled):hover::after { animation: stk-cb-shine 1.2s ease; }
@keyframes stk-cb-shine { to { transform: translateX(100%); } }

/* 等待态：流光按钮 */
.stk-cb-btn.processing { background: linear-gradient(90deg, #e1251b 0%, #ff7b3a 30%, #ff4d3a 50%, #ff7b3a 70%, #e1251b 100%); background-size: 200% 100%; animation: stk-cb-flow 1.6s linear infinite; color: #fff; }
@keyframes stk-cb-flow { to { background-position: 200% 0; } }

/* 完成态：绿色勾 + 收缩动画 */
.stk-cb-btn.done {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 6px 16px rgba(16, 185, 129, .3);
  animation: stk-cb-pop .35s ease;
}
@keyframes stk-cb-pop { 0% { transform: scale(.95); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

.stk-cb-spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: stk-spin 1s linear infinite; }
@keyframes stk-spin { to { transform: rotate(360deg); } }

/* 完成后下面的备注 */
.stk-cb-result { margin-top: 14px; padding: 12px 14px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; font-size: 13px; color: #166534; line-height: 1.7; text-align: left; display: none; }
.stk-cb-result.show { display: block; animation: stk-cb-pop .35s ease; }
.stk-cb-result b { color: #14532d; }

/* 弹窗整体优化：拉宽电话回拨框避免被切 */
.stk-modal .stk-modal-box.stk-modal-wide { max-width: 420px; padding: 28px 30px; }
.stk-modal .stk-modal-box.stk-modal-wide h3 { font-size: 19px; margin-bottom: 4px; }
.stk-modal .stk-modal-box.stk-modal-wide .stk-sub { font-size: 13px; margin-bottom: 14px; }
.stk-modal .stk-modal-box.stk-modal-wide .stk-qr { width: 200px; height: 200px; margin: 0 auto 14px; }
.stk-modal .stk-modal-box.stk-modal-wide .stk-tip2 { margin-top: 12px; }
.stk-modal .stk-modal-box.stk-modal-wide [data-act="modal-close"] { margin-top: 16px; }

/* 智能招呼气泡 */
.stk-bubble {
  position: absolute; right: 76px; top: 8px;
  background: #fff; border: 1px solid #eef0f5; border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: #1f2937;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .12);
  white-space: nowrap; animation: stk-bubble-in .3s ease;
  cursor: pointer;
}
.stk-bubble::after { content: ''; position: absolute; right: -6px; top: 14px; width: 10px; height: 10px; background: #fff; border-right: 1px solid #eef0f5; border-top: 1px solid #eef0f5; transform: rotate(45deg); }
@keyframes stk-bubble-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.stk-bubble .stk-bubble-close { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: #f3f4f6; color: #94a3b8; font-size: 10px; line-height: 16px; text-align: center; cursor: pointer; }

/* AI 推荐的商品卡 */
.stk-pcard {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0 2px; padding: 9px 12px;
  background: linear-gradient(135deg, #fff7f6 0%, #fff 60%);
  border: 1px solid #fecaca; border-radius: 10px;
  text-decoration: none !important; transition: box-shadow .15s, transform .15s;
}
.stk-pcard:hover { box-shadow: 0 4px 14px rgba(225,37,27,.18); transform: translateY(-1px); }
.stk-pcard-ic { font-size: 20px; flex-shrink: 0; }
.stk-pcard-bd { flex: 1; min-width: 0; text-align: left; }
.stk-pcard-bd b { display: block; font-size: 12.5px; color: #1f2937; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-pcard-bd i { display: block; font-style: normal; font-size: 11px; color: #e1251b; margin-top: 1px; }
.stk-pcard-go { color: #e1251b; font-weight: 800; flex-shrink: 0; }

/* 移动端吸底 */
@media (max-width: 768px) {
  .stk { right: 8px; bottom: 12px; }
  .stk-im { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; height: 70vh; }
  .stk-im-body { flex: 1; height: auto; }
}
