/* AI客服悬浮按钮与对话框样式 */

/* 悬浮按钮 */
.ai-support-fab {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: none;
}

.ai-support-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(102, 126, 234, 0.6);
}

.ai-support-fab svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.ai-support-fab .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #ff4757;
  border-radius: 50%;
  font-size: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* 对话框遮罩 */
.ai-support-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.ai-support-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* 对话框容器 */
.ai-support-dialog {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #1a1a2e;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.ai-support-dialog.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* 对话框头部 */
.ai-support-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-support-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-support-header .avatar svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.ai-support-header .info {
  flex: 1;
}

.ai-support-header .info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: white;
}

.ai-support-header .info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.ai-support-header .close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-support-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-support-header .close-btn svg {
  width: 16px;
  height: 16px;
  fill: white;
}

/* 消息区域 */
.ai-support-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-support-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-support-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* 消息气泡 */
.ai-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.ai-msg.bot {
  align-self: flex-start;
  background: #2d2d44;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
  white-space: pre-line;
}

.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-msg.bot .time,
.ai-msg.user .time {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.6;
}

/* 快捷问题 */
.ai-support-quick {
  padding: 12px 16px;
  background: #16162a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-support-quick p {
  margin: 0 0 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.ai-support-quick .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-support-quick .tag {
  padding: 6px 12px;
  background: rgba(102, 126, 234, 0.2);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 16px;
  font-size: 12px;
  color: #a0a0ff;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-support-quick .tag:hover {
  background: rgba(102, 126, 234, 0.4);
  color: white;
}

/* 输入区域 */
.ai-support-input {
  padding: 12px 16px;
  background: #16162a;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.ai-support-input textarea {
  flex: 1;
  background: #2d2d44;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  color: white;
  resize: none;
  max-height: 80px;
  min-height: 40px;
  outline: none;
  transition: border-color 0.2s;
}

.ai-support-input textarea:focus {
  border-color: #667eea;
}

.ai-support-input textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.ai-support-input .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
}

.ai-support-input .send-btn:hover {
  transform: scale(1.05);
}

.ai-support-input .send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-support-input .send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* 加载动画 */
.ai-msg.loading {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

.ai-msg.loading .dot {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.ai-msg.loading .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-msg.loading .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* 登录提示样式 */
.ai-msg.login-prompt {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
  border: 1px solid rgba(102, 126, 234, 0.3);
  max-width: 95%;
}

.ai-msg.login-prompt .login-prompt-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-msg.login-prompt .login-prompt-content p {
  margin: 0;
  line-height: 1.6;
  white-space: pre-line;
}

.ai-msg.login-prompt .login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.ai-msg.login-prompt .login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ai-msg.login-prompt .login-btn:active {
  transform: translateY(0);
}

.ai-msg.login-prompt .login-btn svg {
  flex-shrink: 0;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .ai-support-fab {
    bottom: 80px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
  
  .ai-support-dialog {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
  }
  
  .ai-support-dialog.show {
    transform: translateY(0);
  }
}
