/* ============================================================
   钻神官网 · 智能客服浮窗组件
   品牌色：主色橙黄 #fec00f / 辅助蓝 #3cabff / 文字 #201e1f
   类名前缀 zcb- 避免与模板样式冲突
   ============================================================ */

.zcb-hidden { display: none !important; }

/* 浮动入口按钮 */
.zcb-launcher {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fec00f;
  box-shadow: 0 6px 20px rgba(254, 192, 15, 0.45);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease;
}
.zcb-launcher:hover { transform: scale(1.08); box-shadow: 0 10px 28px rgba(254, 192, 15, 0.6); }
.zcb-launcher svg { width: 30px; height: 30px; fill: #201e1f; }
.zcb-launcher .zcb-badge {
  position: absolute; top: -2px; right: -2px;
  background: #ff4d4f; color: #fff; font-size: 12px;
  min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px;
  text-align: center; padding: 0 4px; font-weight: bold;
}
.zcb-launcher .zcb-tooltip {
  position: absolute; right: 72px; top: 50%; transform: translateY(-50%);
  background: #201e1f; color: #fff; font-size: 13px; padding: 6px 12px;
  border-radius: 16px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.zcb-launcher:hover .zcb-tooltip { opacity: 1; }

/* 聊天面板 */
.zcb-panel {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 56px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #201e1f;
}

/* 头部 */
.zcb-header {
  background: #fec00f;
  color: #201e1f;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.zcb-header .zcb-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.zcb-header .zcb-title { font-size: 16px; font-weight: 700; line-height: 1.2; }
.zcb-header .zcb-status { font-size: 12px; opacity: .75; margin-top: 2px; }
.zcb-header .zcb-status .zcb-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #2ecc71; margin-right: 4px; vertical-align: middle;
}
.zcb-header .zcb-close {
  margin-left: auto; cursor: pointer; font-size: 22px; line-height: 1;
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; transition: background .2s;
}
.zcb-header .zcb-close:hover { background: rgba(0, 0, 0, 0.12); }

/* 消息区 */
.zcb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: #f6f7f9;
  scroll-behavior: smooth;
}
.zcb-body::-webkit-scrollbar { width: 6px; }
.zcb-body::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 3px; }

.zcb-msg { display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-start; }
.zcb-msg .zcb-ava {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: #fec00f; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.zcb-msg .zcb-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 4px 14px 14px 14px;
  font-size: 14px;
  line-height: 1.6;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  word-break: break-word;
}
.zcb-msg .zcb-bubble p { margin: 0 0 6px; }
.zcb-msg .zcb-bubble p:last-child { margin-bottom: 0; }
.zcb-msg .zcb-bubble a { color: #3cabff; text-decoration: none; font-weight: 600; }
.zcb-msg .zcb-bubble a:hover { text-decoration: underline; }
.zcb-msg .zcb-bubble ul { margin: 4px 0; padding-left: 18px; }
.zcb-msg .zcb-bubble li { margin: 2px 0; }

.zcb-msg.zcb-user { flex-direction: row-reverse; }
.zcb-msg.zcb-user .zcb-ava { background: #3cabff; color: #fff; }
.zcb-msg.zcb-user .zcb-bubble {
  background: #3cabff; color: #fff; border-radius: 14px 4px 14px 14px;
}
.zcb-msg.zcb-user .zcb-bubble a { color: #fff; text-decoration: underline; }

/* 快捷问题 */
.zcb-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; background: #f6f7f9; }
.zcb-quick .zcb-chip {
  font-size: 13px; padding: 7px 12px; border-radius: 16px;
  background: #fff; border: 1px solid #e2e2e2; cursor: pointer;
  transition: all .2s; color: #201e1f;
}
.zcb-quick .zcb-chip:hover { border-color: #fec00f; color: #d99e00; background: #fffbf0; }

/* 打字动画 */
.zcb-typing { display: flex; gap: 4px; padding: 12px 14px; }
.zcb-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #b5b5b5;
  animation: zcb-blink 1.2s infinite both;
}
.zcb-typing span:nth-child(2) { animation-delay: .2s; }
.zcb-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes zcb-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* 输入区 */
.zcb-input {
  border-top: 1px solid #eee;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.zcb-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.4;
  max-height: 80px;
  outline: none;
  font-family: inherit;
  color: #201e1f;
}
.zcb-input textarea:focus { border-color: #fec00f; }
.zcb-input .zcb-send {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%; border: none; background: #fec00f; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.zcb-input .zcb-send:hover { background: #f0b400; }
.zcb-input .zcb-send svg { width: 20px; height: 20px; fill: #201e1f; }
.zcb-input .zcb-send:disabled { opacity: .5; cursor: not-allowed; }

/* 留资表单 */
.zcb-lead-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 10; padding: 20px;
}
.zcb-lead {
  background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 320px;
}
.zcb-lead h4 { margin: 0 0 4px; font-size: 16px; }
.zcb-lead p { margin: 0 0 14px; font-size: 12px; color: #888; }
.zcb-lead input, .zcb-lead textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #e2e2e2; border-radius: 8px;
  padding: 9px 11px; font-size: 14px; margin-bottom: 10px; font-family: inherit; outline: none;
}
.zcb-lead input:focus, .zcb-lead textarea:focus { border-color: #fec00f; }
.zcb-lead .zcb-lead-btns { display: flex; gap: 10px; }
.zcb-lead .zcb-btn {
  flex: 1; border: none; border-radius: 8px; padding: 10px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.zcb-lead .zcb-btn-ok { background: #fec00f; color: #201e1f; }
.zcb-lead .zcb-btn-ok:hover { background: #f0b400; }
.zcb-lead .zcb-btn-no { background: #f0f0f0; color: #666; }
.zcb-lead .zcb-err { color: #ff4d4f; font-size: 12px; margin: -6px 0 10px; }

.zcb-foot-tip { text-align: center; font-size: 11px; color: #bbb; padding: 4px 0 2px; }

/* 移动端适配 */
@media (max-width: 540px) {
  .zcb-panel {
    right: 0; left: 0; bottom: 0; width: 100%;
    height: 100%; max-height: 100%; border-radius: 0;
  }
  .zcb-launcher { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .zcb-launcher .zcb-tooltip { display: none; }
}
