/* ============ 设计令牌（亮色主题） ============ */
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --text: #1f2933;
  --text-2: #52606d;
  --text-3: #9aa5b1;
  --primary: #185fa5;
  --primary-2: #378add;
  --primary-soft: #e6f1fb;
  --ai: #7f77dd;
  --ai-2: #534ab7;
  --ai-soft: #eeedfe;
  --success: #1d9e75;
  --border: #e4e9f0;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(31, 41, 51, 0.06);
  --shadow-lg: 0 8px 30px rgba(31, 41, 51, 0.10);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ============ 顶部导航 ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  margin-right: 24px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
}

/* ============ 通用容器 ============ */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 20px; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 32px 20px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-ai { background: var(--ai); color: #fff; }
.btn-ai:hover { background: var(--ai-2); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: var(--surface-2); color: var(--text-2); }
.btn-ghost:hover { background: #e7edf5; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

/* ============ 卡片 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ============ 门户首页 ============ */
.hero {
  text-align: center;
  padding: 56px 20px 40px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%);
}
.hero h1 { font-size: 34px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.hero p { font-size: 17px; color: var(--text-2); max-width: 560px; margin: 0 auto 24px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ai-soft);
  color: var(--ai-2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 32px;
}
.test-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.test-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-2); }
.test-icon { font-size: 44px; margin-bottom: 14px; }
.test-card h3 { font-size: 19px; margin-bottom: 8px; }
.test-card p { color: var(--text-2); font-size: 14px; min-height: 42px; margin-bottom: 16px; }
.test-meta { font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.test-meta span { margin: 0 6px; }

.section-title { text-align: center; font-size: 24px; margin: 48px 0 8px; }
.section-sub { text-align: center; color: var(--text-2); margin-bottom: 8px; }

/* ============ 表单 ============ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input, .field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ============ AI 面板（核心新增） ============ */
.ai-panel {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 28px;
  box-shadow: var(--shadow);
  background-image:
    linear-gradient(#fff, #fff),
    linear-gradient(135deg, var(--ai) 0%, var(--primary-2) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.ai-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ai-panel-head .ai-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--ai), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.ai-panel-head h3 { font-size: 17px; }
.ai-panel-head .ai-sub { font-size: 12px; color: var(--text-3); }

.ai-report {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text);
  min-height: 60px;
  white-space: pre-wrap;
}
.ai-report h2, .ai-report h3, .ai-report h4 { margin: 16px 0 8px; color: var(--primary); font-size: 16px; }
.ai-report h2:first-child, .ai-report h3:first-child, .ai-report h4:first-child { margin-top: 0; }
.ai-report ul, .ai-report ol { padding-left: 22px; margin: 8px 0; }
.ai-report li { margin: 4px 0; }
.ai-report strong { color: var(--ai-2); }

/* 打字机光标 */
.ai-cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--ai);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.ai-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* 聊天 UI */
.ai-chat { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.ai-chat-head { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.chat-messages { max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.chat-msg { display: flex; gap: 10px; margin-bottom: 14px; }
.chat-msg .avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.chat-msg.ai .avatar { background: linear-gradient(135deg, var(--ai), var(--primary-2)); color: #fff; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .avatar { background: var(--primary-soft); color: var(--primary); }
.chat-bubble {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.7;
  max-width: 560px;
  white-space: pre-wrap;
}
.chat-msg.user .chat-bubble { background: var(--primary-soft); color: var(--primary); }
.chat-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chat-chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.chat-chip:hover { border-color: var(--ai); color: var(--ai-2); background: var(--ai-soft); }
.chat-input-row { display: flex; gap: 10px; }
.chat-input-row input {
  flex: 1; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: var(--font);
}
.chat-input-row input:focus { outline: none; border-color: var(--ai); box-shadow: 0 0 0 3px var(--ai-soft); }

/* 加载动画 */
.ai-loading { display: inline-flex; gap: 4px; padding: 8px 4px; }
.ai-loading span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ai);
  animation: bounce 1.2s infinite;
}
.ai-loading span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-weight: 600; color: var(--text-2); }
tr:hover td { background: var(--surface-2); }

/* ============ 工具类 ============ */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary);
}
.tag-disc { background: #e1f5ee; color: #0f6e56; }
.tag-pdp { background: #faeeda; color: #854f0b; }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: 14px; z-index: 999; box-shadow: var(--shadow-lg);
}

/* ============ 页脚 ============ */
.footer {
  text-align: center; padding: 32px 20px; color: var(--text-3); font-size: 13px;
  border-top: 1px solid var(--border); margin-top: 40px;
}

/* ============ 响应式 ============ */
@media (max-width: 720px) {
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; background: #fff; padding: 12px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
}
