.ai-kefu-container {
  position: fixed;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ai-kefu-btn {
  position: fixed;
  right: 20px;
  bottom: 100px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 100001;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #07c160;
}

.ai-kefu-btn:hover {
  transform: scale(1.05);
}

.ai-kefu-btn:active {
  transform: scale(0.95);
}

.ai-kefu-icon {
  width: 32px;
  height: 32px;
}

.ai-kefu-close-icon {
  color: #fff;
  font-size: 24px;
  font-weight: bold;
}

.ai-kefu-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 100000;
}

.ai-kefu-window {
  position: fixed;
  right: 20px;
  bottom: 170px;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  z-index: 100001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
}

.ai-kefu-window-show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.ai-kefu-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #07c160;
}

.ai-kefu-header-left {
  display: flex;
  align-items: center;
}

.ai-kefu-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.ai-kefu-header-info {
  margin-left: 12px;
  display: flex;
  flex-direction: column;
}

.ai-kefu-title {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
}

.ai-kefu-status {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  margin-top: 2px;
}

.ai-kefu-status.online::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #4cd964;
  border-radius: 50%;
  margin-right: 4px;
}

.ai-kefu-header-right {
  display: flex;
}

.ai-kefu-header-btn {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-kefu-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-kefu-header-btn .delete-text {
  color: #fff;
  font-size: 12px;
}

.ai-kefu-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f9f9f9;
}

.ai-kefu-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.ai-kefu-welcome-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 16px;
}

.ai-kefu-welcome-text {
  font-size: 16px;
  color: #333;
  font-weight: bold;
  margin-bottom: 8px;
}

.ai-kefu-welcome-desc {
  font-size: 14px;
  color: #999;
  margin-bottom: 24px;
}

.ai-kefu-quick-questions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.ai-kefu-quick-item {
  padding: 8px 14px;
  background: #fff;
  border-radius: 15px;
  font-size: 13px;
  color: #666;
  border: 1px solid #eee;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-kefu-quick-item:hover {
  background: #f0f0f0;
  border-color: #ddd;
}

.ai-kefu-message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
}

.ai-kefu-message.user {
  flex-direction: row-reverse;
}

.ai-kefu-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ai-kefu-msg-content {
  max-width: 240px;
  padding: 10px 14px;
  border-radius: 12px;
  margin: 0 10px;
  position: relative;
}

.ai-kefu-message.assistant .ai-kefu-msg-content {
  background: #fff;
  border-top-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-kefu-message.user .ai-kefu-msg-content {
  background: #07c160;
  border-top-right-radius: 4px;
}

.ai-kefu-msg-text {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-all;
}

.ai-kefu-message.assistant .ai-kefu-msg-text {
  color: #333;
}

.ai-kefu-message.user .ai-kefu-msg-text {
  color: #fff;
}

.ai-kefu-msg-time {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  text-align: right;
}

.ai-kefu-message.assistant .ai-kefu-msg-time {
  color: #999;
}

.ai-kefu-message.user .ai-kefu-msg-time {
  color: rgba(255, 255, 255, 0.7);
}

.ai-kefu-typing {
  display: flex;
  align-items: center;
  padding: 6px 0;
}

.ai-kefu-typing-dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  margin: 0 3px;
  animation: typing 1.4s infinite ease-in-out both;
}

.ai-kefu-typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.ai-kefu-typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.ai-kefu-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
}

.ai-kefu-input {
  flex: 1;
  height: 36px;
  background: #f5f5f5;
  border-radius: 18px;
  padding: 0 16px;
  font-size: 14px;
  border: none;
  outline: none;
}

.ai-kefu-input:focus {
  background: #fff;
  box-shadow: 0 0 0 1px #07c160;
}

.ai-kefu-send-btn {
  margin-left: 12px;
  width: 60px;
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
  background: #ccc;
}

.ai-kefu-send-btn.can-send {
  background: #07c160;
}

.ai-kefu-send-btn.can-send:hover {
  opacity: 0.9;
}

@media (max-width: 480px) {
  .ai-kefu-window {
    width: calc(100vw - 40px);
    right: 20px;
    left: 20px;
    bottom: 170px;
    height: 60vh;
    max-height: 480px;
  }
  
  .ai-kefu-btn {
    right: 15px;
    bottom: 80px;
    width: 50px;
    height: 50px;
  }
  
  .ai-kefu-icon {
    width: 28px;
    height: 28px;
  }
}
