/* 在线咨询（AI 聊天体验官，2026-10-31）
   规格对齐接口文档 §5：桌面 56px 气泡 + 360×560 面板；移动端全宽底部抽屉 70vh。
   全部类名带 xzc- 前缀，不碰站点自有样式；z-index 高于前台所有层（弹窗除外）。 */
#xz-chat { position: fixed; right: 20px; bottom: 20px; z-index: 9990; font-family: inherit; }
#xz-chat[hidden] { display: none; }

/* hidden 属性必须显式生效：.xzc-panel 的 display:flex 会压过 hidden 的 UA 默认
   display:none，导致点 × 关闭后面板仍可见（2026-10-31 生产反馈）。 */
#xz-chat [hidden] { display: none !important; }

/* 气泡 */
.xzc-bubble {
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff;
  box-shadow: 0 6px 20px rgba(79, 70, 229, .38);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.xzc-bubble:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(79, 70, 229, .45); }
.xzc-bubble .xzc-dot {
  position: absolute; top: 2px; right: 2px; width: 10px; height: 10px;
  border-radius: 50%; background: #ef4444; border: 2px solid #fff;
}

/* 面板 */
.xzc-panel {
  width: 360px; height: 560px; max-height: 70vh;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 12px 48px rgba(15, 23, 42, .22);
  display: flex; flex-direction: column;
}
.xzc-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; flex: none;
}
.xzc-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.xzc-headtxt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.xzc-headtxt strong { font-size: 14px; }
.xzc-status { font-size: 11px; opacity: .92; display: flex; align-items: center; gap: 4px; }
.xzc-status i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; transition: background .2s ease; }
/* 离线：圆点转红（真实状态由后端探活/发送成败决定，见 chat-widget.js） */
.xzc-status.is-offline i { background: #f04438; }
.xzc-status.is-offline { opacity: 1; }
.xzc-close {
  border: none; background: rgba(255,255,255,.16); color: #fff; width: 28px; height: 28px;
  border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer;
}
.xzc-close:hover { background: rgba(255,255,255,.3); }
.xzc-clear {
  border: none; background: rgba(255,255,255,.16); color: #fff; height: 28px;
  border-radius: 8px; font-size: 12px; padding: 0 8px; cursor: pointer; white-space: nowrap;
}
.xzc-clear:hover { background: rgba(255,255,255,.3); }

/* 联系顾问：数据库里真有联系方式才出现（服务端决定，前端不猜）
   上下各留 10px：按钮不贴消息区，也不贴输入框分隔线（2026-11-01 反馈）。 */
.xzc-actions { padding: 10px 12px; background: #fff; flex: none; }
.xzc-contact {
  border: 1px solid #c7d2fe; background: #eef2ff; color: #4338ca;
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.xzc-contact:hover { background: #e0e7ff; }

/* 消息流 */
.xzc-msgs { flex: 1; overflow-y: auto; padding: 12px; background: #f6f7fb; display: flex; flex-direction: column; gap: 10px; }
.xzc-msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.xzc-msg.bot { background: #fff; color: #1f2937; border: 1px solid #e8eaf2; align-self: flex-start; border-top-left-radius: 4px; }
.xzc-msg.me { background: #4f46e5; color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.xzc-msg.sys { background: transparent; color: #94a3b8; font-size: 12px; align-self: center; text-align: center; }
.xzc-msg.typing { display: flex; align-items: center; gap: 4px; padding: 13px 14px; }
.xzc-msg.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #a5b4fc;
  animation: xzc-bounce 1.2s infinite ease-in-out;
}
.xzc-msg.typing span:nth-child(2) { animation-delay: .2s; }
.xzc-msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes xzc-bounce {
  0%, 80%, 100% { opacity: .35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.xzc-status.is-typing i { animation: xzc-pulse 1s infinite ease-in-out; }
@keyframes xzc-pulse { 50% { opacity: .3; } }

/* 输入区 */
.xzc-inputrow { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eceef5; background: #fff; flex: none; align-items: flex-end; }
#xzChatText {
  flex: 1; min-height: 38px; max-height: 96px; resize: none; border: 1px solid #dfe3ee;
  border-radius: 10px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; line-height: 1.5;
}
#xzChatText:focus { outline: none; border-color: #6366f1; }
.xzc-send {
  border: none; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  background: #4f46e5; color: #fff; font-size: 13px;
}
.xzc-send:disabled { background: #c7cbe8; cursor: default; }

/* 移动端：全宽底部抽屉（规格 §5） */
@media (max-width: 768px) {
  #xz-chat { right: 12px; bottom: 12px; left: auto; }
  .xzc-bubble { width: 48px; height: 48px; }
  .xzc-bubble svg { width: 22px; height: 22px; }
  .xzc-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: 70vh; max-height: none;
    border-radius: 12px 12px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .xzc-bubble, .xzc-panel { transition: none; }
  .xzc-msg.typing span, .xzc-status.is-typing i { animation: none; }
}
