/* ===== 前台右侧悬浮客服栏（AI客服 / 申请试用 / 价格咨询 / 微信 / QQ群） =====
   与页面其它样式隔离：所有类名以 ai- 前缀，仅定位用 fixed，不影响站点原有布局。 */

/* ---------- 右侧竖排入口栏 ---------- */
.ai-side {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e3ebf6;
  border-right: none;
  border-radius: 10px 0 0 10px;
  box-shadow: -4px 0 20px rgba(15, 36, 66, .14);
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
.ai-side-item {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  padding: 0;
  margin: 0;
  background: #fff;
  color: #47586e;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.ai-side-item + .ai-side-item { border-top: 1px solid #eef3fa; }
.ai-side-item svg { width: 21px; height: 21px; fill: #004E96; transition: fill .18s ease; }
.ai-side-item span { white-space: nowrap; }
.ai-side-item:hover { background: #004E96; color: #fff; }
.ai-side-item:hover svg { fill: #fff; }
/* 小屏时收窄成图标条 */
@media (max-width: 640px) {
  .ai-side-item { width: 50px; height: 50px; gap: 3px; font-size: 11px; }
  .ai-side-item svg { width: 18px; height: 18px; }
}

/* 聊天面板 */
.ai-panel {
  position: fixed;
  right: 80px;
  bottom: 90px;
  z-index: 9001;
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 46px rgba(15, 36, 66, .28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
.ai-panel.open { display: flex; }

/* 面板头部 */
.ai-head {
  background: linear-gradient(135deg, #004E96 0%, #0d59ca 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.ai-head .ai-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
}
.ai-head .ai-avatar svg { width: 20px; height: 20px; fill: #fff; }
.ai-head .ai-name { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.ai-head .ai-sub { font-size: 11.5px; opacity: .8; margin-top: 2px; }
.ai-head .ai-close {
  margin-left: auto; background: none; border: none; color: #fff; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 2px 4px; opacity: .85;
}
.ai-head .ai-close:hover { opacity: 1; }

/* 消息区 */
.ai-body {
  flex: 1 1 auto;
  overflow-y: auto;
  background: #f5f8fd;
  padding: 14px 14px 6px;
  scroll-behavior: smooth;
}
.ai-msg { display: flex; margin-bottom: 12px; }
.ai-msg.bot { justify-content: flex-start; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-msg.bot .ai-bubble { background: #fff; color: #26323f; box-shadow: 0 2px 8px rgba(15, 36, 66, .08); }
.ai-msg.user .ai-bubble { background: #004E96; color: #fff; }
/* 未命中的提示：浅橙底，与正式答案区分 */
.ai-msg.bot .ai-bubble.unknown { background: #fff7e6; color: #8a5300; box-shadow: 0 2px 8px rgba(184, 120, 0, .12); }

/* 猜你想问 / 快捷问题 */
.ai-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; background: #f5f8fd; }
.ai-chip {
  border: 1px solid #cfdcee; background: #fff; color: #004E96; border-radius: 14px;
  padding: 5px 11px; font-size: 12px; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-chip:hover { background: #eaf1fb; border-color: #9db9e0; }

/* 输入区 */
.ai-foot {
  flex: 0 0 auto;
  border-top: 1px solid #e6ebf3;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ai-input {
  flex: 1 1 auto;
  min-height: 38px;
  max-height: 96px;
  resize: none;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
}
.ai-input:focus { border-color: #0d59ca; box-shadow: 0 0 0 2px rgba(13, 89, 202, .12); }
.ai-send {
  height: 38px; padding: 0 16px; border: none; border-radius: 8px;
  background: #004E96; color: #fff; font-size: 13px; cursor: pointer; flex: 0 0 auto;
}
.ai-send:hover { background: #0d59ca; }
.ai-send:disabled { background: #b9c4d4; cursor: not-allowed; }
.ai-tip-line {
  padding: 0 14px 8px; font-size: 11px; color: #8a94a6; background: #f5f8fd;
}

/* ---------- 通用弹层（申请试用 / 价格咨询 / 微信 / QQ群） ---------- */
.ai-pop {
  position: fixed;
  right: 80px;
  top: 50%;
  z-index: 9002;
  width: 320px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(15, 36, 66, .28);
  display: none;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  transform: translateY(-50%) scale(.96);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.ai-pop.open { display: block; opacity: 1; transform: translateY(-50%) scale(1); }
.ai-pop-head {
  background: linear-gradient(135deg, #004E96 0%, #0d59ca 100%);
  color: #fff; padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
  border-radius: 12px 12px 0 0;
}
.ai-pop-head svg { width: 18px; height: 18px; fill: #fff; }
.ai-pop-close {
  margin-left: auto; background: none; border: none; color: #fff; cursor: pointer;
  font-size: 18px; line-height: 1; opacity: .85; padding: 0 2px;
}
.ai-pop-close:hover { opacity: 1; }
.ai-pop-body { padding: 14px 16px 16px; }
.ai-pop-note { font-size: 12px; color: #7d8899; line-height: 1.75; margin: 0 0 12px; }
.ai-field { margin-bottom: 10px; }
.ai-field label { display: block; font-size: 12px; color: #5b6b80; margin-bottom: 5px; }
.ai-field input, .ai-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
  color: #26323f;
  background: #fff;
}
.ai-field input:focus, .ai-field textarea:focus {
  border-color: #0d59ca; box-shadow: 0 0 0 2px rgba(13, 89, 202, .12);
}
.ai-field textarea { resize: vertical; min-height: 64px; }
.ai-pop-btn {
  width: 100%; height: 38px; border: none; border-radius: 8px;
  background: #004E96; color: #fff; font-size: 13px; cursor: pointer; font-family: inherit;
}
.ai-pop-btn:hover { background: #0d59ca; }
.ai-pop-btn:disabled { background: #b9c4d4; cursor: not-allowed; }
.ai-pop-tel {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed #e6ebf3;
  font-size: 12px; color: #5b6b80;
}
.ai-pop-tel b { color: #004E96; font-size: 15px; letter-spacing: .5px; }
/* 二维码 */
.ai-qr-wrap { text-align: center; }
.ai-qr {
  display: block; width: 180px; height: 180px; margin: 0 auto 10px;
  object-fit: contain; background: #fff; border: 1px solid #eef3fa; border-radius: 8px;
}
.ai-qr-tip { font-size: 12px; color: #7d8899; text-align: center; line-height: 1.7; }
.ai-group-no {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 10px; font-size: 13px; color: #26323f;
}
.ai-group-no b { color: #004E96; font-size: 15px; letter-spacing: .5px; }
.ai-copy {
  border: 1px solid #cfdcee; background: #fff; color: #004E96;
  border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.ai-copy:hover { background: #eaf1fb; }
.ai-pop-empty { font-size: 12px; color: #8a94a6; text-align: center; line-height: 1.8; padding: 10px 0; }

/* 小屏：面板/弹层铺满可用宽度 */
@media (max-width: 560px) {
  .ai-panel { right: 0; bottom: 0; width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .ai-pop { right: 8px; left: 8px; width: auto; }
}

/* 站点主题里常带全局 button / a 规则，这里用双类名 + !important 保底，
   保证侧边栏在任何主题下都是白底蓝图标，不被站点样式改写。 */
.ai-side.ai-side { font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
.ai-side.ai-side .ai-side-item {
  width: 64px !important; height: 64px !important;
  background: #fff !important; box-shadow: none !important;
  border-radius: 0 !important; border: none !important;
  margin: 0 !important; padding: 0 !important;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  text-align: center !important; color: #47586e !important;
  font-size: 12px !important; line-height: 1 !important; text-indent: 0 !important;
}
.ai-side.ai-side .ai-side-item:hover { background: #004E96 !important; color: #fff !important; }
.ai-side.ai-side .ai-side-item svg { width: 21px !important; height: 21px !important; fill: #004E96 !important; }
.ai-side.ai-side .ai-side-item:hover svg { fill: #fff !important; }
.ai-panel.ai-panel { font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
.ai-panel.ai-panel .ai-bubble { margin: 0; }
.ai-panel.ai-panel .ai-input { font-family: inherit; }
.ai-pop.ai-pop .ai-field input, .ai-pop.ai-pop .ai-field textarea { font-family: inherit; }

/* 小屏收窄必须放在保底规则之后，否则被上面带 !important 的宽高覆盖 */
@media (max-width: 640px) {
  .ai-side.ai-side .ai-side-item {
    width: 52px !important;
    height: 54px !important;
    gap: 3px !important;
    font-size: 10px !important;
    letter-spacing: -0.2px !important;
  }
  .ai-side.ai-side .ai-side-item svg { width: 18px !important; height: 18px !important; }
}
