/* 全局重置与基础变量（所有页面共用） */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", "Microsoft Yahei", "PingFang SC", Arial, sans-serif;
    max-width: 100%;
}

:root {
    /* 主色调（全局统一） */
    --primary: #5d69f3;
    --primary-light: #f0f1fd;
    --primary-hover: #4a54e1;
    --primary-dark: #3a41b8;
    /* 辅助色 */
    --success: #4ecc8b;
    --warning: #f7b538;
    --related-tag-color: #1d4ed8;
    /* 中性色 */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    /* 视觉样式 */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.04);
    /* 圆角 */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-full: 9999px;
    /* 过渡 */
    --transition: all 0.25s ease-in-out;
    /* 边框（全局统一极简线条） */
    --border-thin: 0.5px solid var(--gray-200);
    --border-hover: 0.5px solid rgba(93, 105, 243, 0.4);
    /* 最大宽度（仅PC） */
    --max-width: 1240px;
}

/* 基础样式（所有页面共用） */
body {
    background-color: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.75;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    overflow-x: hidden;
}

/* 通用容器（所有页面共用，居中核心） */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

/* ======================================
   1. 头部导航（所有页面共用）
   ====================================== */
.header {
    background: linear-gradient(135deg, #ffffff 0%, var(--gray-50) 100%);
    border-bottom: var(--border-thin);
    padding: 16px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;
}

.header-inner {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(93, 105, 243, 0.25);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    text-decoration: none;
    letter-spacing: -0.5px;
    position: relative;
    padding-bottom: 4px;
}

.logo span {
    color: var(--primary);
}

.logo::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.logo:hover::after {
    width: 100%;
}

/* 导航栏（所有页面共用） */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.main-nav a {
    color: var(--gray-700);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.main-nav a.active {
    color: var(--primary);
}

.main-nav a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

/* ======================================
   2. 核心布局（所有页面共用的左右布局）
   ====================================== */
.main-wrapper {
    padding: 40px 0;
}

.main-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* 左侧内容区（所有页面共用7:3比例） */
.content-left {
    flex: 7;
    min-width: 0;
}

/* 右侧侧边栏（所有页面共用3:7比例） */
.content-right {
    flex: 3;
    min-width: 280px;
}

/* ======================================
   3. 通用模块样式（所有页面共用）
   ====================================== */
/* 通用卡片容器 */
.card {
    background: #ffffff;
    border: var(--border-thin);
    border-radius: var(--radius-md);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}

.card:hover {
    border: var(--border-hover);
}

/* 通用标题样式 */
.card-title {
    font-size: 20px;
    color: var(--gray-800);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: var(--border-thin);
    font-weight: 600;
    position: relative;
}

.card-title::after {
    content: "";
    position: absolute;
    bottom: -0.5px;
    left: 0;
    width: 70px;
    height: 0.5px;
    background: var(--primary);
}

.card-title .icon {
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: var(--radius-xs);
    margin-right: 8px;
    vertical-align: middle;
}

/* ======================================
   4. 首页专属样式（仅首页使用）
   ====================================== */
/* Banner（仅首页） */
.banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 60px 0;
    margin-bottom: 20px;
}

.banner-content {
    max-width: 800px;
}

.banner h2 {
    font-size: 36px;
    margin-bottom: 16px;
    font-weight: 700;
}

.banner p {
    font-size: 18px;
    margin-bottom: 24px;
    opacity: 0.9;
}

.banner-btn {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.banner-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

/* 作者卡片（仅首页侧边栏） */
.author-card {
    text-align: center;
    padding: 10px 0;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    margin: 0 auto 12px;
}

.author-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.author-desc {
    font-size: 13px;
    color: var(--gray-600);
}

/* ======================================
   5. 列表页专属样式（仅列表页使用）
   ====================================== */
/* 筛选栏（仅列表页） */
.filter-bar {
    background: #ffffff;
    border: var(--border-thin);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group, .sort-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label, .sort-label {
    color: var(--gray-700);
    font-weight: 500;
}

.filter-item, .sort-item {
    color: var(--gray-600);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.filter-item.active, .sort-item.active {
    background: var(--primary);
    color: white;
}

.filter-item:hover, .sort-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* 分页（仅列表页） */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.page-btn, .page-num {
    display: inline-block;
    padding: 8px 16px;
    border: var(--border-thin);
    border-radius: var(--radius-xs);
    text-decoration: none;
    color: var(--gray-700);
    transition: var(--transition);
}

.page-num.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:hover, .page-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ======================================
   6. Tags页专属样式（仅Tags页使用）
   ====================================== */
/* 标签统计（仅Tags页） */
.tags-stat {
    padding: 20px 30px;
    margin-bottom: 30px;
}

.tags-stat h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.tags-stat .stat-num {
    color: var(--primary);
    font-weight: 600;
}

/* 标签分类（仅Tags页） */
.category-group {
    margin-bottom: 24px;
}

.category-group:last-child {
    margin-bottom: 0;
}

.category-group h4 {
    font-size: 16px;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-left: 8px;
    border-left: 4px solid var(--primary);
}

.tag-item {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.tag-item.lg {
    font-size: 16px;
    padding: 10px 20px;
}

.tag-item.md {
    font-size: 14px;
    padding: 8px 16px;
}

.tag-item.sm {
    font-size: 13px;
    padding: 6px 14px;
}

.tag-item span {
    margin-left: 8px;
    background: white;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 12px;
}

.tag-item:hover {
    background: var(--primary);
    color: white;
}

.tag-item:hover span {
    background: var(--primary-hover);
}

/* 热门标签列表（仅Tags页侧边栏） */
.hot-tags-list {
    list-style: none;
}

.hot-tags-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: var(--border-thin);
}

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

.hot-tags-list a {
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
}

.hot-tags-list a:hover {
    color: var(--primary);
}

.hot-tags-list .count {
    color: var(--gray-600);
    font-size: 13px;
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
}

/* ======================================
   7. 全局通用组件（所有页面共用）
   ====================================== */
/* 文章卡片（首页/列表页共用） */
.article-card {
    padding: 20px 0;
    border-bottom: var(--border-thin);
}

.article-card:last-child {
    border-bottom: none;
}

.article-card h4 {
    font-size: 18px;
    margin-bottom: 12px;
}

.article-card h4 a {
    color: var(--gray-800);
    text-decoration: none;
    transition: var(--transition);
}

.article-card h4 a:hover {
    color: var(--primary);
}

.article-desc {
    color: var(--gray-600);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.article-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-600);
}

.article-meta .tag {
    color: var(--primary);
    text-decoration: none;
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
}

/* 简易文章列表（首页/侧边栏共用） */
.simple-article-list {
    list-style: none;
}

.simple-article-list li {
    padding: 12px 0;
    border-bottom: var(--border-thin);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.simple-article-list a {
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
}

.simple-article-list a:hover {
    color: var(--primary);
}

.simple-article-list span {
    color: var(--gray-600);
    font-size: 13px;
}

/* 侧边栏模块（所有页面共用） */
.sidebar-card {
    padding: 24px;
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 18px;
    color: var(--gray-800);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: var(--border-thin);
    font-weight: 600;
    position: relative;
}

.sidebar-title::after {
    content: "";
    position: absolute;
    bottom: -0.5px;
    left: 0;
    width: 50px;
    height: 0.5px;
    background: var(--primary);
}

/* 阅读排行（所有页面侧边栏共用） */
.rank-list {
    list-style: none;
}

.rank-list li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: var(--border-thin);
}

.rank-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.rank-list li::before {
    content: attr(data-rank);
    position: absolute;
    left: 0;
    top: 2px;
    width: 24px;
    height: 24px;
    background: var(--primary-light);
    color: var(--primary);
    text-align: center;
    line-height: 24px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 600;
    border: 0.5px solid rgba(93, 105, 243, 0.1);
}

.rank-list li:nth-child(1)::before {
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 0 0 4px rgba(93, 105, 243, 0.15);
}

.rank-list li:nth-child(2)::before {
    background: var(--success);
    color: white;
    border: none;
}

.rank-list li:nth-child(3)::before {
    background: var(--warning);
    color: white;
    border: none;
}

.rank-list a {
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.rank-list a:hover {
    color: var(--primary);
}

/* 标签云（首页/Tags页共用） */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tags-cloud.big {
    gap: 16px;
    padding: 10px 0;
}

.tag-lg {
    font-size: 18px;
    padding: 8px 16px;
}

.tag-md {
    font-size: 16px;
    padding: 6px 14px;
}

.tag-sm {
    font-size: 14px;
    padding: 4px 12px;
}

.tag-xs {
    font-size: 13px;
    padding: 2px 10px;
}

.tag-xl {
    font-size: 20px;
    padding: 10px 18px;
}

.tags-cloud a {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.tags-cloud a:hover {
    background: var(--primary);
    color: white;
}

/* 标签筛选（列表页侧边栏） */
.tags-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tag-filter-item {
    padding: 8px 12px;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.tag-filter-item.active {
    background: var(--primary);
    color: white;
}

.tag-filter-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* 搜索框（列表页/Tags页共用） */
.search-box {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: var(--border-thin);
    border-radius: var(--radius-xs);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

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

.search-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

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

/* 推荐列表（Tags页侧边栏） */
.recommend-list {
    list-style: none;
}

.recommend-list li {
    padding: 8px 0;
    border-bottom: var(--border-thin);
}

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

.recommend-list a {
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.recommend-list a:hover {
    color: var(--primary);
}

/* ======================================
   8. 底部（所有页面共用）
   ====================================== */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--gray-600);
    font-size: 14px;
    border-top: var(--border-thin);
    background: #ffffff;
    width: 100%;
    margin-top: 0;
}

/* ======================================
   9. 兼容旧样式（相关标签）
   ====================================== */
.related-tag {
    color: var(--related-tag-color) !important;
    font-weight: 700;
    margin-right: 8px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-tag:hover {
    color: #1e40af !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}
/* ========== 文章页专属样式（隔离设计，不影响其他页面） ========== */
.article-page {
    --primary: #4f46e5; /* 主色，可自行修改（比如 #007bff 是蓝色） */
    --primary-light: #eeeffc;
}

/* 面包屑导航 */
.article-page .breadcrumb-wrap {
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}
.article-page .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
    flex-wrap: wrap;
}
.article-page .breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.article-page .breadcrumb a:hover {
    text-decoration: underline;
}
.article-page .separator {
    color: #d1d5db;
}
.article-page .current {
    color: #1f2937;
    font-weight: 500;
}

/* 文章正文容器 */
.article-page .article-detail {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 40px;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    width: 100%;
}
.article-page .article-title {
    font-size: 32px;
    color: #1f2937;
    line-height: 1.4;
    margin: 0 0 24px 0;
    font-weight: 700;
}
.article-page .article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #6b7280;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 30px;
}
.article-page .article-content {
    font-size: 16px;
    line-height: 1.8;
    color: #374151;
    width: 100%;
}
.article-page .article-content p {
    margin: 0 0 20px 0;
    text-align: justify;
}

/* 相关文章 */
.article-page .related-articles {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.article-page .related-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
}
.article-page .related-tag {
    color: var(--primary);
    text-decoration: none;
}
.article-page .related-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.article-page .related-list li {
    padding: 6px 0;
}
.article-page .related-list a {
    display: block;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    padding-left: 16px;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.article-page .related-list a::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}
.article-page .related-list a:hover {
    color: var(--primary);
    padding-left: 20px;
}

/* 侧边栏通用样式 */
.article-page .sidebar-module {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}
.article-page .sidebar-title {
    font-size: 18px;
    color: #1f2937;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
    position: relative;
    font-weight: 600;
}
.article-page .sidebar-title::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* 今日更新 */
.article-page .update-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.article-page .update-list li {
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
}
.article-page .update-list li:last-child {
    border-bottom: none;
}
.article-page .update-list a {
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.article-page .update-list a:hover {
    color: var(--primary);
    padding-left: 4px;
}

/* 阅读排行（极简稳定版，绝对不变形） */
.article-page .rank-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.article-page .rank-list li {
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
    line-height: 1.5;
}
.article-page .rank-list li:last-child {
    border-bottom: none;
}
.article-page .rank-list a {
    display: block;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    padding-left: 26px;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.article-page .rank-list a:hover {
    color: var(--primary);
    padding-left: 30px;
}
/* 排行数字标签（123彩色，45灰色） */
.article-page .rank-list li[data-rank="1"] a::before {
    content: "1";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    background:#ff6b6b; color:#fff;
}
.article-page .rank-list li[data-rank="2"] a::before {
    content: "2";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    background:#ff9f43; color:#fff;
}
.article-page .rank-list li[data-rank="3"] a::before {
    content: "3";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    background:#1dd1a1; color:#fff;
}
.article-page .rank-list li[data-rank="4"] a::before {
    content: "4";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    background:#f1f1f1; color:#666;
}
.article-page .rank-list li[data-rank="5"] a::before {
    content: "5";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    background:#f1f1f1; color:#666;
}

/* 热门关键词 */
.article-page .tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    margin: 0;
}
.article-page .tags-list a {
    padding: 8px 16px;
    background: #f9fafb;
    color: #4b5563;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
}
.article-page .tags-list a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}