/* Chat Widget Styles */
.chat-widget { position: fixed; right: 24px; bottom: 24px; width: 320px; max-height: 60vh; background: #111; color: #fff; border: 1px solid #333; border-radius: 14px; box-shadow: 0 10px 24px rgba(0,0,0,0.35); display: none; flex-direction: column; overflow: hidden; z-index: 9999; }
.chat-header { display:flex; justify-content: space-between; align-items:center; padding: 10px 12px; background: #151515; border-bottom: 1px solid #333; min-height: 40px; }
.chat-title { display:block; font-weight: 700; font-size: 14px; color: #fff; }
.chat-close { background:none; border:none; color:#bbb; font-size:18px; cursor:pointer; }
.chat-body { flex:1; overflow-y:auto; padding: 12px; }
.chat-input { display:flex; gap:8px; padding: 10px 12px; border-top:1px solid #333; background:#151515; }
.chat-input input { flex:1; background:#1a1a1a; border:1px solid #333; color:#fff; border-radius: 8px; padding:8px 10px; outline:none; }
.chat-input .send-btn { background: #9c6db4; border:none; color:#fff; border-radius:8px; padding:8px 12px; cursor:pointer; }
.chat-quick-replies { display:flex; flex-wrap:wrap; gap:8px; padding: 6px 12px; border-top:1px dashed #333; background:#141414; }
.quick-btn { background:#222; color:#ddd; border:1px solid #333; border-radius:16px; padding:6px 10px; font-size:12px; cursor:pointer; }
.quick-btn:hover { background:#262626; }

.msg { display:flex; margin: 8px 0; }
.msg .bubble { max-width: 80%; padding:8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.msg.bot { justify-content:flex-start; }
.msg.bot .bubble { background:#1f1f1f; border:1px solid #333; }
.msg.user { justify-content:flex-end; }
.msg.user .bubble { background:#3a2b44; border:1px solid rgba(156,109,180,0.4); }

/* 隐藏标题：当最小化时，整个widget隐藏，不显示标题。依赖现有最小化机制 */
.chat-widget.minimized { display: none; }

/* Typing indicator for bot */
.bubble.typing { display: inline-flex; align-items: center; gap: 4px; }
.bubble.typing .dot { width: 6px; height: 6px; border-radius: 50%; background: #bbb; opacity: 0.6; animation: typingDots 1s infinite ease-in-out; }
.bubble.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDots {
  0% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-3px); opacity: 0.9; }
  100% { transform: translateY(0); opacity: 0.4; }
}

@media (max-width: 480px) {
  .chat-widget { right: 10px; bottom: 10px; width: 82vw; max-height: 40vh; border-radius: 12px; }
  .chat-header { padding: 7px 9px; min-height: 30px; }
  .chat-title { font-size: 12px; }
  .chat-close { font-size: 15px; }
  .chat-body { padding: 6px; }
  .chat-input { padding: 7px 9px; }
  .chat-input input { padding: 5px 7px; font-size: 12px; }
  .chat-input .send-btn { padding: 5px 9px; font-size: 12px; }
  .chat-quick-replies { padding: 6px 9px; }
  .quick-btn { padding: 4px 7px; font-size: 10px; }
  .msg .bubble { font-size: 11px; }
}

/* Launcher button when chat minimized */
.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #9c6db4; /* 紫色 */
  border: 2px solid #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  display: none; /* 默认隐藏，最小化时或已同意时显示 */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,0.4); }
.chat-launcher:active { transform: translateY(0); }
.chat-launcher .a-letter { font-weight: 800; font-size: 24px; color: #000; user-select: none; }

@media (max-width: 480px) {
  .chat-launcher { right: 10px; bottom: 10px; width: 42px; height: 42px; }
  .chat-launcher .a-letter { font-size: 18px; }
}

@media (max-width: 360px) {
  .chat-widget { width: 86vw; max-height: 38vh; }
  .chat-title { font-size: 11px; }
  .chat-input input { font-size: 11px; }
  .chat-input .send-btn { font-size: 11px; }
  .quick-btn { font-size: 9px; }
}