/* cs-widget.css — 智能客服悬浮窗样式（与 cs-widget.js 命名一致）
   主题色：主 #7a1616 / 辅 #fbeee1 / 强调 #ff6a00
   类名以 cs- 前缀，与站点隔离
*/

/* === 按钮 === */
.cs-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(180, 36, 36, 0.22);
  cursor: pointer;
  border: 2px solid #b42424;
  box-sizing: border-box;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-size: 24px;
  color: #7a1616;
  overflow: hidden;
}
.cs-btn .cs-btn-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.cs-btn .cs-btn-bee {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.cs-btn.cs-breathing {
  animation: cs-breathe 5s ease-in-out infinite;
}
.cs-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}
.cs-btn.cs-active {
  background: #7a1616;
  color: #fff;
  animation: none;
}
.cs-btn.cs-open {
  background: #b42424;
  border-color: #b42424;
  box-shadow: 0 8px 24px rgba(180,36,36, 0.35);
}
@keyframes cs-breathe {
  0%, 92%, 100% { transform: scale(1); }
  94% { transform: scale(1.08); }
  96% { transform: scale(1.04); }
  98% { transform: scale(1.06); }
}
.cs-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ff4040;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.cs-badge.cs-show { display: block; }

/* === 弹窗 === */
.cs-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 9998;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  animation: cs-slide-up 0.2s ease;
}
.cs-panel.cs-show { display: flex; }
@keyframes cs-slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Header === */
.cs-head {
  height: 56px;
  background: linear-gradient(135deg, #7a1616 0%, #b42424 100%);
  color: #fff;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cs-head-logo {
  width: 32px; height: 32px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.cs-head-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-head-title { flex: 1; min-width: 0; }
.cs-head-title b { font-weight: 600; font-size: 15px; line-height: 1.1; display: block; }
.cs-head-title span { font-size: 11px; opacity: 0.85; display: block; margin-top: 2px; }
.cs-head-close {
  width: 28px; height: 28px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
  border-radius: 4px;
  flex-shrink: 0;
}
.cs-head-close:hover { background: rgba(255, 255, 255, 0.15); }

/* === 消息流 === */
.cs-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f6f8f9;
  -webkit-overflow-scrolling: touch;
}
.cs-body::-webkit-scrollbar { width: 4px; }
.cs-body::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }

.cs-msg { display: flex; margin-bottom: 10px; align-items: flex-start; }
.cs-msg-user { justify-content: flex-end; }
.cs-msg-bot, .cs-msg-card, .cs-msg-guide, .cs-msg-fallback { justify-content: flex-start; }
.cs-msg .cs-avatar {
  width: 28px; height: 28px;
  background: #fbeee1;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-right: 6px;
  overflow: hidden;
}
.cs-msg .cs-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.cs-msg-user .cs-avatar { display: none; }

.cs-bubble {
  max-width: 80%;
  padding: 9px 12px;
  border-radius: 10px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.cs-msg-bot .cs-bubble {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #eaeaea;
}
.cs-msg-user .cs-bubble {
  background: #7a1616;
  color: #fff;
  margin-left: auto;
}
.cs-bubble.cs-welcome {
  background: #fbeee1;
  color: #7a1616;
  border-color: #f3cfb8;
}

/* === 快捷 chips === */
.cs-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px 34px;
}
.cs-tag {
  background: #fff;
  border: 1px solid #d9e2df;
  color: #7a1616;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-tag:hover { background: #fbeee1; }

/* === 服务卡片 === */
.cs-card {
  background: #fff;
  border-radius: 10px;
  border-left: 4px solid #7a1616;
  padding: 12px 14px;
  margin: 4px 0 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  max-width: 100%;
}
.cs-card-head {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.cs-card-icon { font-size: 16px; }
.cs-card-name { font-weight: 600; }
.cs-card-summary {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.5;
}
.cs-card-prices {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #777;
}
.cs-card-market { text-decoration: line-through; }
.cs-card-sale { color: #ff6a00; font-size: 18px; font-weight: 700; }
.cs-card-cycle { font-size: 12px; color: #777; margin-bottom: 8px; }
.cs-card-btn,
.cs-card-book {
  display: block;
  width: 100%;
  text-align: center;
  background: #7a1616;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.cs-card-btn:hover,
.cs-card-book:hover { background: #5e1010; }

/* === 引导卡片 === */
.cs-guide {
  background: #fffbea;
  border: 1px solid #ffe7a0;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 4px 0 8px;
  max-width: 100%;
}
.cs-guide-title {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 6px;
}
.cs-guide-desc { font-size: 12px; color: #555; margin-bottom: 10px; line-height: 1.5; }
.cs-guide-actions { display: flex; gap: 8px; }
.cs-guide-btn {
  flex: 1;
  background: #ff6a00;
  color: #fff;
  border: 0;
  padding: 8px 0;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}
.cs-guide-btn.cs-ghost { background: #fff; color: #7a1616; border: 1px solid #7a1616; }
.cs-guide-btn.cs-primary { background: #ff6a00; color: #fff; }

/* === 兜底 === */
.cs-fallback {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 4px 0 8px;
  border: 1px dashed #c8d6cf;
  max-width: 100%;
}
.cs-fallback-title { font-size: 13px; color: #555; margin-bottom: 8px; }
.cs-fallback-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-fallback-q {
  background: #f6f8f9;
  border: 1px solid #d9e2df;
  color: #7a1616;
  padding: 3px 8px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.cs-fallback-q:hover { background: #fbeee1; }

/* === 输入区 === */
.cs-input-bar {
  flex-shrink: 0;
  border-top: 1px solid #eee;
  background: #fff;
  padding: 8px 10px;
}
.cs-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.cs-textarea {
  flex: 1;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  resize: none;
  font-family: inherit;
  height: 36px;
  max-height: 80px;
  box-sizing: border-box;
  outline: none;
}
.cs-textarea:focus { border-color: #7a1616; }
.cs-send {
  width: 36px;
  height: 36px;
  background: #7a1616;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.cs-send:disabled { background: #c0c0c0; cursor: not-allowed; }

/* === Modal === */
.cs-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cs-modal-mask.cs-show { display: flex; }
.cs-modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.cs-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.cs-modal-head h4 { margin: 0; font-size: 15px; color: #1a1a1a; }
.cs-modal-close {
  background: transparent;
  border: 0;
  font-size: 20px;
  color: #888;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.cs-modal-body { padding: 14px 16px; }
.cs-field { margin-bottom: 10px; }
.cs-field label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; }
.cs-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
}
.cs-field input:focus { border-color: #7a1616; }
.cs-field-err {
  font-size: 12px;
  color: #ff4040;
  margin-top: 4px;
  display: none;
}
.cs-field.cs-err input { border-color: #ff4040; }
.cs-field.cs-err .cs-field-err { display: block; }
.cs-modal-tip { font-size: 11px; color: #999; margin: 0; }
.cs-modal-foot { padding: 0 16px 14px; }
.cs-submit {
  width: 100%;
  background: #7a1616;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.cs-submit:disabled { background: #c0c0c0; cursor: not-allowed; }
.cs-submit:hover { background: #5e1010; }

/* === Toast === */
.cs-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.cs-toast.cs-show { opacity: 1; }

/* === 移动端 === */
@media (max-width: 600px) {
  .cs-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  /* 站点底部 tab-bar（64px）在 ≤600px 可见：按钮上移避开，避免遮挡导航与 a11y target-size 冲突 */
  .cs-btn { right: 16px; bottom: 84px; }
}
