/* ============ GEO 诊断报告生成器 样式 ============ */
:root {
  --primary: #2f54eb;
  --primary-dark: #1d39c4;
  --primary-light: #eef1fe;
  --accent: #00b578;
  --warning: #fa8c16;
  --danger: #f5222d;
  --text: #1f2329;
  --text-sub: #5a6072;
  --text-muted: #8a90a3;
  --border: #e5e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(31, 35, 41, .06);
  --shadow-hover: 0 8px 30px rgba(47, 84, 235, .12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #5a7bff);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px;
}
.logo-text { font-weight: 700; font-size: 17px; }
.logo-sub { font-weight: 400; color: var(--text-muted); font-size: 13px; margin-left: 6px; }
.nav { display: flex; gap: 22px; }
.nav-link { color: var(--text-sub); text-decoration: none; font-size: 14px; }
.nav-link:hover, .nav-link.active { color: var(--primary); }

/* ---------- 顶栏右侧（导航 + 检测计数器） ---------- */
.topbar-right { display: flex; align-items: center; gap: 18px; }
.query-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f3f9;
  border: 1px solid #e3e7f2;
  white-space: nowrap;
  user-select: none;
}
.query-counter svg { flex-shrink: 0; }
.query-counter.has-history {
  color: var(--primary);
  background: #eef2ff;
  border-color: #d4dcff;
}

/* ---------- Hero ---------- */
.hero { padding: 46px 0 26px; text-align: center; }
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.gradient-text {
  background: linear-gradient(120deg, var(--primary), #00b578);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero p { color: var(--text-sub); max-width: 640px; margin: 0 auto 18px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hero-tags span {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 30px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.card-title { font-size: 20px; margin-bottom: 18px; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
.req { color: var(--danger); }
input[type="text"], textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  background: #fafbfe;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 84, 235, .12);
  background: #fff;
}
textarea { resize: vertical; }
.hint { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }
.comp-row { display: flex; gap: 10px; flex-wrap: wrap; }
.comp-input { flex: 1; min-width: 180px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* ---------- 竞品候选列表 ---------- */
.comp-gen-btn { margin-top: 8px; }
.comp-list-wrap { margin-top: 14px; }
.comp-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.comp-selected-count strong { color: var(--primary); font-size: 15px; }
.comp-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.comp-candidate {
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all .15s;
  background: #fafbfe;
}
.comp-candidate.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.comp-candidate-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13.5px;
}
.comp-checkbox { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.comp-candidate-rank {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #e8ecfb;
  color: var(--text-sub);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.comp-candidate.selected .comp-candidate-rank { background: var(--primary); color: #fff; }
.comp-candidate-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-candidate-score { color: var(--primary); font-weight: 700; font-size: 13px; flex-shrink: 0; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(120deg, var(--primary), #5a7bff);
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 84, 235, .3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(47, 84, 235, .4); }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-ghost:hover { background: var(--primary-light); }

/* ---------- 报告区 ---------- */
.report-wrap { padding-top: 30px; }
.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.report-toolbar h2 { font-size: 22px; }
.toolbar-actions { display: flex; gap: 10px; }

/* 数据来源标签 */
.source-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.source-tag.real {
  background: #e6f7ef;
  color: #0f8a4d;
  border: 1px solid #b7e4cc;
}
.source-tag.mock {
  background: #fff7e6;
  color: #c47b10;
  border: 1px solid #ffe1a8;
}

.report-card { page-break-inside: avoid; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sec-no {
  background: linear-gradient(135deg, var(--primary), #5a7bff);
  color: #fff;
  border-radius: 9px;
  padding: 4px 11px;
  font-weight: 800;
  font-size: 14px;
}
.section-head h3 { font-size: 19px; }

/* ---------- 封面 ---------- */
.cover-card {
  background: linear-gradient(135deg, #1d39c4 0%, #2f54eb 55%, #5a7bff 100%);
  color: #fff;
  text-align: center;
  padding: 70px 40px;
  border: none;
  position: relative;
  overflow: hidden;
}
.cover-card::after {
  content: "";
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  top: -120px; right: -90px;
}
.cover-card::before {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  bottom: -100px; left: -60px;
}
.cover-brand {
  font-size: 14px;
  letter-spacing: 4px;
  opacity: .85;
  margin-bottom: 26px;
  text-transform: uppercase;
}
.cover-company { font-size: 30px; margin-bottom: 18px; position: relative; z-index: 1; }
.cover-meta { display: flex; justify-content: center; gap: 28px; font-size: 13px; opacity: .85; position: relative; z-index: 1; }
.cover-badge {
  position: relative;
  z-index: 1;
  margin: 26px auto 0;
  width: 150px; height: 150px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(4px);
}
.cover-badge strong { font-size: 40px; line-height: 1.1; }
.cover-badge span { font-size: 13px; opacity: .9; }

/* ---------- 结论 ---------- */
.conclusion-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.conclusion-item {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  border-radius: 0 10px 10px 0;
  padding: 16px 18px;
}
.conclusion-item:nth-child(2) { border-color: var(--warning); background: #fff7e8; }
.conclusion-item:nth-child(3) { border-color: var(--accent); background: #e9faf2; }
.conclusion-item h4 { font-size: 15px; margin-bottom: 5px; }
.conclusion-item p { font-size: 14px; color: var(--text-sub); }

/* ---------- 评分看板 ---------- */
.overall-row { display: flex; align-items: center; gap: 30px; margin-bottom: 24px; flex-wrap: wrap; }
.overall-ring {
  width: 148px; height: 148px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--val) * 1%), #e8ecfb 0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ring-inner {
  width: 112px; height: 112px;
  background: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.ring-inner strong { font-size: 38px; color: var(--primary); line-height: 1.1; }
.ring-inner span { font-size: 13px; color: var(--text-muted); }
.overall-desc p { font-size: 15px; margin-bottom: 6px; }
.muted { color: var(--text-muted); font-size: 13.5px; }

.dims-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dim-item {
  background: #fafbfe;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.dim-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.dim-name { font-weight: 600; font-size: 14px; }
.dim-score { font-weight: 800; font-size: 18px; color: var(--primary); }
.dim-bar { height: 7px; background: #e8ecfb; border-radius: 10px; overflow: hidden; }
.dim-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #5a7bff); border-radius: 10px; transition: width .6s ease; }
.dim-note { margin-top: 7px; font-size: 12px; color: var(--text-muted); }

/* ---------- 竞品对比 ---------- */
.chart-wrap { margin-bottom: 16px; }
.chart-wrap canvas { width: 100%; height: auto; }
.comp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.comp-table th, .comp-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.comp-table th { background: var(--primary-light); color: var(--primary-dark); font-size: 13px; }
.comp-table tr.rank-1 td { font-weight: 700; }
.rank-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  border-radius: 12px;
  padding: 2px 9px;
  margin-left: 6px;
}

/* ---------- 问题诊断 ---------- */
.problem-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}
.problem-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: #fafbfe;
  border-bottom: 1px solid var(--border);
}
.problem-no {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #5a7bff);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.problem-title { flex: 1; font-weight: 700; font-size: 15px; }
.problem-level {
  font-size: 12px;
  padding: 3px 11px;
  border-radius: 12px;
  font-weight: 600;
}
.problem-level.severe { background: #fff1f0; color: var(--danger); }
.problem-level.mild { background: #fff7e8; color: var(--warning); }
.problem-body { padding: 16px 18px; }
.p-row { margin-bottom: 10px; font-size: 14px; }
.p-row:last-child { margin-bottom: 0; }
.p-label {
  display: inline-block;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 6px;
  padding: 2px 9px;
  margin-bottom: 4px;
}
.p-row p { color: var(--text-sub); }
.p-row p strong { color: var(--text); }

/* ---------- 优化路线 ---------- */
.roadmap-item {
  display: flex; gap: 18px;
  margin-bottom: 18px;
  position: relative;
}
.roadmap-item:last-child { margin-bottom: 0; }
.roadmap-item::before {
  content: "";
  position: absolute;
  left: 27px; top: 60px; bottom: -18px;
  width: 2px;
  background: var(--border);
}
.roadmap-item:last-child::before { display: none; }
.roadmap-no {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #5a7bff);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(47, 84, 235, .3);
}
.roadmap-content { padding-top: 2px; }
.roadmap-content h4 { font-size: 15px; margin-bottom: 5px; }
.roadmap-content p { font-size: 14px; color: var(--text-sub); }

/* ---------- 关键词库 ---------- */
.kw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kw-cat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: #fafbfe;
}
.kw-cat h4 { font-size: 14px; color: var(--primary); margin-bottom: 8px; }
.kw-cat ul { padding-left: 18px; }
.kw-cat li { font-size: 13.5px; color: var(--text-sub); margin-bottom: 5px; }

/* ---------- 07 章节 ---------- */
.qa-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.qa-item {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
}
.strategy-tip {
  background: linear-gradient(120deg, #e9faf2, #f0fbf6);
  border: 1px solid #bfe8d3;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  color: #0b6e46;
  font-weight: 600;
}

/* ---------- 页脚 ---------- */
.report-footer { text-align: center; color: var(--text-muted); font-size: 13px; padding: 10px 0 40px; }
.footer { text-align: center; color: var(--text-muted); font-size: 13px; padding: 30px 0 40px; }
.about-card h3 { margin-bottom: 10px; }
.about-card p { font-size: 14px; color: var(--text-sub); margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2329;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .3s;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .dims-grid, .kw-grid { grid-template-columns: 1fr; }
  .comp-list { grid-template-columns: 1fr; }
  .hero h1 { font-size: 25px; }
  .cover-company { font-size: 22px; }
  .cover-meta { flex-direction: column; gap: 6px; }
  .nav { display: none; }
}

/* ---------- 打印 / PDF 导出优化 ---------- */
@media print {
  .topbar, .toolbar-actions, .report-toolbar, .toast, .hero, #input-section, .about-card, .footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .cover-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sec-no, .dim-fill, .overall-ring, .roadmap-no, .rank-badge, .problem-no { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
