/* 腾辉智能客服小腾 - 聊天窗口样式（TWBOT-001, 2026-09-26） */
#tw-chat-btn {
  position: fixed;
  right: 12px;
  bottom: 76px;
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border: none;
  border-radius: 26px;
  background: linear-gradient(135deg, #2C6FBB, #1B4D7A);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(27, 77, 122, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}
#tw-chat-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(27, 77, 122, 0.45); }
#tw-chat-btn .tw-chat-btn-icon { font-size: 18px; }
body.has-inquiry #tw-chat-btn { bottom: 140px; }
body.has-compare #tw-chat-btn { bottom: 190px; }
#tw-chat-btn.tw-hidden { display: none; }

@media (min-width: 769px) {
  #tw-chat-btn { right: 24px; bottom: 150px; }
  body.has-inquiry #tw-chat-btn { bottom: 170px; }
  body.has-compare #tw-chat-btn { bottom: 200px; }
}

/* 气泡小提示 */
.tw-chat-teaser {
  position: fixed;
  right: 12px;
  bottom: 134px;
  z-index: 10049;
  max-width: 220px;
  background: #fff;
  border: 1px solid var(--border, #E1E8ED);
  border-radius: 12px 12px 2px 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text, #2C3E50);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  cursor: pointer;
  animation: twFadeUp 0.4s ease;
}
@media (min-width: 769px) {
  .tw-chat-teaser { right: 24px; bottom: 210px; }
}
body.has-inquiry .tw-chat-teaser { bottom: 198px; }
body.has-compare .tw-chat-teaser { bottom: 248px; }
.tw-chat-teaser .tw-teaser-close {
  position: absolute; top: 2px; right: 6px; border: none; background: none;
  color: #bbb; font-size: 14px; cursor: pointer; padding: 2px;
}
@keyframes twFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 主面板 */
.tw-chat-panel {
  position: fixed;
  right: 8px;
  left: 8px;
  bottom: 8px;
  height: 70vh;
  max-height: 620px;
  z-index: 10060;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
}
.tw-chat-panel.tw-open { display: flex; animation: twFadeUp 0.25s ease; }

@media (min-width: 769px) {
  .tw-chat-panel {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
  }
}

/* 头部 */
.tw-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #2C6FBB, #1B4D7A);
  color: #fff;
  flex-shrink: 0;
}
.tw-chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.tw-chat-title b { font-size: 15px; display: block; }
.tw-chat-title span { font-size: 11.5px; opacity: 0.85; }
.tw-chat-close {
  margin-left: auto;
  border: none; background: rgba(255,255,255,0.15); color: #fff;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 14px; cursor: pointer;
}
.tw-chat-close:hover { background: rgba(255,255,255,0.28); }

/* 消息区 */
.tw-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  background: #F5F7FA;
  -webkit-overflow-scrolling: touch;
}
.tw-msg { display: flex; margin-bottom: 10px; }
.tw-msg.tw-user { justify-content: flex-end; }
.tw-msg-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: normal;
}
.tw-msg.tw-bot .tw-msg-bubble {
  background: #fff;
  color: #2C3E50;
  border: 1px solid #E8EEF4;
  border-top-left-radius: 4px;
}
.tw-msg.tw-user .tw-msg-bubble {
  background: #1B4D7A;
  color: #fff;
  border-top-right-radius: 4px;
}
.tw-msg-bubble a { color: #2C6FBB; }
.tw-msg.tw-user .tw-msg-bubble a { color: #cfe3ff; }

/* 输入中动画 */
.tw-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.tw-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #9DB2C6;
  animation: twBlink 1.2s infinite;
}
.tw-typing i:nth-child(2) { animation-delay: 0.2s; }
.tw-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes twBlink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* 产品卡片 */
.tw-products { margin: 2px 0 12px 0; }
.tw-product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #E8EEF4;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.tw-product-card img {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: 8px; background: #f0f0f0; flex-shrink: 0;
}
.tw-product-card .tw-pc-info { flex: 1; min-width: 0; }
.tw-product-card .tw-pc-name {
  font-size: 13.5px; font-weight: 600; color: #2C3E50;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tw-product-card .tw-pc-specs {
  font-size: 11.5px; color: #8A9BAD;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.tw-product-card .tw-pc-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.tw-pc-btn {
  border: 1px solid #1B4D7A; background: #fff; color: #1B4D7A;
  border-radius: 6px; padding: 4px 8px; font-size: 11.5px; cursor: pointer;
  text-decoration: none; text-align: center; white-space: nowrap;
}
.tw-pc-btn:hover { background: #1B4D7A; color: #fff; }
.tw-pc-btn.tw-pc-added { border-color: #27ae60; color: #27ae60; }

/* 工单提示 */
.tw-wonote {
  text-align: center;
  font-size: 12px;
  color: #1B7A3D;
  background: #EAF8EF;
  border: 1px solid #CBEBD7;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 0 0 10px 0;
}

/* 快捷短语 */
.tw-chat-chips {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  background: #fff;
  border-top: 1px solid #F0F4F8;
  flex-shrink: 0;
}
.tw-chat-chips button {
  flex-shrink: 0;
  border: 1px solid #D5E2EF;
  background: #F4F8FC;
  color: #1B4D7A;
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.tw-chat-chips button:hover { background: #E4EFFA; }

/* 输入栏 */
.tw-chat-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #EEF3F8;
  flex-shrink: 0;
}
.tw-chat-inputbar textarea {
  flex: 1;
  border: 1px solid #DCE6F0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 96px;
  min-height: 38px;
  outline: none;
  background: #FAFCFE;
}
.tw-chat-inputbar textarea:focus { border-color: #2C6FBB; background: #fff; }
.tw-chat-send {
  border: none;
  background: #1B4D7A;
  color: #fff;
  border-radius: 10px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.tw-chat-send:hover { background: #2C6FBB; }
.tw-chat-send:disabled { background: #B9C8D6; cursor: not-allowed; }

.tw-chat-foot {
  text-align: center;
  font-size: 11px;
  color: #A9B7C6;
  padding: 0 0 8px;
  background: #fff;
  flex-shrink: 0;
}
