/* ========================================
   AI创意工坊 - 对话页面样式（独立版）
   ======================================== */

/* ========================================
   聊天页面整体布局
   ======================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body, #app {
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary, #0d0d12);
  color: var(--text-primary, #e5e5e7);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chat-page {
  display: flex;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* ========================================
   左侧对话列表侧边栏
   ======================================== */

.chat-sidebar {
  width: 280px;
  background: rgba(18, 18, 24, 0.95);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-default);
}

.new-chat-btn {
  width: 100%;
  padding: 12px;
  background: var(--gradient-orange);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(254, 141, 22, 0.3);
}

.new-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 141, 22, 0.4);
}

.new-chat-btn svg { width: 18px; height: 18px; }

/* 对话列表 */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.chat-list-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 40px 20px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  position: relative;
}

.chat-item:hover { background: var(--bg-card-hover); }

.chat-item.active {
  background: rgba(254, 141, 22, 0.1);
  border: 1px solid var(--border-hover);
}

.chat-item-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-item.active .chat-item-icon { background: var(--gradient-orange); }

.chat-item-icon svg { width: 16px; height: 16px; stroke: var(--text-secondary); }
.chat-item.active .chat-item-icon svg { stroke: white; }

.chat-item-content { flex: 1; min-width: 0; }

.chat-item-title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-model {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 模型标签颜色 */
.model-badge.chatgpt {
  background: rgba(16, 163, 127, 0.15);
  border-color: rgba(16, 163, 127, 0.3);
  color: #10A37F;
}

.model-badge.kimi {
  background: rgba(107, 70, 193, 0.15);
  border-color: rgba(107, 70, 193, 0.3);
  color: #6B46C1;
}

.model-badge.deepseek {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #8B5CF6;
}

.chat-item-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: rgba(239, 68, 68, 0.8);
  border: none;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.chat-item:hover .chat-item-delete { opacity: 1; }
.chat-item-delete svg { width: 14px; height: 14px; stroke: white; }

/* 侧边栏底部用户信息 */
.chat-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-default);
}

/* 未登录时的登录按钮区域 */
.chat-login-area {
  padding: 8px;
}

.chat-login-btn {
  width: 100%;
  padding: 14px 20px;
  background: var(--gradient-orange);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(254, 141, 22, 0.3);
}

.chat-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 141, 22, 0.4);
}

.chat-login-btn svg { width: 18px; height: 18px; }

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
}

.chat-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--gradient-orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.chat-user-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.chat-user-vip {
  font-size: 0.75rem;
  color: var(--success);
}

.chat-user-vip.expired {
  color: #EF4444;
}

/* 退出登录按钮 */
.chat-logout-btn {
  margin-left: auto;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 8px;
  color: #EF4444;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.chat-logout-btn svg { width: 16px; height: 16px; }

/* 移动端侧边栏遮罩 */
.chat-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* ========================================
   右侧聊天主区域
   ======================================== */

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

/* 顶部栏 */
.chat-top-bar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 13, 18, 0.8);
  backdrop-filter: blur(10px);
}

.chat-top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.chat-menu-btn:hover { background: var(--bg-card-hover); }
.chat-menu-btn svg { width: 24px; height: 24px; }

.chat-top-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(254, 141, 22, 0.15);
  border: 1px solid var(--border-hover);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

.chat-top-actions { display: flex; gap: 8px; }

.chat-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.chat-action-btn svg { width: 18px; height: 18px; }

/* VIP过期横幅 */
.vip-expired-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  color: #EF4444;
  font-size: 0.85rem;
}

/* 未登录提示 */
.login-required {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.login-required-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-card);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-required-icon svg { width: 32px; height: 32px; stroke: var(--text-muted); }

.login-required h3 {
  font-size: 1.3rem;
  font-weight: 600;
}

.login-required p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-go-btn {
  padding: 12px 32px;
  background: var(--gradient-orange);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(254, 141, 22, 0.3);
  transition: all 0.3s ease;
}

.login-go-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 141, 22, 0.4);
}

/* ========================================
   欢迎页面
   ======================================== */

.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: var(--gradient-orange);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 30px var(--glow-orange);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-icon svg { width: 40px; height: 40px; stroke: white; }

.welcome-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--gradient-orange);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 40px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 600px;
}

.prompt-card {
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.prompt-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.prompt-card svg { width: 18px; height: 18px; stroke: var(--primary); }

/* ========================================
   消息区域
   ======================================== */

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.messages-container::-webkit-scrollbar { width: 6px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.message {
  display: flex;
  gap: 16px;
  max-width: 800px;
  animation: messageIn 0.3s ease;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message.assistant .message-avatar {
  background: var(--gradient-orange);
  box-shadow: 0 4px 15px var(--glow-orange);
}

.message.assistant.chatgpt .message-avatar {
  background: linear-gradient(135deg, #10a37f, #1a7f64);
  box-shadow: 0 4px 15px rgba(16, 163, 127, 0.3);
}

.message.assistant.kimi .message-avatar {
  background: linear-gradient(135deg, #6B46C1, #A78BFA);
  box-shadow: 0 4px 15px rgba(107, 70, 193, 0.3);
}

.message.assistant.deepseek .message-avatar {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}

.message.user .message-avatar {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
}

.message-avatar svg { width: 18px; height: 18px; stroke: white; }
.message.user .message-avatar svg { stroke: var(--text-secondary); }

.message-body { flex: 1; min-width: 0; }

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.message.user .message-header { justify-content: flex-end; }

.message-name { font-weight: 600; font-size: 0.9rem; }

.message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 16px 20px;
  line-height: 1.7;
  font-size: 0.95rem;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--gradient-orange);
  border: none;
}

.message-bubble p { margin-bottom: 12px; }
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.85em;
}

.message-bubble pre {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-bubble pre code { background: none; padding: 0; }

/* 消息中的图片 */
.message-image {
  margin-bottom: 8px;
}

.message-image img {
  max-width: 300px;
  max-height: 300px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
}

/* 打字中提示 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ========================================
   输入区域
   ======================================== */

.input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border-default);
  background: rgba(13, 13, 18, 0.8);
  backdrop-filter: blur(10px);
}

/* 图片预览条 */
.image-preview-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.image-preview-item {
  position: relative;
  display: inline-block;
}

.image-preview-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-default);
}

.image-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  background: #EF4444;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.image-preview-remove svg { width: 12px; height: 12px; stroke: white; }

.input-container {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 8px;
  transition: all 0.3s ease;
}

.input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(254, 141, 22, 0.15);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 12px 16px;
  outline: none;
  resize: none;
  max-height: 150px;
  min-height: 48px;
  font-family: inherit;
}

.chat-input::placeholder { color: var(--text-muted); }

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.input-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.input-btn svg { width: 20px; height: 20px; }

.send-btn {
  background: var(--gradient-orange);
  border: none;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(254, 141, 22, 0.3);
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(254, 141, 22, 0.4);
}

.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn svg { width: 20px; height: 20px; stroke: white; }

.input-tips {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ========================================
   响应式
   ======================================== */

@media (max-width: 768px) {
  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 100;
  }

  .chat-sidebar.open { transform: translateX(0); }
  .chat-sidebar-overlay.active { display: block; }

  .chat-menu-btn { display: block; }

  .chat-top-bar { padding: 12px 16px; }

  .welcome-title { font-size: 1.5rem; }
  .welcome-subtitle { font-size: 1rem; }

  .quick-prompts { padding: 0 20px; }

  .message { padding: 0 8px; }

  .input-area { padding: 12px 16px 20px; }

  .message-image img { max-width: 200px; max-height: 200px; }
}

@media (max-width: 480px) {
  .quick-prompts { flex-direction: column; }

  .prompt-card {
    width: 100%;
    justify-content: flex-start;
  }
}
