/* ══════════════════════════════════════════════
   瑞英车服 AI 工具箱 — 统一深色主题 v2.0
   色系：深蓝底 + 绿色系点缀
   ══════════════════════════════════════════════ */

:root {
  --bg-primary: #0a192f;
  --bg-secondary: #112240;
  --bg-card: #1a2d4d;
  --bg-input: #0d1f3c;
  --accent: #00b894;
  --accent-light: #00cec9;
  --accent-glow: rgba(0, 184, 148, 0.3);
  --text-primary: #e6f1ff;
  --text-secondary: #8892b0;
  --text-dim: #5a6a8a;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(0,184,148,0.3);
  --gradient-accent: linear-gradient(135deg, #00b894, #00cec9);
  --gradient-hero: linear-gradient(135deg, #0a192f 0%, #112240 50%, #1a365d 100%);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 40px rgba(0,184,148,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-light); }

/* ─── 导航栏 ─── */
.ai-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 25, 47, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ai-nav-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.ai-nav-links {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  flex-wrap: wrap;
}

.ai-nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}

.ai-nav-links a:hover,
.ai-nav-links a.active {
  color: var(--accent);
  background: rgba(0, 184, 148, 0.1);
}

.ai-nav-home {
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(0, 184, 148, 0.1);
  color: var(--accent) !important;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(0, 184, 148, 0.2);
}

.ai-nav-home:hover {
  background: rgba(0, 184, 148, 0.2) !important;
}

/* ─── Hero 区域 ─── */
.ai-hero {
  padding: 100px 2rem 50px;
  text-align: center;
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
}

.ai-hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  top: -200px;
  right: -100px;
  pointer-events: none;
}

.ai-hero-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.ai-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto;
}

/* ─── 内容区容器 ─── */
.ai-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.ai-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── 卡片系统 ─── */
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.ai-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.ai-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.ai-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
  background: rgba(0, 184, 148, 0.1);
}

.ai-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.ai-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 1.2rem;
}

.ai-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.ai-card-link:hover { gap: 10px; }

.ai-card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-live {
  background: rgba(0, 184, 148, 0.15);
  color: var(--accent);
  border: 1px solid rgba(0, 184, 148, 0.3);
}

.badge-new {
  background: rgba(255, 183, 77, 0.15);
  color: #ffb74d;
  border: 1px solid rgba(255, 183, 77, 0.3);
}

.badge-soon {
  background: rgba(136, 146, 176, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(136, 146, 176, 0.2);
}

/* ─── 按钮 ─── */
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.ai-btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.ai-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-glow);
  color: #fff;
}

.ai-btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid rgba(0, 184, 148, 0.4);
}

.ai-btn-outline:hover {
  background: rgba(0, 184, 148, 0.1);
  border-color: var(--accent);
}

.ai-btn-sm {
  padding: 8px 18px;
  font-size: 0.85rem;
}

/* ─── 表单元素 ─── */
.ai-input, .ai-select, .ai-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.ai-input:focus, .ai-select:focus, .ai-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ai-input::placeholder, .ai-textarea::placeholder {
  color: var(--text-dim);
}

.ai-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ai-form-group {
  margin-bottom: 1.2rem;
}

/* ─── 对话界面 ─── */
.chat-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 4px; }

.chat-msg {
  margin-bottom: 1.2rem;
  display: flex;
  gap: 12px;
  animation: msgIn 0.3s ease;
}

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

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

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.chat-msg.bot .chat-avatar { background: rgba(0, 184, 148, 0.15); }
.chat-msg.user .chat-avatar { background: rgba(9, 132, 227, 0.15); }

.chat-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.93rem;
  line-height: 1.7;
}

.chat-msg.bot .chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #0984e3, #00b894);
  color: #fff;
  border-top-right-radius: 4px;
}

.chat-bubble h1, .chat-bubble h2, .chat-bubble h3 {
  font-size: 1rem;
  margin: 0.8rem 0 0.4rem;
}

.chat-bubble h1:first-child, .chat-bubble h2:first-child, .chat-bubble h3:first-child {
  margin-top: 0;
}

.chat-bubble ul, .chat-bubble ol {
  padding-left: 1.2rem;
  margin: 0.5rem 0;
}

.chat-bubble strong { color: var(--accent-light); }
.chat-msg.user .chat-bubble strong { color: #fff; }

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

.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: var(--bg-primary);
}

.chat-input-area input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.chat-input-area input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input-area input::placeholder { color: var(--text-dim); }

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gradient-accent);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px var(--accent-glow);
}

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

/* 打字指示器 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* 快捷问题 */
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 1.5rem 1rem;
}

.quick-q {
  padding: 6px 14px;
  background: rgba(0, 184, 148, 0.08);
  border: 1px solid rgba(0, 184, 148, 0.2);
  border-radius: 20px;
  color: var(--accent);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
}

.quick-q:hover {
  background: rgba(0, 184, 148, 0.15);
  border-color: var(--accent);
}

/* ─── 统计数字 ─── */
.ai-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.ai-stat {
  text-align: center;
}

.ai-stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── 搜索框 ─── */
.ai-search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.ai-search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.ai-search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ai-search-box .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.1rem;
}

/* ─── 结果卡片 ─── */
.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.result-card:hover {
  border-color: var(--border-hover);
}

.result-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.8rem;
}

.result-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.score-high { background: rgba(0, 184, 148, 0.15); color: var(--accent); }
.score-mid { background: rgba(255, 183, 77, 0.15); color: #ffb74d; }
.score-low { background: rgba(136, 146, 176, 0.15); color: var(--text-secondary); }

/* ─── 计算器 ─── */
.calc-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.calc-result {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.calc-result-row:last-child { border-bottom: none; }

.calc-result-label { color: var(--text-secondary); font-size: 0.9rem; }

.calc-result-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}

.calc-result-total .calc-result-value {
  font-size: 1.5rem;
}

/* 滑块 */
.range-group { margin-bottom: 1.5rem; }

.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.range-value {
  font-weight: 700;
  color: var(--accent);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ─── 问卷 ─── */
.quiz-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 2rem;
}

.quiz-progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-card);
  transition: var(--transition);
}

.quiz-progress-dot.active {
  background: var(--accent);
}

.quiz-progress-dot.done {
  background: var(--accent);
  opacity: 0.5;
}

.quiz-option {
  display: block;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.93rem;
}

.quiz-option:hover {
  border-color: var(--accent);
  background: rgba(0, 184, 148, 0.05);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(0, 184, 148, 0.1);
}

/* ─── 页脚 ─── */
.ai-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.82rem;
}

.ai-footer a { color: var(--text-secondary); margin: 0 10px; }
.ai-footer a:hover { color: var(--accent); }

/* ─── Loading 动画 ─── */
.ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2rem;
  color: var(--text-secondary);
}

.ai-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 空状态 ─── */
.ai-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.ai-empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* ─── 标签 ─── */
.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(0, 184, 148, 0.1);
  color: var(--accent);
  border: 1px solid rgba(0, 184, 148, 0.2);
}

/* ─── Markdown 渲染 ─── */
.md-content h1 { font-size: 1.4rem; margin: 1.2rem 0 0.6rem; }
.md-content h2 { font-size: 1.2rem; margin: 1rem 0 0.5rem; }
.md-content h3 { font-size: 1.05rem; margin: 0.8rem 0 0.4rem; }
.md-content p { margin-bottom: 0.6rem; }
.md-content ul, .md-content ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.md-content li { margin-bottom: 0.3rem; }
.md-content strong { color: var(--accent-light); }
.md-content em { color: var(--text-secondary); }
.md-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 0.8rem 0;
  background: rgba(0, 184, 148, 0.05);
  border-radius: 0 8px 8px 0;
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
}

.md-content th, .md-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 0.88rem;
}

.md-content th {
  background: var(--bg-card);
  font-weight: 600;
}

/* ─── 响应式 ─── */
@media (max-width: 768px) {
  .ai-nav { padding: 0 1rem; }
  .ai-nav-links { display: none; }
  .ai-hero { padding: 80px 1rem 30px; }
  .ai-hero h1 { font-size: 1.6rem; }
  .ai-hero p { font-size: 0.95rem; }
  .ai-container { padding: 2rem 1rem; }
  .ai-grid { grid-template-columns: 1fr; }
  .chat-container { height: calc(100vh - 140px); }
  .chat-bubble { max-width: 88%; }
  .ai-stats { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .ai-stat-number { font-size: 1.6rem; }
  .calc-panel { padding: 1.2rem; }
  
  /* 移动端汉堡菜单 */
  .ai-nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 4px;
  }
  .ai-nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: var(--transition);
  }
  .ai-nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
  }
}

@media (min-width: 769px) {
  .ai-nav-toggle { display: none; }
}

/* ─── 打印隐藏 ─── */
@media print {
  .ai-nav, .ai-footer, .chat-input-area { display: none; }
}
