/* ========================================
   探洞 - 站点地图风格样式
   www.panyankecheng.cn
   ======================================== */

/* CSS 变量 */
:root {
  --accent-color: #9e9e9e;
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --text-color: #333;
  --text-light: #666;
  --text-muted: #999;
  --bg-color: #f5f5f5;
  --bg-white: #fff;
  --border-color: #e0e0e0;
  --tree-line: #d0d0d0;
  --link-color: #3498db;
  --link-hover: #2980b9;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --max-width: 1200px;
  --header-height: 64px;
}

/* 重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

ul {
  list-style: none;
}

/* ========================================
   布局组件
   ======================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--bg-white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  color: var(--text-color);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.nav a:hover,
.nav a.active {
  color: var(--link-color);
  border-bottom-color: var(--link-color);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-color);
  padding: 8px 16px;
  border-radius: 20px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 160px;
  font-size: 0.9rem;
}

.search-box button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
}

/* Footer */
.footer {
  background: var(--primary-color);
  color: #fff;
  padding: 48px 0 24px;
  margin-top: 64px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.7);
  margin-top: 12px;
  font-size: 0.9rem;
}

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #fff;
}

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

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ========================================
   面包屑导航
   ======================================== */

.breadcrumb {
  background: var(--bg-white);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--text-light);
}

.breadcrumb a:hover {
  color: var(--link-color);
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.breadcrumb-current {
  color: var(--text-color);
  font-weight: 500;
}

/* ========================================
   Hero 区域
   ======================================== */

.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  padding: 64px 0;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 32px;
}

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

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  display: block;
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   快捷链接
   ======================================== */

.quick-links {
  background: var(--bg-white);
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
}

.quick-links-inner {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-color);
  border-radius: var(--radius);
  color: var(--text-color);
  font-weight: 500;
  transition: all 0.2s ease;
}

.quick-link:hover {
  background: var(--link-color);
  color: #fff;
  transform: translateY(-2px);
}

/* ========================================
   主内容区域
   ======================================== */

.main-content {
  padding: 48px 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--link-color);
  border-radius: 2px;
}

/* ========================================
   树形结构 - 站点地图核心
   ======================================== */

.sitemap-tree {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.tree-list {
  position: relative;
}

.tree-item {
  position: relative;
  padding-left: 32px;
}

.tree-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--tree-line);
}

.tree-item:last-child::before {
  bottom: auto;
  height: 20px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  position: relative;
}

.tree-node::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--tree-line);
}

.tree-toggle {
  width: 20px;
  height: 20px;
  border: 2px solid var(--tree-line);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-white);
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.tree-toggle:hover {
  border-color: var(--link-color);
  color: var(--link-color);
}

.tree-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--link-color);
  font-size: 0.9rem;
}

.tree-content {
  flex: 1;
}

.tree-title {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
}

.tree-title a:hover {
  color: var(--link-color);
}

.tree-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tree-children {
  margin-left: 16px;
}

/* 树节点类型 */
.tree-node.category .tree-icon {
  background: rgba(52, 152, 219, 0.1);
  color: var(--link-color);
}

.tree-node.page .tree-icon {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success-color);
}

.tree-node.folder .tree-icon {
  background: rgba(243, 156, 18, 0.1);
  color: var(--warning-color);
}

/* ========================================
   分类网格
   ======================================== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.category-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.category-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.category-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--link-color), var(--link-hover));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.category-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.category-info span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.category-list {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.category-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.category-list li:last-child {
  border-bottom: none;
}

.category-list a {
  color: var(--text-color);
  font-size: 0.95rem;
}

.category-list a:hover {
  color: var(--link-color);
}

.category-list .count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-color);
  padding: 2px 8px;
  border-radius: 12px;
}

/* ========================================
   页面列表
   ======================================== */

.page-list-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 48px;
}

.page-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.page-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.page-item:hover {
  background: rgba(52, 152, 219, 0.05);
}

.page-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--link-color);
}

.page-info {
  flex: 1;
}

.page-title {
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 4px;
}

.page-url {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
}

.page-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.page-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========================================
   文章列表组件
   ======================================== */

.article-sections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.article-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.article-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.article-item:hover {
  background: rgba(52, 152, 219, 0.05);
}

.article-num {
  width: 24px;
  height: 24px;
  background: var(--link-color);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.article-item:nth-child(1) .article-num { background: #e74c3c; }
.article-item:nth-child(2) .article-num { background: #e67e22; }
.article-item:nth-child(3) .article-num { background: #f39c12; }

.article-content {
  flex: 1;
}

.article-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-title:hover {
  color: var(--link-color);
}

.article-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========================================
   文章详情页
   ======================================== */

.article-header {
  background: var(--bg-white);
  padding: 48px 0;
  border-bottom: 1px solid var(--border-color);
}

.article-header-inner {
  max-width: 800px;
  margin: 0 auto;
}

.article-category {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(52, 152, 219, 0.1);
  color: var(--link-color);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 24px;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.article-meta-bar span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-light);
}

.article-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 20px;
}

.article-content-block {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.article-content-block p {
  margin-bottom: 20px;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-color);
}

.article-content-block h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.article-content-block h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 16px;
}

.article-content-block ul,
.article-content-block ol {
  margin: 20px 0;
  padding-left: 24px;
}

.article-content-block li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.article-content-block ul li {
  list-style-type: disc;
}

.article-content-block ol li {
  list-style-type: decimal;
}

.article-content-block img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
}

/* ========================================
   页面信息卡片
   ======================================== */

.page-info-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.info-row {
  display: flex;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.info-label {
  width: 160px;
  font-weight: 500;
  color: var(--text-light);
}

.info-value {
  flex: 1;
  color: var(--text-color);
}

.priority-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.priority-high {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

.priority-medium {
  background: rgba(243, 156, 18, 0.1);
  color: #f39c12;
}

.priority-low {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success-color);
}

/* ========================================
   404 页面
   ======================================== */

.error-page {
  min-height: calc(100vh - var(--header-height) - 300px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.error-content {
  text-align: center;
  max-width: 500px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.8;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.error-desc {
  color: var(--text-light);
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--link-color);
  color: #fff;
}

.btn-primary:hover {
  background: var(--link-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-color);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* ========================================
   相关页面
   ======================================== */

.related-pages {
  margin-top: 48px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.related-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.related-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.related-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--link-color);
}

.related-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1024px) {
  .article-sections {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .search-box {
    display: none;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-stats {
    gap: 24px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .quick-links-inner {
    gap: 12px;
  }

  .quick-link {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

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

  .article-sections {
    grid-template-columns: 1fr;
  }

  .sitemap-tree {
    padding: 20px;
  }

  .tree-item {
    padding-left: 24px;
  }

  .page-list-section {
    padding: 20px;
  }

  .page-item {
    flex-wrap: wrap;
  }

  .page-meta {
    width: 100%;
    margin-top: 8px;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }

  .article-content-block {
    padding: 24px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .error-code {
    font-size: 5rem;
  }

  .error-actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 40px 0;
  }

  .main-content {
    padding: 32px 0;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .info-row {
    flex-direction: column;
    gap: 8px;
  }

  .info-label {
    width: auto;
  }
}
