/* ========== AI 智能销售顾问 ========== */

.chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 9998;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 22px 13px 18px; border: none; border-radius: 40px;
  background: linear-gradient(135deg, #C8102E 0%, #e8192e 100%);
  color: #fff; font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 24px rgba(200,16,46,.38);
  transition: transform .2s, box-shadow .2s;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(200,16,46,.48); }
.chat-launcher .dot {
  width: 9px; height: 9px; border-radius: 50%; background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74,222,128,.7); animation: chatPulse 1.8s infinite;
}
@keyframes chatPulse {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,.7); }
  70%  { box-shadow: 0 0 0 9px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.chat-launcher.hidden { display: none; }

/* ---------- 主面板 ---------- */
.chat-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 9999;
  width: 380px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 48px);
  background: #fff; border-radius: 18px; overflow: hidden;
  display: none; flex-direction: column;
  box-shadow: 0 20px 60px rgba(13,31,60,.3);
  font-family: inherit;
}
.chat-panel.open { display: flex; animation: chatIn .26s ease; }
@keyframes chatIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.chat-head {
  background: linear-gradient(135deg, #0d1f3c 0%, #1b2f52 100%);
  color: #fff; padding: 16px 18px; display: flex; align-items: center; gap: 12px;
}
.chat-head .avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #C8102E;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; flex-shrink: 0;
}
.chat-head .meta { flex: 1; min-width: 0; }
.chat-head .t { font-size: 15px; font-weight: 700; }
.chat-head .s { font-size: 12px; color: rgba(255,255,255,.72); margin-top: 2px;
                display: flex; align-items: center; gap: 5px; }
.chat-head .s i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80;
                  display: inline-block; font-style: normal; }
.chat-close {
  background: transparent; border: none; color: rgba(255,255,255,.8);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.chat-close:hover { color: #fff; }

/* ---------- 消息区 ---------- */
.chat-body {
  flex: 1; overflow-y: auto; padding: 18px 16px; background: #f7f9fc;
  display: flex; flex-direction: column; gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.chat-msg { max-width: 86%; padding: 11px 14px; border-radius: 14px;
            font-size: 14.5px; line-height: 1.65; word-break: break-word; white-space: pre-wrap; }
.chat-msg.bot  { background: #fff; color: #2d3748; align-self: flex-start;
                 border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.chat-msg.user { background: #C8102E; color: #fff; align-self: flex-end;
                 border-bottom-right-radius: 4px; }
.chat-msg strong { font-weight: 700; }
.chat-msg.bot strong { color: #0d1f3c; }

.chat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 13px 15px;
               background: #fff; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1;
                    animation: chatBlink 1.3s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes chatBlink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

/* ---------- 交互区 ---------- */
.chat-foot { border-top: 1px solid #eef1f6; background: #fff; padding: 12px 14px; }

.chat-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-opt {
  padding: 9px 15px; border: 1px solid #e2e6ee; border-radius: 20px;
  background: #fff; color: #334155; font-family: inherit; font-size: 14px;
  cursor: pointer; transition: .16s;
}
.chat-opt:hover { border-color: #C8102E; color: #C8102E; background: #fff5f6; }
.chat-skip { background: none; border: none; color: #94a3b8; font-size: 13px;
             cursor: pointer; margin-top: 10px; text-decoration: underline; font-family: inherit; }
.chat-skip:hover { color: #64748b; }

.chat-form { display: grid; gap: 9px; }
.chat-form input {
  width: 100%; padding: 10px 13px; border: 1px solid #e2e6ee; border-radius: 9px;
  font-size: 14.5px; font-family: inherit; outline: none; transition: .16s;
}
.chat-form input:focus { border-color: #C8102E; }
.chat-form button {
  padding: 12px; border: none; border-radius: 9px; background: #C8102E; color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.chat-form button:hover { background: #a50e26; }
.chat-form button:disabled { background: #cbd5e1; cursor: not-allowed; }

.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input {
  flex: 1; padding: 11px 14px; border: 1px solid #e2e6ee; border-radius: 22px;
  font-size: 14.5px; font-family: inherit; outline: none;
}
.chat-input-row input:focus { border-color: #C8102E; }
.chat-input-row button {
  width: 44px; height: 44px; border: none; border-radius: 50%; background: #C8102E;
  color: #fff; font-size: 17px; cursor: pointer; flex-shrink: 0;
}
.chat-input-row button:hover { background: #a50e26; }

.chat-err { color: #C8102E; font-size: 13px; margin-top: 8px; text-align: center; }
.chat-legal { font-size: 11.5px; color: #a0aec0; text-align: center; margin-top: 9px; line-height: 1.6; }

@media (max-width: 480px) {
  .chat-panel { right: 0; bottom: 0; width: 100%; max-width: 100%;
                height: 100%; max-height: 100%; border-radius: 0; }
  .chat-launcher { right: 16px; bottom: 16px; padding: 12px 18px 12px 15px; font-size: 14px; }
}
