/* ===== 技术社区全站样式系统 ===== */
/* 色彩系统：主色 #FE9A22 / 背景 #F6F7F9 / 卡片 #FFFFFF / 文字 #1F2329 / 辅助 #8F959E / 边框 #E5E6EB */

:root {
  --primary: #FE9A22;
  --primary-hover: #f08c15;
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --text: #1F2329;
  --text-secondary: #8F959E;
  --border: #E5E6EB;
  --border-light: #F0F1F3;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.10), 0 8px 24px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 56px;
}

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

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

a { color: inherit; text-decoration: none; }

/* ===== Header ===== */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-logo {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

/* 顶部分类导航 - 横排 pill */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
}

.header-nav::-webkit-scrollbar { display: none; }

.header-nav a {
  padding: 5px 14px;
  font-size: 14px;
  color: #555;
  border-radius: 16px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.header-nav a:hover { background: var(--bg); color: var(--text); }

.header-nav a.active { background: var(--primary); color: #fff; font-weight: 600; }

/* 搜索图标按钮 */
.header-search-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: #666;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.header-search-btn:hover { background: var(--bg); }

/* 搜索下拉框 */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-hover);
  display: none;
  z-index: 101;
  min-width: 280px;
}

.search-dropdown.open { display: block; }

.search-dropdown form {
  display: flex;
  gap: 8px;
}

.search-dropdown input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
}

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

.search-dropdown button {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}

.btn-login {
  padding: 5px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: #555;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-login:hover { border-color: var(--primary); color: var(--primary); }

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

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

.header-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mobile-menu-btn {
  display: none;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 20px;
  color: #666;
}

/* ===== Sub Nav / 次分类 ===== */
.sub-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-height);
  z-index: 99;
}

.sub-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
  flex-wrap: nowrap;
}

.sub-nav-inner::-webkit-scrollbar { display: none; }

.sub-nav a {
  padding: 5px 16px;
  font-size: 13px;
  color: #555;
  border: 1px solid var(--border);
  border-radius: 16px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
  background: #fff;
}

.sub-nav a:hover { border-color: var(--primary); color: var(--primary); }

.sub-nav a.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ===== Main Layout ===== */
.site-main {
  max-width: var(--max-width);
  margin: 16px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1024px) {
  .site-main { grid-template-columns: 1fr 260px; }
}

@media (max-width: 860px) {
  .site-main { grid-template-columns: 1fr; }
  .site-sidebar { display: none; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: block; }
}

/* ===== Feed ===== */
.feed-section { min-width: 0; }

.feed-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 4px;
  border: 1px solid var(--border);
  width: fit-content;
}

.feed-tab {
  padding: 6px 18px;
  font-size: 14px;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
}

.feed-tab:hover { color: var(--text); }

.feed-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* 线报风格列表 - 标题+时间 */
.line-feed {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed #e8e8e8;
  transition: background 0.12s;
}

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

.line-item:hover { background: #f7f7f7; }

.line-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.line-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ===== Sidebar ===== */
.site-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
}

.sidebar-box-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-box-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.sidebar-collection {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-collection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.sidebar-collection-item:hover { background: var(--bg); }

.sidebar-collection-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff5e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-collection-info { flex: 1; min-width: 0; }

.sidebar-collection-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-collection-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-hot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-hot-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: #444;
  line-height: 1.45;
  cursor: pointer;
  transition: color 0.2s;
  text-decoration: none;
}

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

.sidebar-hot-item:hover { color: var(--primary); }

.sidebar-hot-rank {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f6f8;
  color: #999;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}

.sidebar-hot-rank.top { background: #fff5e6; color: var(--primary); }

.sidebar-hot-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sidebar-author {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-author-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.sidebar-author-item img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-author-name {
  flex: 1;
  font-size: 13px;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-author-meta {
  font-size: 12px;
  color: #bbb;
}

/* ===== Pagination ===== */
.line-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.line-page-info {
  color: #888;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

.line-page-btn {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 13px;
  color: #555;
  border: 1px solid #e0e0e0;
  background: #fff;
  transition: all 0.15s;
  text-decoration: none;
}

.line-page-btn:hover { border-color: #333; color: #000; background: #fafafa; }

.line-page-btn.active { background: #333; color: #fff; border-color: #333; font-weight: 500; }

.line-page-arrow {
  padding: 0 12px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #666;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  transition: all 0.15s;
  text-decoration: none;
}

.line-page-arrow:hover { border-color: #333; color: #000; }

.line-page-arrow.disabled { color: #ccc; border-color: #eee; pointer-events: none; }

/* ===== Single Post ===== */
.single-post .site-header { border-bottom: 1px solid var(--border); }

.single-post .sub-nav { display: none; }

.single-post .site-main {
  grid-template-columns: 1fr;
  max-width: 800px;
}

.single-post .site-sidebar { display: none; }

.article-detail {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  border: 1px solid var(--border);
}

.article-detail-title {
  font-size: 26px;
  font-weight: 900;
  color: #111;
  line-height: 1.4;
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

.article-detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.article-detail-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.article-detail-author img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.article-detail-author-info { line-height: 1.4; }

.article-detail-author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.article-detail-author-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.article-detail-actions {
  display: flex;
  gap: 8px;
}

.article-detail-actions .btn-sm {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.article-detail-actions .btn-sm:hover { border-color: var(--primary); color: var(--primary); }

.article-detail-thumb {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  background: #f0f1f3;
}

.article-detail-content {
  font-size: 15px;
  line-height: 1.9;
  color: #333;
  word-break: break-word;
}

.article-detail-content > *:first-child { margin-top: 0; }

.article-detail-content p { margin: 0 0 16px; }

.article-detail-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 16px 0;
}

.article-detail-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

.article-detail-content h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 28px 0 14px;
  color: #111;
}

.article-detail-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: #111;
}

.article-detail-content ul, .article-detail-content ol {
  padding-left: 22px;
  margin: 0 0 16px;
}

.article-detail-content li { margin-bottom: 6px; }

.article-detail-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin: 16px 0;
  background: #fffbf5;
  border-radius: 0 8px 8px 0;
  color: #666;
}

.article-detail-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
}

.article-detail-content code {
  font-family: Menlo, Monaco, Consolas, monospace;
  background: #f5f6f8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--primary);
}

.article-detail-content pre code { background: transparent; padding: 0; color: inherit; }

.article-detail-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.article-detail-footer .btn-primary {
  padding: 9px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.article-detail-footer .btn-outline {
  padding: 9px 20px;
  background: #fff;
  color: #555;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.related-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.related-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.related-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.related-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: #444;
  text-decoration: none;
}

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

.related-item:hover { color: var(--primary); }

.related-item-date {
  font-size: 12px;
  color: #bbb;
  white-space: nowrap;
}

/* ===== Search Page ===== */
.search-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-filter-btn {
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.search-filter-btn:hover { border-color: var(--primary); color: var(--primary); }

.search-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.search-sort {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #999;
}

.search-sort a { color: #999; transition: color 0.2s; text-decoration: none; }

.search-sort a:hover, .search-sort a.active { color: var(--primary); }

/* ===== Footer ===== */
.site-footer {
  background: #252d38;
  color: #888b98;
  margin-top: 40px;
  padding: 40px 20px 24px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 200px;
  gap: 40px;
}

@media (max-width: 860px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
}

.footer-title {
  font-size: 15px;
  font-weight: 700;
  color: #ddd;
  margin-bottom: 12px;
}

.footer-text {
  font-size: 13px;
  line-height: 1.7;
  color: #6e6f7d;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 13px;
  color: #6e6f7d;
  transition: color 0.2s;
  text-decoration: none;
}

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

.footer-bottom {
  max-width: var(--max-width);
  margin: 24px auto 0;
  padding-top: 20px;
  border-top: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #555;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-bottom a { color: #666; text-decoration: none; }

.footer-qr img {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #bbb;
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }

.empty-state-text { font-size: 15px; }

/* ===== Utility ===== */
.text-muted { color: var(--text-secondary); }

.text-primary { color: var(--primary); }

.mt-16 { margin-top: 16px; }

.mb-16 { margin-bottom: 16px; }
