/* ========================================
   硬核马克 Web 前端 - PC 优先，参考 ai-bot.cn 风格
   ======================================== */

:root {
  --primary: #FF6154;
  --primary-dark: #e04d40;
  --primary-light: #fff5f5;
  --bg: #f5f6f7;
  --bg-white: #fff;
  --text: #1a1a2e;
  --text-secondary: #666;
  --text-tertiary: #999;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.08);
  --max-width: 1200px;
  --nav-height: 60px;
}

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

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

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--primary); }

/* ==================== 顶部导航 ==================== */
.top-nav {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  gap: 0;
}
.top-nav .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-right: 24px;
  flex-shrink: 0;
}
.top-nav .logo .icon { font-size: 20px; }

/* 搜索框 */
.nav-search {
  flex: 1;
  max-width: 400px;
  display: flex;
  margin-right: 16px;
}
.nav-search input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px 0 0 6px;
  font-size: 13px;
  outline: none;
  background: var(--bg);
}
.nav-search input:focus { border-color: var(--primary); background: var(--bg-white); }
.nav-search button {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  cursor: pointer;
}

/* 导航链接 */
.nav-links {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  flex-shrink: 0;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary-light); }

/* 用户区 */
.nav-user { display: flex; align-items: center; gap: 8px; margin-left: 16px; flex-shrink: 0; }

/* ==================== 主内容 ==================== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 24px 80px;
  min-height: calc(100vh - var(--nav-height));
}

/* ==================== 分类导航（大图标网格） ==================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 500px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.cat-item:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-hover); }
.cat-item .cat-icon { font-size: 24px; margin-bottom: 6px; }
.cat-item .cat-name { font-size: 12px; color: var(--text-secondary); }

/* ==================== 板块标题 ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}
.section-header h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.section-header a { font-size: 13px; color: var(--text-tertiary); }
.section-header a:hover { color: var(--primary); }

/* ==================== 工具卡片网格 ==================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 1100px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 450px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tool-card:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); }
.tool-card .tc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.tool-card .tc-icon img { width: 100%; height: 100%; object-fit: cover; }
.tool-card .tc-info { flex: 1; min-width: 0; }
.tool-card .tc-name { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.tool-card .tc-desc { font-size: 12px; color: var(--text-tertiary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-card .tc-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; display: flex; gap: 8px; }
.tool-card .tc-badge { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 10px; background: var(--primary); color: #fff; margin-right: 4px; }

/* ==================== 双栏布局（首页） ==================== */
.home-layout { display: flex; gap: 20px; }
.home-main { flex: 1; min-width: 0; }
.home-sidebar { width: 300px; flex-shrink: 0; }
@media (max-width: 900px) { .home-layout { flex-direction: column; } .home-sidebar { width: 100%; } }

/* ==================== 侧边栏卡片 ==================== */
.sidebar-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.sidebar-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  font-size: 13px;
}
.sidebar-item:last-child { border-bottom: none; }
.sidebar-item:hover { color: var(--primary); }
.sidebar-item .si-rank { width: 20px; height: 20px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.sidebar-item .si-rank.top { background: var(--primary); color: #fff; }
.sidebar-item .si-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item .si-stat { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }

/* 快讯条目 */
.news-side { padding: 6px 0; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.news-side:last-child { border-bottom: none; }
.news-side .ns-title { font-size: 13px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-side .ns-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.news-side:hover .ns-title { color: var(--primary); }

/* ==================== 列表页通用 ==================== */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.list-item { display: flex; gap: 12px; padding: 14px 16px; align-items: flex-start; border-bottom: 1px solid var(--border-light); background: var(--bg-white); }
.list-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.list-item:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: none; }
.list-item .thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; overflow: hidden; }
.list-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-item .info { flex: 1; min-width: 0; }
.list-item .title { font-size: 14px; font-weight: 500; }
.list-item .desc { font-size: 12px; color: var(--text-secondary); margin: 3px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-item .meta { font-size: 11px; color: var(--text-tertiary); }

/* ==================== 详情页 ==================== */
.article-detail { max-width: 780px; margin: 0 auto; }
.article-detail h1 { font-size: 24px; font-weight: 700; margin-bottom: 14px; line-height: 1.4; }
.article-detail .article-meta { color: var(--text-tertiary); font-size: 12px; margin-bottom: 20px; display: flex; gap: 14px; flex-wrap: wrap; }
.article-detail .article-body { font-size: 15px; line-height: 1.8; }
.article-detail .article-body p { margin-bottom: 14px; }
.article-detail .article-body img { max-width: 100%; border-radius: 6px; margin: 12px 0; }
.article-detail .article-body h2 { font-size: 18px; margin: 24px 0 10px; }
.article-detail .article-body h3 { font-size: 16px; margin: 18px 0 8px; }

/* ==================== 标签 ==================== */
.tag { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 11px; background: var(--bg); color: var(--text-secondary); margin-right: 3px; }
.tag-primary { background: var(--primary-light); color: var(--primary); }

/* ==================== 加载更多 ==================== */
.load-more { text-align: center; padding: 20px; }
.load-more button { padding: 8px 28px; background: var(--bg-white); border: 1px solid var(--border); border-radius: 20px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.load-more button:hover { border-color: var(--primary); color: var(--primary); }

/* ==================== 移动端 ==================== */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav { display: block; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-white); border-top: 1px solid var(--border); z-index: 100; }
  .bottom-nav .tabs { display: flex; }
  .bottom-nav .tab { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 0; font-size: 10px; color: var(--text-tertiary); }
  .bottom-nav .tab.active { color: var(--primary); }
  .nav-links { display: none; }
  .nav-search { max-width: 200px; }
  .main-content { padding: 12px 12px 80px; }
}

/* ==================== 登录弹窗 ==================== */
.auth-btn { padding: 5px 14px; background: var(--primary); color: #fff; border: none; border-radius: 5px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--bg-white); border-radius: 12px; padding: 28px; width: 400px; max-width: 90vw; }
.modal-close { cursor: pointer; font-size: 18px; color: var(--text-tertiary); }
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 12px; outline: none; }
.modal input:focus { border-color: var(--primary); }
.modal button { width: 100%; padding: 10px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 15px; cursor: pointer; }
.modal .switch { text-align: center; margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.modal .switch a { color: var(--primary); cursor: pointer; }

/* 通用 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.loading-state { text-align: center; padding: 40px; color: var(--text-tertiary); }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }