/* 聊天界面样式 */
.chatbot-interface {
  position: absolute;
  background: #ffffff !important;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  z-index: 10000;
  min-width: 300px;
  max-width: 500px;
  overflow: hidden;
}

/* 聊天头部 */
.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9;
}

.chatbot-title {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.chatbot-actions {
  display: flex;
  gap: 8px;
}

.chatbot-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.chatbot-btn:hover {
  background: #e9ecef;
  color: #495057;
}

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

/* 消息容器 */
.chatbot-messages {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
  background: #ffffff;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 消息样式 */
.chatbot-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chatbot-message:last-child {
  margin-bottom: 0;
}

.chatbot-message-content {
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  /* white-space: pre-wrap; */
  position: relative;
}

/* 用户消息 */
.chatbot-message-user {
  align-items: flex-end;
}

.chatbot-message-user .chatbot-message-content {
  background: #007bff;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chatbot-message-user .chatbot-message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chatbot-message-user:hover .chatbot-message-actions {
  opacity: 1;
}

/* AI消息 */
.chatbot-message-assistant {
  align-items: flex-start;
}

.chatbot-message-assistant .chatbot-message-content {
  background: #f8f9fa;
  color: #2c3e50;
  border: 1px solid #e9ecef;
  border-bottom-left-radius: 4px;
}
.chatbot-message-assistant .chatbot-message-content:hover {
  background: #e9ecef;
  cursor: pointer;
}
/* 流式输出指示器 */
.chatbot-streaming-indicator {
  position: absolute;
  bottom: 8px;
  right: 12px;
  color: #007bff;
  font-size: 12px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* 消息操作按钮 */
.chatbot-message-actions .chatbot-btn {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.chatbot-restore {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 123, 255, 0.3);
  color: #007bff;
}

.chatbot-restore:hover {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* 状态栏 */
.chatbot-status {
  padding: 8px 16px;
  font-size: 12px;
  border-top: 1px solid #e1e5e9;
  background: #f8f9fa;
  color: #6c757d;
  min-height: 16px;
  display: flex;
  align-items: center;
}

.chatbot-status-info {
  color: #17a2b8;
  background: #e7f3ff;
}

.chatbot-status-warning {
  color: #856404;
  background: #fff3cd;
}

.chatbot-status-error {
  color: #721c24;
  background: #f8d7da;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chatbot-interface {
    min-width: 280px;
    max-width: 90vw;
  }

  .chatbot-messages {
    max-height: 200px;
  }

  .chatbot-message-content {
    max-width: 90%;
    font-size: 13px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .chatbot-interface {
    background: #2c3e50;
    border-color: #34495e;
    color: #ecf0f1;
  }

  .chatbot-header {
    background: #34495e;
    border-bottom-color: #4a5f7a;
  }

  .chatbot-title {
    color: #ecf0f1;
  }

  .chatbot-btn {
    color: #bdc3c7;
  }

  .chatbot-btn:hover {
    background: #4a5f7a;
    color: #ecf0f1;
  }

  .chatbot-messages {
    background: #2c3e50;
  }

  .chatbot-message-assistant .chatbot-message-content {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a5f7a;
  }

  .chatbot-status {
    background: #34495e;
    border-top-color: #4a5f7a;
    color: #bdc3c7;
  }

  .chatbot-status-info {
    background: #1e3a5f;
    color: #5dade2;
  }

  .chatbot-status-warning {
    background: #5d4e37;
    color: #f4d03f;
  }

  .chatbot-status-error {
    background: #5d2e2e;
    color: #ec7063;
  }
}

/* 动画效果 */
.chatbot-interface {
  animation: chatbot-fade-in 0.2s ease-out;
}

@keyframes chatbot-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 确保不与网站样式冲突 */
.chatbot-interface * {
  box-sizing: border-box;
  /* margin: 0; */
  /* padding: 0; */
}

.chatbot-interface *:not(svg) {
  font-family: inherit;
}

/* 防止被网站样式覆盖 */
/* .chatbot-interface {
  all: initial;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  position: absolute !important;
  z-index: 2147483647 !important;
}

.chatbot-interface * {
  all: unset;
  display: revert;
  box-sizing: border-box;
} */
