/* ============================================================
   AI 聊天助手 - Catie API
   ============================================================ */

.qwq-ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.qwq-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--qwq-midnight), var(--qwq-lavender));
  border: 2px solid rgba(180,167,214,0.4);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(180,167,214,0.3), 0 0 20px rgba(91,124,153,0.2);
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  animation: qwq-float 3s ease-in-out infinite, qwq-melancholy-pulse 3s ease-in-out infinite;
  opacity: 0.9;
}

.qwq-chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(180,167,214,0.5), 0 0 30px rgba(91,124,153,0.3);
  opacity: 1;
}

@keyframes qwq-melancholy-pulse {
  0%, 100% { 
    box-shadow: 0 8px 24px rgba(180,167,214,0.3), 0 0 20px rgba(91,124,153,0.2);
  }
  50% { 
    box-shadow: 0 12px 32px rgba(180,167,214,0.5), 0 0 35px rgba(91,124,153,0.35);
  }
}

.qwq-chat-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: rgba(15,23,42,0.95);
  border: 2px solid rgba(180,167,214,0.25);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(91,124,153,0.15);
  backdrop-filter: blur(20px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: qwq-slide-in-up 0.4s ease-out;
}

.qwq-chat-panel.active {
  display: flex;
}

.qwq-chat-header {
  padding: 20px;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(236,72,153,0.2));
  border-bottom: 1px solid rgba(139,92,246,0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qwq-chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
}

.qwq-chat-icon {
  font-size: 1.5rem;
  animation: qwq-float 3s ease-in-out infinite;
}

.qwq-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.qwq-chat-close:hover {
  color: white;
}

.qwq-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.qwq-chat-messages::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}

.qwq-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.5);
  border-radius: 3px;
}

.qwq-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(139,92,246,0.7);
}

.qwq-chat-message {
  display: flex;
  gap: 12px;
  animation: qwq-fade-in 0.3s ease-out;
}

.qwq-chat-message.user {
  flex-direction: row-reverse;
}

.qwq-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--qwq-midnight), var(--qwq-lavender));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.qwq-chat-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 0.9rem;
}

.qwq-chat-message.assistant .qwq-chat-bubble {
  background: rgba(139,92,246,0.2);
  border: 1px solid rgba(139,92,246,0.3);
  color: rgba(255,255,255,0.9);
}

.qwq-chat-message.user .qwq-chat-bubble {
  background: rgba(236,72,153,0.2);
  border: 1px solid rgba(236,72,153,0.3);
  color: rgba(255,255,255,0.9);
}

.qwq-chat-typing {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
}

.qwq-chat-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--qwq-lavender);
  animation: qwq-typing 1.4s ease-in-out infinite;
}

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

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

@keyframes qwq-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-10px); opacity: 1; }
}

.qwq-chat-input-area {
  padding: 16px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(139,92,246,0.3);
  display: flex;
  gap: 12px;
}

.qwq-chat-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 12px;
  color: white;
  font-size: 0.9rem;
  resize: none;
  outline: none;
  transition: all 0.3s;
  max-height: 120px;
}

.qwq-chat-input:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(139,92,246,0.6);
}

.qwq-chat-input::placeholder {
  color: rgba(255,255,255,0.4);
}

.qwq-chat-send {
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--qwq-midnight), var(--qwq-lavender));
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.125rem;
}

.qwq-chat-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139,92,246,0.4);
}

.qwq-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.qwq-chat-welcome {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255,255,255,0.7);
}

.qwq-chat-welcome-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.qwq-chat-welcome h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: white;
}

.qwq-chat-welcome p {
  font-size: 0.9rem;
  line-height: 1.6;
}

.qwq-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.qwq-chat-suggestion {
  padding: 12px 16px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 12px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.875rem;
  text-align: left;
}

.qwq-chat-suggestion:hover {
  background: rgba(139,92,246,0.2);
  border-color: rgba(139,92,246,0.5);
  transform: translateX(4px);
}

/* 响应式 */
@media (max-width: 768px) {
  .qwq-ai-chat-widget {
    bottom: 16px;
    right: 16px;
  }
  
  .qwq-chat-button {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
  
  .qwq-chat-panel {
    bottom: 70px;
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
  }
}
