/* 在线客服浮窗样式 */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(42, 82, 152, 0.4);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(42, 82, 152, 0.5);
}

.chat-toggle span {
  font-size: 28px;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(42, 82, 152, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(42, 82, 152, 0.6);
  }
}

.chat-notification {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4757;
  color: white;
  font-size: 12px;
  font-weight: bold;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-height: 600px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.chat-window.show {
  display: flex;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-header {
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.chat-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background: #2ed573;
  border-radius: 50%;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-close:hover {
  opacity: 1;
}

.chat-welcome {
  padding: 20px;
  text-align: center;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.chat-welcome-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
}

.chat-welcome h4 {
  margin: 0 0 8px;
  color: #333;
  font-size: 16px;
}

.chat-welcome p {
  margin: 0;
  color: #666;
  font-size: 13px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f0f2f5;
  max-height: 380px;
}

.chat-message {
  display: flex;
  margin-bottom: 16px;
  animation: messageIn 0.3s ease;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.admin {
  justify-content: flex-start;
}

.chat-message.visitor {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.admin .message-bubble {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.chat-message.visitor .message-bubble {
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.chat-message.admin .message-time {
  text-align: left;
}

.chat-message.visitor .message-time {
  text-align: right;
}

.chat-typing {
  padding: 8px 16px;
  display: none;
}

.chat-typing.show {
  display: block;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.chat-input-area {
  padding: 16px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.chat-input {
  display: flex;
  gap: 12px;
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input:focus {
  border-color: #2a5298;
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 快速短语 */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.quick-reply {
  padding: 6px 14px;
  background: #f0f2f5;
  border: 1px solid #ddd;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #333;
}

.quick-reply:hover {
  background: #e9ecef;
  border-color: #2a5298;
}

/* 联系选项 */
.contact-options {
  display: flex;
  gap: 12px;
  padding: 0 16px 16px;
  background: #f8f9fa;
}

.contact-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.contact-option:hover {
  background: #e8f0fe;
  border-color: #2a5298;
}

.contact-icon {
  font-size: 20px;
}

.contact-text {
  font-size: 13px;
  color: #333;
  font-weight: 500;
}

/* 企业微信二维码弹窗 */
.wechat-qr-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wechat-qr-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.wechat-qr-content {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.qr-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
}

.qr-close:hover {
  color: #333;
}

.wechat-qr-content h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #333;
}

.wechat-qr-content p {
  margin: 0 0 16px;
  color: #666;
  font-size: 14px;
}

.qr-code {
  margin-bottom: 12px;
}

.qr-code img {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.qr-tip {
  font-size: 13px !important;
  color: #999 !important;
}

/* 响应式调整 */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }
  
  .chat-window {
    width: calc(100vw - 32px);
    right: 0;
  }
  
  .chat-toggle {
    width: 52px;
    height: 52px;
  }
  
  .contact-options {
    flex-direction: column;
  }
}