/* AI聊天悬浮窗样式 */
.ai-chat-float {
  position: fixed;
  right: 20px; /* 靠近滚动条但不遮挡 */
  bottom: 100px;
  z-index: 9999;
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: pulse 2s infinite, float 3s ease-in-out infinite;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  overflow: hidden;
}

.ai-chat-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* 脉冲动画效果 */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* 浮动动画效果 */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* 悬浮窗图标旋转效果 */
.ai-chat-float svg {
  width: 60px;
  height: 60px;
  transition: transform 0.5s ease;
}

.ai-chat-float:hover svg {
  transform: rotate(10deg);
}

/* 悬浮窗光晕效果 */
.ai-chat-float::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 175, 80, 0.3) 0%, rgba(76, 175, 80, 0) 70%);
  z-index: -1;
  animation: glow 2s ease-in-out infinite alternate;
}

/* 光晕动画效果 */
@keyframes glow {
  0% {
    opacity: 0.5;
    transform: scale(0.95);
  }
  100% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* 加载指示器样式 */
.ai-chat-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  color: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 通知样式 */
.ai-chat-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 400px;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  transition: all 0.3s ease;
}

.ai-chat-notification.error {
  background-color: #f8d7da;
  color: #721c24;
  border-left: 4px solid #f5c6cb;
}

.notification-content {
  display: flex;
  align-items: center;
  position: relative;
}

.notification-content i {
  margin-right: 10px;
  font-size: 18px;
}

.notification-content p {
  margin: 0;
  flex: 1;
}

.notification-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  margin-left: 10px;
  color: inherit;
  opacity: 0.7;
}

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

.ai-chat-notification.fade-out {
  opacity: 0;
  transform: translateX(100%);
}

/* 内嵌聊天窗口样式 */
.embedded-chat-container {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 350px;
  height: 450px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

.embedded-chat-container.show {
  transform: translateY(0);
  opacity: 1;
}

.chat-header {
  background-color: #4CAF50;
  color: white;
  padding: 15px;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 18px;
}

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

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

.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-message {
  margin-bottom: 15px;
  padding: 10px 15px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
}

.chat-message.system {
  background-color: #f1f1f1;
  color: #333;
  align-self: flex-start;
}

.chat-message p {
  margin: 5px 0;
}

.chat-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
}

.retry-btn, .contact-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.retry-btn {
  background-color: #2196F3;
  color: white;
}

.retry-btn:hover {
  background-color: #0b7dda;
}

.contact-btn {
  background-color: #FF9800;
  color: white;
}

.contact-btn:hover {
  background-color: #e68900;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .ai-chat-float {
    right: 20px;
    bottom: 80px;
  }
  
  .embedded-chat-container {
    width: 90%;
    right: 5%;
    left: 5%;
    height: 70vh;
    bottom: 80px;
  }
  
  .ai-chat-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .embedded-chat-container {
    height: 80vh;
    bottom: 70px;
  }
}