/* kf-theme-purple.css - Purple theme override for 客服页 (kf.html) */
:root {
  --bg-primary: #0b0a0d;
  --bg-secondary: #131022;
  --bg-tertiary: #191432;
  --bg-card: #1a1530;

  --text-primary: #ece8ff;
  --text-secondary: #a39bbf;
  --text-muted: #a39bbf;

  --primary-color: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-400: #a78bfa;

  --border-color: #2a2344;

  --shadow-lg: 0 10px 28px rgba(61,39,112,.35);

  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  /* 兼容旧页面变量别名 */
  --surface-color: var(--bg-tertiary);
  --background-color: #1e1940;

  /* Sidebar 变量统一映射到紫色主题 */
  --sidebar-bg-primary: var(--bg-secondary);
  --sidebar-bg-secondary: var(--bg-tertiary);
  --sidebar-bg-hover: #1e1940;
  --sidebar-bg-active: #231d4a;

  --sidebar-text-primary: var(--text-primary);
  --sidebar-text-secondary: var(--text-secondary);
  --sidebar-text-muted: var(--text-muted);

  /* 按钮强调色保持为颜色（避免被用于 border 时出现 gradient 无效） */
  --sidebar-accent-primary: var(--primary-color);
  --sidebar-accent-primary-hover: var(--primary-400);
  --sidebar-accent-secondary: var(--bg-tertiary);
  --sidebar-accent-secondary-hover: var(--border-color);

  --sidebar-gold: #ffb74d;
  --sidebar-gold-hover: #ffa726;

  --sidebar-avatar-bg: var(--bg-tertiary);

  --sidebar-border-primary: var(--border-color);
  --sidebar-border-secondary: var(--border-color);
}

body.kf-page {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI","PingFang SC","Microsoft YaHei", "Helvetica", Arial, sans-serif;
}

/* Chat container theme */
.kf-chat { padding: 16px; }
.kf-header .kf-title { color: var(--text-primary); }
.kf-status { color: var(--text-secondary); }

.kf-history {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

.kf-composer input[type="text"] {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.kf-composer button {
  border-radius: 8px;
}

/* Primary send button */
#kfSendText {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 4px 16px rgba(139,92,246,.22);
}
#kfSendText:hover { filter: brightness(1.05); box-shadow: 0 6px 18px rgba(139,92,246,.28); }

/* Secondary buttons */
#kfSendImage, #kfFaqBtn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
#kfSendImage:hover, #kfFaqBtn:hover {
  border-color: var(--primary-400);
  filter: brightness(1.05);
}

/* Bubbles */
.kf-msg {
  border: 1px solid transparent;
}
.kf-msg.user {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color)) !important;
  color: #fff;
  border-color: transparent;
}
.kf-msg.agent {
  background: #1e1940 !important;
  color: var(--text-primary);
  border-color: var(--border-color);
}
.kf-msg.local-faq {
  background: #223c2b !important;
}
.kf-meta {
  color: var(--text-secondary);
}

/* FAQ Drawer */
.kf-faq-drawer {
  background: var(--bg-secondary) !important;
  border-left: 1px solid var(--border-color) !important;
}
.kf-faq-header,
.kf-faq-search,
.kf-faq-list {
  background: var(--bg-secondary) !important;
}
.kf-faq-item {
  background: #161125;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.kf-faq-item:hover {
  background: #1e1940;
}

/* Small scrollbars within drawer/list */
.kf-faq-list::-webkit-scrollbar { width: 6px; }
.kf-faq-list::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 6px; }
.kf-faq-list::-webkit-scrollbar-thumb:hover { background: var(--border-color); }

/* ===== Sidebar purple overrides ===== */
.sidebar {
  background: var(--sidebar-bg-primary) !important;
  border-right: 1px solid var(--border-color);
}
.nav-link {
  background: var(--sidebar-bg-secondary) !important;
  color: var(--sidebar-text-primary) !important;
}
.nav-link:hover {
  background: var(--sidebar-bg-hover) !important;
}
.nav-item.active .nav-link {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color)) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(139,92,246,.35) !important;
  border: 1px solid transparent !important;
}
.sidebar-footer {
  background: var(--sidebar-bg-secondary) !important;
  border-top: 1px solid var(--border-color) !important;
}

/* 侧边栏底部按钮（充值/登录）与紫色主题对齐 */
.recharge-btn {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color)) !important;
  border: 1px solid transparent !important;
  box-shadow: 0 4px 12px rgba(139,92,246,.25) !important;
  color: #fff !important;
}
.recharge-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-400)) !important;
  border-color: transparent !important;
  transform: translateY(-2px);
}

.login-btn {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}
.login-btn:hover:not(:disabled) {
  background: var(--sidebar-accent-secondary-hover) !important;
  border-color: var(--primary-400) !important;
  filter: brightness(1.05);
}

/* 下载按钮区域色板细化（保持紫色系） */
.download-section {
  border-top: 1px solid rgba(167, 139, 250, 0.18) !important;
}
.download-buttons .nav-link {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color)) !important;
  border: 1px solid rgba(167, 139, 250, 0.35) !important;
  color: #fff !important;
}
.download-buttons .nav-link:hover:not([style*="opacity: 0.5"]) {
  box-shadow: 0 4px 8px rgba(139, 92, 246, 0.35) !important;
  transform: translateY(-2px);
}