/* ===== Chat Widget ===== */
.chat-widget {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Toggle Button */
.chat-toggle {
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #1a3c6e, #2d5a9e);
  color: #fff; font-size: 24px; cursor: pointer;
  box-shadow: 0 4px 20px rgba(26,60,110,0.4);
  transition: all 0.3s ease; display: flex; align-items: center; justify-content: center;
}
.chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(26,60,110,0.5); }
.chat-toggle .chat-icon, .chat-toggle .close-icon { transition: all 0.3s ease; }
.chat-toggle .close-icon { display: none; }
.chat-toggle.active .chat-icon { display: none; }
.chat-toggle.active .close-icon { display: block; }

/* Phone Float */
.chat-phone-float {
  position: absolute; bottom: 70px; right: 0;
  width: 50px; height: 50px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #c8a45c, #a8853f);
  color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(200,164,92,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease;
}
.chat-phone-float:hover { transform: scale(1.1); }
.chat-phone-float .pulse {
  position: absolute; width: 100%; height: 100%; border-radius: 50%;
  background: rgba(200,164,92,0.3); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Chat Window */
.chat-window {
  position: absolute; bottom: 75px; right: 0;
  width: 360px; max-width: calc(100vw - 48px);
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  overflow: hidden; opacity: 0; visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}
.chat-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #1a3c6e, #0d2b52);
  color: #fff; padding: 16px; display: flex; align-items: center; gap: 12px;
}
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.chat-header-info h4 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.chat-header-status { font-size: 0.75rem; opacity: 0.8; }
.chat-header-status span { display: inline-flex; align-items: center; gap: 4px; }
.chat-header-status span::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #4ade80; }

/* Chat Messages */
.chat-messages { padding: 16px; max-height: 320px; overflow-y: auto; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #d9e3f2; border-radius: 2px; }
.msg { margin-bottom: 12px; }
.msg-bubble { padding: 10px 14px; border-radius: 12px; font-size: 0.88rem; line-height: 1.5; max-width: 85%; word-break: break-word; }
.msg-bot .msg-bubble { background: #f0f4fa; color: #334155; border-bottom-left-radius: 4px; }
.msg-user .msg-bubble { background: linear-gradient(135deg, #1a3c6e, #2d5a9e); color: #fff; border-bottom-right-radius: 4px; margin-left: auto; }
.msg-time { font-size: 0.68rem; color: #94a3b8; margin-top: 4px; }
.msg-user .msg-time { text-align: right; }

/* Quick Replies */
.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-btn { padding: 6px 12px; border: 1px solid #d9e3f2; border-radius: 16px; background: #fff; color: #1a3c6e; font-size: 0.78rem; cursor: pointer; transition: all 0.2s; }
.quick-btn:hover { background: #f0f4fa; border-color: #1a3c6e; }

/* Phone CTA */
.msg-phone-cta { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: linear-gradient(135deg, #f0f4fa, #e6edf5); border-radius: 12px; }
.msg-phone-cta span { font-size: 24px; }
.msg-phone-cta a { color: #1a3c6e; font-weight: 600; font-size: 1rem; text-decoration: none; }
.msg-phone-cta a:hover { color: #c8a45c; }
.msg-phone-cta div span { font-size: 0.72rem; color: #64748b; }

/* Input Area */
.chat-input-area { padding: 12px 16px; border-top: 1px solid #e5edf5; display: flex; gap: 8px; }
.chat-input { flex: 1; padding: 10px 14px; border: 1px solid #d9e3f2; border-radius: 20px; font-size: 0.88rem; outline: none; transition: border 0.2s; }
.chat-input:focus { border-color: #1a3c6e; }
.chat-send { width: 36px; height: 36px; border-radius: 50%; border: none; background: linear-gradient(135deg, #1a3c6e, #2d5a9e); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.chat-send:hover { transform: scale(1.1); }

/* Typing Indicator */
.typing-indicator { display: flex; gap: 4px; padding: 10px 14px; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; animation: typing 1.4s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }

/* Mobile */
@media (max-width: 768px) {
  .chat-widget { bottom: 16px; right: 16px; }
  .chat-window { width: calc(100vw - 32px); bottom: 70px; right: -16px; }
  .chat-toggle { width: 52px; height: 52px; font-size: 20px; }
}
