/* ============================================
   淘推小白学堂 - 自定义样式
   主色：#165DFF 深蓝
   ============================================ */

:root {
  --primary: #165DFF;
  --primary-dark: #0E42D2;
  --primary-light: #E8F0FF;
  --text-main: #1D2129;
  --text-secondary: #4E5969;
  --text-light: #86909C;
  --bg-gray: #F7F8FA;
  --border: #E5E6EB;
  --warning-bg: #FFF7E6;
  --warning-border: #FFD591;
  --warning-text: #D46B08;
  --danger-bg: #FFF1F0;
  --danger-border: #FFCCC7;
  --danger-text: #CF1322;
  --success-bg: #F6FFED;
  --success-border: #B7EB8F;
  --success-text: #389E0D;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  color: var(--text-main);
  background: #fff;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

/* ---------- 导航栏 ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: all 0.25s ease;
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.nav-menu a {
  display: block;
  padding: 8px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-menu a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-menu a.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-light);
}

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-main);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: 0.3s;
}

/* ---------- 主体容器 ---------- */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 88px 20px 40px;
}

/* ---------- 首屏 Banner ---------- */
.hero {
  background: linear-gradient(135deg, #165DFF 0%, #0E42D2 100%);
  color: #fff;
  border-radius: 16px;
  padding: 56px 40px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.hero h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.hero p {
  font-size: 16px;
  opacity: 0.9;
  margin: 0 0 24px;
  max-width: 640px;
  position: relative;
  z-index: 1;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.hero-tag {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
}

/* ---------- 通用区块 ---------- */
.section {
  margin-bottom: 48px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-main);
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 24px;
}

/* ---------- 卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.module-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s;
  display: block;
}

.module-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(22, 93, 255, 0.1);
  transform: translateY(-2px);
}

.module-card .card-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}

.module-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-main);
}

.module-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.module-card .card-arrow {
  display: inline-block;
  margin-top: 12px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- 公告板块 ---------- */
.notice-board {
  background: var(--bg-gray);
  border-radius: 12px;
  padding: 28px;
  border-left: 4px solid var(--primary);
}

.notice-item {
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}

.notice-item:last-child {
  border-bottom: none;
}

.notice-item .notice-date {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 10px;
  font-weight: 500;
}

.notice-item .notice-tag {
  display: inline-block;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 10px;
  font-weight: 500;
}

.notice-item h4 {
  display: inline;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.notice-item p {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: 0;
}

/* ---------- 流程图 ---------- */
.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
}

.flow-step {
  flex: 1;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  position: relative;
  margin: 6px;
}

.flow-step .step-num {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.flow-step h4 {
  font-size: 15px;
  margin: 0 0 6px;
  font-weight: 600;
}

.flow-step p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ---------- 热门知识点 ---------- */
.knowledge-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.knowledge-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.knowledge-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.knowledge-item .k-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-item h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}

.knowledge-item p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ---------- 子页面布局 ---------- */
.page-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}

/* 侧边锚点目录 */
.toc-sidebar {
  position: sticky;
  top: 88px;
  background: var(--bg-gray);
  border-radius: 10px;
  padding: 20px 16px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.toc-sidebar h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-main);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin-bottom: 2px;
}

.toc-list a {
  display: block;
  padding: 7px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
}

/* 文章内容区 */
.article-content {
  min-width: 0;
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-header .breadcrumb {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.article-header .breadcrumb a {
  color: var(--text-light);
  text-decoration: none;
}

.article-header .breadcrumb a:hover {
  color: var(--primary);
}

.article-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.3;
}

.article-header .article-desc {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0;
}

.article-section {
  margin-bottom: 36px;
}

.article-section h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
  line-height: 1.4;
}

.article-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-main);
}

.article-section p {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.8;
}

.article-section ul,
.article-section ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.article-section li {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.7;
}

.article-section strong {
  color: var(--primary);
  font-weight: 600;
}

/* 提示框 */
.alert-box {
  border-radius: 10px;
  padding: 18px 20px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.7;
}

.alert-box .alert-title {
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.alert-info {
  background: var(--primary-light);
  border: 1px solid #ADC6FF;
  color: var(--primary-dark);
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table th {
  background: var(--primary);
  color: #fff;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:nth-child(even) td {
  background: var(--bg-gray);
}

/* 对比两栏 */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.compare-col {
  border-radius: 10px;
  padding: 20px;
}

.compare-col.good {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.compare-col.bad {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
}

.compare-col h4 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.compare-col ul {
  margin: 0;
  padding-left: 20px;
}

.compare-col li {
  margin-bottom: 6px;
  font-size: 14px;
}

/* 步骤列表 */
.step-list {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.step-list > li {
  counter-increment: step;
  position: relative;
  padding: 16px 16px 16px 56px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.step-list > li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.step-list > li h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.step-list > li p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* 预算方案卡片 */
.budget-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.budget-card .budget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.budget-card .budget-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.budget-card .budget-label {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-gray);
  padding: 4px 12px;
  border-radius: 20px;
}

.budget-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.budget-item {
  background: var(--bg-gray);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.budget-item .bi-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.budget-item .bi-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.budget-item .bi-percent {
  font-size: 12px;
  color: var(--primary);
  margin-top: 4px;
}

/* 名词词典 */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.glossary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: all 0.2s;
}

.glossary-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(22, 93, 255, 0.08);
}

.glossary-card .term {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.glossary-card .term-en {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.glossary-card .definition {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.7;
  margin: 0;
}

.glossary-card .example {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* 词典搜索 */
.glossary-search {
  margin-bottom: 24px;
}

.glossary-search input {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.glossary-search input:focus {
  border-color: var(--primary);
}

/* 字母索引 */
.alphabet-index {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.alphabet-index a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-gray);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.alphabet-index a:hover {
  background: var(--primary);
  color: #fff;
}

/* ---------- 页脚 ---------- */
.footer {
  background: var(--bg-gray);
  border-top: 1px solid var(--border);
  padding: 40px 20px 24px;
  margin-top: 60px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 10px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 320px;
  line-height: 1.6;
}

.footer-links h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-main);
}

.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-disclaimer {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: left;
}

.footer-disclaimer strong {
  color: var(--warning-text);
}

.footer-copyright {
  font-size: 13px;
  color: var(--text-light);
}

/* ---------- 返回顶部 ---------- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .toc-sidebar {
    position: static;
    max-height: none;
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .budget-breakdown {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    gap: 2px;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-menu a {
    padding: 10px 12px;
  }

  .hero {
    padding: 36px 24px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero p {
    font-size: 14px;
  }

  .main-container {
    padding: 80px 16px 32px;
  }

  .section-title {
    font-size: 20px;
  }

  .article-header h1 {
    font-size: 22px;
  }

  .article-section h2 {
    font-size: 19px;
  }

  .flow-steps {
    flex-direction: column;
  }

  .flow-step {
    min-width: auto;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }

  .footer-top {
    flex-direction: column;
    gap: 24px;
  }

  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }
}
