/* ===== 重置 & 基础 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6366f1;
  --primary-light: #eef2ff;
  --primary-dark: #4f46e5;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.08);
  --radius: 12px;
  --radius-lg: 16px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ===== 导航栏 ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 64px;
}
.navbar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700;
  color: var(--text); flex-shrink: 0;
}
.navbar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.navbar-search {
  flex: 1; max-width: 480px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  padding: 9px 40px 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  font-size: 14px;
  outline: none;
  transition: all .2s;
}
.navbar-search input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}
.navbar-search button {
  position: absolute; right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: var(--primary); color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.navbar-search button:hover { background: var(--primary-dark); }
.navbar-nav {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.navbar-nav a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  transition: all .15s;
}
.navbar-nav a:hover { background: var(--bg); color: var(--text); }
.navbar-nav a.active { color: var(--primary); background: var(--primary-light); }
.navbar-admin {
  padding: 7px 16px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.navbar-admin:hover { background: #0f172a; }

/* ===== 容器 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ===== 首页英雄区 ===== */
.hero {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  color: #fff;
  padding: 64px 0 56px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 500px; height: 500px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30%; left: -5%;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.5px; }
.hero p { font-size: 16px; opacity: .9; max-width: 560px; margin: 0 auto 28px; }
.hero-search {
  max-width: 560px; margin: 0 auto;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 14px 56px 14px 24px;
  border: none;
  border-radius: 28px;
  font-size: 15px;
  outline: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.hero-search button {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--primary);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.hero-search button:hover { background: var(--primary-dark); }

/* ===== 分类筛选条 ===== */
.category-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.category-bar::-webkit-scrollbar { height: 0; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.cat-chip .cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.cat-chip .cat-count {
  font-size: 11px;
  background: rgba(0,0,0,.08);
  padding: 1px 6px;
  border-radius: 10px;
}
.cat-chip.active .cat-count { background: rgba(255,255,255,.2); }

/* ===== 文章卡片网格 ===== */
.section-title {
  font-size: 20px; font-weight: 700;
  margin: 8px 0 20px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px; height: 20px;
  background: var(--primary);
  border-radius: 2px;
}
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.article-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all .2s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.article-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.article-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.article-card .cat-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px; font-weight: 500;
  margin-bottom: 12px;
  width: fit-content;
}
.article-card .cat-tag::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
}
.article-card h3 {
  font-size: 16px; font-weight: 600;
  margin-bottom: 8px; line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card .excerpt {
  font-size: 13px; color: var(--text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.article-card .card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}
.article-card .card-footer .views { display: flex; align-items: center; gap: 4px; }

/* ===== 文章详情页 ===== */
.article-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
  margin-bottom: 20px;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }
.article-title {
  font-size: 32px; font-weight: 800;
  line-height: 1.3; margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.article-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 14px; color: var(--text-2);
}
.article-meta .meta-item { display: flex; align-items: center; gap: 6px; }
.article-content {
  font-size: 15px; line-height: 1.8;
  max-width: 100%;
  overflow-x: auto;
}
.article-content h1, .article-content h2, .article-content h3 {
  margin: 1.5em 0 0.6em;
  font-weight: 700;
}
.article-content h1 { font-size: 28px; }
.article-content h2 { font-size: 22px; }
.article-content h3 { font-size: 18px; }
.article-content p { margin-bottom: 1em; }
.article-content table {
  border-collapse: collapse;
  width: 100%; margin: 16px 0;
}
.article-content table th, .article-content table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
}
.article-content table th { background: var(--bg); font-weight: 600; }
.article-content img { border-radius: 8px; margin: 12px 0; }
.article-content canvas { max-width: 100%; }
.article-content pre {
  background: #1e293b; color: #e2e8f0;
  padding: 16px; border-radius: 8px;
  overflow-x: auto; margin: 12px 0;
  font-size: 13px;
}
.article-content code {
  background: var(--bg); padding: 2px 6px;
  border-radius: 4px; font-size: 13px;
}
.article-content pre code { background: transparent; padding: 0; }
.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px; margin: 16px 0;
  color: var(--text-2);
}

/* 搜索高亮 */
mark {
  background: #fef08a;
  color: #1e293b;
  padding: 1px 3px;
  border-radius: 3px;
}

/* ===== 搜索结果页 ===== */
.search-header {
  padding: 32px 0 16px;
}
.search-header h1 { font-size: 22px; font-weight: 700; }
.search-header .search-info { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.search-results { margin-bottom: 40px; }
.search-result-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  transition: all .15s;
}
.search-result-item:hover {
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.search-result-item h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.search-result-item h3 a { color: var(--primary); }
.search-result-item .excerpt { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.search-result-item .result-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); }

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.empty .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty h2 { font-size: 18px; color: var(--text-2); margin-bottom: 8px; }
.empty p { margin-bottom: 20px; }

/* ===== 页脚 ===== */
.footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 32px 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.footer a { color: #cbd5e1; }
.footer a:hover { color: #fff; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .navbar-inner { gap: 12px; }
  .navbar-nav { display: none; }
  .navbar-search { max-width: none; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }
  .article-title { font-size: 24px; }
  .article-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
}
