/* 客服聊天弹窗样式 */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 聊天按钮 */
.chat-button {
  position: relative;
  width: 60px;
  height: 60px;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.chat-icon {
  width: 28px;
  height: 28px;
  color: #667eea;
}

.chat-notification {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: bounce 1s infinite;
}

/* 聊天窗口 */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.chat-window.active {
  display: flex;
}

/* 聊天头部 */
.chat-header {
  background: linear-gradient(135deg, #8b9dc3 0%, #667eea 100%);
  color: white;
  padding: 20px;
  border-radius: 20px 20px 0 0;
}

.chat-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

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

.chat-close-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-close-btn svg {
  width: 20px;
  height: 20px;
}

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

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

.chat-agent-avatar svg {
  width: 24px;
  height: 24px;
  color: white;
}

.chat-response-text {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

/* 聊天消息区域 */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
}

.chat-message {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.message-avatar {
  width: 32px;
  height: 32px;
  background: #667eea;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-avatar svg {
  width: 18px;
  height: 18px;
  color: white;
}

.message-content {
  flex: 1;
}

.message-bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.message-info {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  font-size: 12px;
  color: #666;
}

.agent-name {
  font-weight: 500;
}

/* 用户消息样式 */
.user-message {
  flex-direction: row-reverse;
}

.user-message .message-bubble {
  background: #667eea;
  color: white;
  border-radius: 18px 18px 4px 18px;
}

.user-message .message-avatar {
  background: #ddd;
}

/* 聊天输入区域 */
.chat-input-area {
  padding: 20px;
  background: white;
  border-top: 1px solid #eee;
}

.chat-input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f9fa;
  border-radius: 25px;
  padding: 8px 15px;
  border: 1px solid #e9ecef;
}

.chat-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  padding: 8px 0;
  color: #333;
}

.chat-input::placeholder {
  color: #999;
}

.chat-attach-btn,
.chat-send-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s ease;
  color: #666;
}

.chat-attach-btn:hover,
.chat-send-btn:hover {
  background: #e9ecef;
}

.chat-send-btn {
  color: #667eea;
}

.chat-send-btn:hover {
  background: rgba(102, 126, 234, 0.1);
}

.chat-attach-btn svg,
.chat-send-btn svg {
  width: 20px;
  height: 20px;
}

/* 动画效果 */
@keyframes pulse {
  0% {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
  100% {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
  60% {
    transform: translateY(-3px);
  }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-window {
    width: 300px;
    height: 450px;
  }
  
  .chat-widget {
    bottom: 15px;
    right: 15px;
  }
}

@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 40px);
    height: 400px;
    right: -10px;
  }
}
