/* ========== 智文阁 AI 客服管家（微信风格） ========== */
#chatbot { position: fixed; right: 22px; bottom: 22px; z-index: 9999; font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; }

/* 悬浮按钮 */
.cb-fab {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, #07c160, #06ad56);
  border: none; color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(7,193,96,.4);
  cursor: pointer; position: relative;
  transition: transform .15s;
}
.cb-fab:hover { transform: scale(1.08); }
.cb-fab-badge {
  position: absolute; top: -4px; right: -4px;
  background: #fa5151; color: #fff; font-size: 12px;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px; font-weight: 600;
}

/* 聊天面板 */
.cb-panel {
  position: fixed; right: 22px; bottom: 22px;
  width: 360px; max-width: calc(100vw - 30px);
  height: 560px; max-height: calc(100vh - 60px);
  background: #f5f5f5; border-radius: 14px;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  overflow: hidden;
  animation: cbPop .2s ease;
}
@keyframes cbPop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* 头部 */
.cb-header {
  background: #ededed; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #e2e2e2; flex-shrink: 0;
}
.cb-hd-avatar { width: 38px; height: 38px; border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cb-hd-info { flex: 1; min-width: 0; }
.cb-hd-name { font-size: 15px; font-weight: 600; color: #191919; }
.cb-hd-status { font-size: 11px; color: #888; display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.cb-dot { width: 7px; height: 7px; border-radius: 50%; background: #07c160; display: inline-block; }
.cb-close { background: none; border: none; font-size: 16px; color: #888; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.cb-close:hover { background: #ddd; }

/* 消息区 */
.cb-msgs {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  background: #f5f5f5;
}
.cb-msg { display: flex; margin-bottom: 14px; align-items: flex-start; }
.cb-user { justify-content: flex-end; }
.cb-avatar {
  width: 34px; height: 34px; border-radius: 5px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; margin-right: 8px; flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.cb-avatar-user { margin-right: 0; margin-left: 8px; background: #e7f6ff; }
.cb-bubble {
  max-width: 76%; background: #fff; border-radius: 4px 12px 12px 12px;
  padding: 9px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.cb-bubble-user { background: #95ec69; border-radius: 12px 4px 12px 12px; }
.cb-name { font-size: 11px; color: #888; margin-bottom: 3px; }
.cb-text { font-size: 14px; color: #191919; line-height: 1.6; word-break: break-word; }

/* 打字动画 */
.cb-typing .cb-bubble { padding: 12px 14px; }
.dot-anim { display: inline-flex; gap: 4px; }
.dot-anim i { width: 6px; height: 6px; border-radius: 50%; background: #aaa; animation: cbBlink 1.2s infinite; }
.dot-anim i:nth-child(2) { animation-delay: .2s; }
.dot-anim i:nth-child(3) { animation-delay: .4s; }
@keyframes cbBlink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

/* 快捷问题 */
.cb-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; background: #f5f5f5; flex-shrink: 0; }
.cb-quick button {
  border: 1px solid #07c160; color: #07c160; background: #fff;
  border-radius: 999px; font-size: 12px; padding: 4px 10px; cursor: pointer;
  transition: all .15s;
}
.cb-quick button:hover { background: #07c160; color: #fff; }

/* 输入区 */
.cb-input-row { display: flex; gap: 8px; padding: 10px 12px; background: #f5f5f5; border-top: 1px solid #e2e2e2; flex-shrink: 0; align-items: center; }
.cb-input {
  flex: 1; border: 1px solid #d8d8d8; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; outline: none; background: #fff;
}
.cb-input:focus { border-color: #07c160; }
.cb-send {
  background: #07c160; color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; cursor: pointer;
}
.cb-send:hover { background: #06ad56; }
.cb-voice {
  background: #fff; border: 1px solid #d8d8d8; border-radius: 50%;
  width: 38px; height: 38px; font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.cb-voice.listening { background: #fa5151; color: #fff; border-color: #fa5151; animation: cbPulse 1s infinite; }
@keyframes cbPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(250,81,81,.4); } 50% { box-shadow: 0 0 0 8px rgba(250,81,81,0); } }

/* 语音提示 */
.cb-voice-tip {
  position: absolute; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; font-size: 13px;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  animation: cbPop .2s ease;
}

@media (max-width: 480px) {
  #chatbot { right: 12px; bottom: 12px; }
  .cb-fab { width: 52px; height: 52px; font-size: 24px; }
  .cb-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 90px); }
}

/* ===== V14 chatbot 头像改为图片 ===== */
.cb-hd-avatar img,
.cb-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.cb-hd-avatar { overflow: hidden; background: #f4f8ff; }
.cb-avatar { overflow: hidden; background: #f4f8ff; }
