/* 深度拓客官网 · AI 问答对话窗 */
#chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9990;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 8px 26px rgba(37, 99, 235, .45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
  color: #fff;
}
#chat-fab:hover { transform: scale(1.06); box-shadow: 0 12px 32px rgba(37, 99, 235, .55); }
#chat-fab svg { width: 28px; height: 28px; }
#chat-fab .chat-fab-dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }

#chat-panel {
  position: fixed; right: 22px; bottom: 96px; z-index: 9991;
  width: 380px; max-width: calc(100vw - 32px);
  height: min(620px, calc(100vh - 130px));
  background: #fff; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  border: 1px solid rgba(226, 232, 240, .8);
  opacity: 0; transform: translateY(16px) scale(.97); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.chat-head {
  background: linear-gradient(120deg, #1e3a8a, #2563eb 60%, #7c3aed);
  color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.chat-head img { width: 36px; height: 36px; border-radius: 10px; background: #fff; padding: 2px; }
.chat-head-t { flex: 1; min-width: 0; }
.chat-head-t strong { display: block; font-size: 14.5px; }
.chat-head-t span { font-size: 11.5px; opacity: .85; display: flex; align-items: center; gap: 5px; }
.chat-head-t .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.chat-close { background: rgba(255,255,255,.14); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1; flex-shrink: 0; }
.chat-close:hover { background: rgba(255,255,255,.26); }

.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: #f6f8fc; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.chat-msg { display: flex; gap: 8px; max-width: 88%; }
.chat-msg.ai { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .avatar { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-msg .bubble {
  background: #fff; border: 1px solid #e6ebf4; border-radius: 4px 14px 14px 14px;
  padding: 10px 13px; font-size: 13.5px; line-height: 1.75; color: #1e293b; overflow-wrap: break-word;
}
.chat-msg.user .bubble { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; border: 0; border-radius: 14px 4px 14px 14px; }
.chat-msg .bubble p { margin: 0 0 6px; }
.chat-msg .bubble p:last-child { margin-bottom: 0; }
.chat-msg .bubble ul, .chat-msg .bubble ol { margin: 4px 0; padding-left: 18px; }
.chat-msg .bubble b, .chat-msg .bubble strong { font-weight: 700; }
.chat-src { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-src-tag { font-size: 11px; background: #eef6ff; color: #2563eb; border: 1px solid #d4e6ff; border-radius: 999px; padding: 2px 9px; display: inline-flex; align-items: center; gap: 4px; }
.chat-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: chat-blink 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: .2s; }
.chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chat-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat-quick { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 10px; background: #f6f8fc; }
.chat-quick button { font-size: 12px; background: #fff; border: 1px solid #d8e2f0; color: #334155; border-radius: 999px; padding: 5px 12px; cursor: pointer; transition: all .15s; }
.chat-quick button:hover { border-color: #2563eb; color: #2563eb; background: #f0f6ff; }

.chat-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #eef1f6; background: #fff; align-items: flex-end; }
.chat-foot input {
  flex: 1; border: 1.5px solid #d8e2f0; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.chat-foot input:focus { border-color: #2563eb; }
.chat-foot button {
  background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; border: 0; border-radius: 12px;
  width: 42px; height: 42px; cursor: pointer; font-size: 16px; flex-shrink: 0;
}
.chat-foot button:disabled { opacity: .5; cursor: not-allowed; }
.chat-disclaimer { font-size: 10.5px; color: #94a3b8; text-align: center; padding: 5px 12px 8px; background: #fff; }

@media (max-width: 560px) {
  #chat-fab { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  #chat-panel { right: 8px; bottom: 84px; width: calc(100vw - 16px); height: calc(100vh - 100px); border-radius: 16px; }
}
