/* AI 助手面板样式 - 更人性化的设计 */
.ai-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-color);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: var(--transition);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  background: var(--primary-dark);
}

.ai-fab:active {
  transform: translateY(0);
}

.ai-fab.active {
  background: var(--error-color);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* AI 面板 */
.ai-panel {
  position: fixed;
  bottom: 110px;
  right: 32px;
  width: 400px;
  height: 600px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 499;
  animation: panelSlideUp 0.3s ease;
  border: 1px solid var(--border-color);
}

.ai-panel.active {
  display: flex;
}

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

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--card-bg), var(--bg-color));
  border-radius: var(--radius) var(--radius) 0 0;
}

.ai-panel-header h3 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.ai-welcome {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.ai-welcome p {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 8px;
}

/* 聊天消息 */
.chat-message {
  margin-bottom: 16px;
  animation: messageSlide 0.3s ease;
}

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

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

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

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-message.user .chat-bubble {
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
  background: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.chat-bubble p {
  margin-bottom: 8px;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.chat-bubble pre {
  background: #282c34;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.chat-bubble pre code {
  background: transparent;
  padding: 0;
}

/* 加载指示器 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* AI 面板底部 */
.ai-panel-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

.ai-panel-footer textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  font-family: inherit;
  margin-bottom: 12px;
}

.ai-panel-footer textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn-send {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-send:hover {
  background: var(--primary-dark);
}

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

/* 快速问题按钮 */
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-question-btn {
  padding: 6px 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.quick-question-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .ai-panel {
    width: calc(100% - 32px);
    right: 16px;
    bottom: 96px;
    height: 500px;
  }
  
  .ai-fab {
    width: 56px;
    height: 56px;
    bottom: 24px;
    right: 24px;
  }
  
  .ai-fab-icon {
    font-size: 24px;
  }
}
