/* 驰锐金属 · 在线客服悬浮组件 */
:root {
  --chat-gold: #b8935a;
  --chat-gold-d: #9c7a42;
  --chat-ink: #201e1a;
  --chat-muted: #847c6e;
}
#chatWidget * { box-sizing: border-box; }
#chatWidget { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }

/* 悬浮按钮 */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9998;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--chat-gold), var(--chat-gold-d));
  color: #fff; box-shadow: 0 8px 24px rgba(156, 122, 66, .38);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.chat-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(156, 122, 66, .5); }
.chat-fab svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-fab .chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  background: #e5484d; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center; border: 2px solid #fff;
}
.chat-fab .chat-badge.show { display: flex; }
.chat-fab .chat-tip {
  position: absolute; right: 68px; top: 50%; transform: translateY(-50%);
  background: #fff; color: var(--chat-ink); font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12); pointer-events: none;
}
.chat-fab .chat-tip::after {
  content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 12px; height: 12px; background: #fff;
}

/* 对话面板 */
.chat-panel {
  position: fixed; right: 22px; bottom: 92px; z-index: 9999;
  width: 360px; max-width: calc(100vw - 32px); height: 540px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 16px; overflow: hidden; display: none;
  flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
  border: 1px solid rgba(184, 147, 90, .3);
  transform-origin: bottom right; animation: chatIn .22s ease;
}
.chat-panel.open { display: flex; }
@keyframes chatIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }

.chat-head {
  background: linear-gradient(135deg, #1c1a17, #332c22); color: #fff;
  padding: 16px 18px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.chat-head .chat-logo {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--chat-gold), var(--chat-gold-d));
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 19px;
}
.chat-head .chat-meta { flex: 1; min-width: 0; }
.chat-head .chat-name { font-size: 15px; font-weight: 800; }
.chat-head .chat-status { font-size: 12px; color: #c9b48a; margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.chat-head .chat-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #5fd08a; box-shadow: 0 0 0 3px rgba(95, 208, 138, .18); }
.chat-head .chat-close { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; }
.chat-head .chat-close:hover { background: rgba(255, 255, 255, .22); }

.chat-contact-bar {
  background: #faf6ee; border-bottom: 1px solid #eee4d2; padding: 10px 14px;
  font-size: 12px; color: #6b6357; display: flex; flex-wrap: wrap; gap: 6px 14px; flex-shrink: 0;
}
.chat-contact-bar a { color: var(--chat-gold-d); font-weight: 700; text-decoration: none; }
.chat-contact-bar a:hover { text-decoration: underline; }

.chat-body {
  flex: 1; overflow-y: auto; padding: 16px 14px; background: #f7f5f0;
  display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth;
}
.chat-msg { max-width: 82%; display: flex; flex-direction: column; }
.chat-msg .bubble {
  padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap;
}
.chat-msg .time { font-size: 11px; color: #aaa; margin-top: 4px; }
.chat-msg.agent { align-self: flex-start; }
.chat-msg.agent .bubble { background: #fff; color: var(--chat-ink); border: 1px solid #ebe4d6; border-top-left-radius: 4px; }
.chat-msg.visitor { align-self: flex-end; align-items: flex-end; }
.chat-msg.visitor .bubble { background: linear-gradient(135deg, var(--chat-gold), var(--chat-gold-d)); color: #fff; border-top-right-radius: 4px; }
.chat-msg .time.visitor-t { text-align: right; }
.chat-typing { display: flex; gap: 4px; padding: 12px 14px; }
.chat-typing i { width: 6px; height: 6px; background: #cbb994; border-radius: 50%; animation: chatBlink 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: .2s; }
.chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chatBlink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.chat-form { border-top: 1px solid #ece5d7; background: #fff; padding: 10px 12px; flex-shrink: 0; }
.chat-form .chat-info-row { display: flex; gap: 8px; margin-bottom: 8px; }
.chat-form .chat-info-row input {
  flex: 1; min-width: 0; border: 1px solid #e6dece; border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: 0;
}
.chat-form .chat-info-row input:focus { border-color: var(--chat-gold); }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose textarea {
  flex: 1; min-width: 0; resize: none; border: 1px solid #e6dece; border-radius: 10px;
  padding: 9px 11px; font-size: 14px; line-height: 1.5; height: 44px; max-height: 110px; outline: 0;
}
.chat-compose textarea:focus { border-color: var(--chat-gold); }
.chat-compose button {
  border: 0; cursor: pointer; height: 44px; padding: 0 16px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--chat-gold), var(--chat-gold-d)); color: #fff; font-weight: 700; font-size: 14px;
}
.chat-compose button:disabled { opacity: .5; cursor: default; }
.chat-hint { font-size: 11px; color: #a89e8c; margin-top: 6px; text-align: center; }

/* 移动端：隐藏提示气泡，客服按钮上移避开底部固定询盘栏(.mob-bar 高约52px) */
@media (max-width: 720px) {
  .chat-fab .chat-tip { display: none !important; }
  .chat-fab { right: 14px; bottom: 66px; width: 52px; height: 52px; }
  .chat-panel { right: 8px; bottom: 126px; width: calc(100vw - 16px); height: 64vh; }
}
@media (max-width: 480px) {
  .chat-panel { right: 8px; bottom: 126px; width: calc(100vw - 16px); height: 64vh; }
  .chat-fab { right: 14px; bottom: 66px; }
}
