/* 慢刘日记 - 主样式文件 */

/* ===== 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    font-size: 14px; 
    line-height: 1.6; 
    color: #333; 
    background-color: #f5f5f5; 
}

a { text-decoration: none; color: #1890ff; }
a:hover { color: #40a9ff; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 15px; }

/* ===== 头部导航 ===== */
.header { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 100; }
.header-content { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 24px; font-weight: bold; color: #1890ff; }
.logo a { color: #1890ff; }
.header-nav { display: flex; gap: 20px; }
.header-nav a { color: #666; padding: 5px 15px; border-radius: 4px; }
.header-nav a:hover, .header-nav a.active { color: #1890ff; background: #e6f7ff; }

/* ===== 头部搜索框 ===== */
.header-search { display: flex; align-items: center; position: relative; margin-right: 10px; }
.header-search input { padding: 10px 40px 10px 16px; border: 1px solid #e8e8e8; border-radius: 24px; font-size: 14px; width: 200px; outline: none; background: #f5f5f5; transition: all 0.3s; }
.header-search input:focus { border-color: #1890ff; background: #fff; width: 240px; }
.header-search button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 8px; background: transparent; color: #999; border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: color 0.3s; }
.header-search button:hover { color: #1890ff; }

@media (max-width: 768px) {
    .header-search { margin-right: 5px; }
    .header-search input { width: 140px; padding: 8px 36px 8px 14px; font-size: 13px; }
    .header-search input:focus { width: 160px; }
}

/* ===== 主体内容布局 ===== */
.main-wrapper { display: flex; gap: 20px; padding: 20px 0; max-width: 1100px; margin: 0 auto; padding-left: 15px; padding-right: 15px; }

/* ===== 左侧边栏 ===== */
.sidebar-left { width: 260px; flex-shrink: 0; }
.sidebar-section { background: #fff; border-radius: 8px; margin-bottom: 20px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.sidebar-title { padding: 15px; background: #1890ff; color: #fff; font-weight: 500; font-size: 15px; }
.sidebar-content { padding: 10px 0; }
.sidebar-menu { list-style: none; }
.sidebar-menu li a { display: block; padding: 10px 15px; color: #666; border-left: 3px solid transparent; }
.sidebar-menu li a:hover { background: #f5f5f5; color: #1890ff; border-left-color: #1890ff; }
.sidebar-menu li a.active { background: #e6f7ff; color: #1890ff; border-left-color: #1890ff; }

/* ===== 右侧内容区 ===== */
.content-right { flex: 1; min-width: 0; }
.content-right.content-full { max-width: 1100px; margin: 0 auto; }
.content-box { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ===== 页面标题 ===== */
.page-title {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #1890ff;
}

/* ===== 文章列表 ===== */
.article-item.empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.article-item.top-highlight {
    background: #fff7e6;
}

.top-badge {
    font-weight: bold;
    margin-right: 8px;
}

/* ===== 关于页面 ===== */
.about-content {
    line-height: 1.8;
    color: #333;
}

.about-content p {
    margin-bottom: 15px;
}

.about-content h3 {
    margin: 25px 0 15px;
    color: #333;
}

.about-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.about-content li {
    margin-bottom: 8px;
}

/* ===== 二级分类筛选 ===== */
.subcategory-filter { display: flex; gap: 10px; padding: 15px; background: #f8f9fa; border-radius: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.subcategory-filter a { padding: 6px 16px; background: #fff; border-radius: 4px; color: #666; border: 1px solid #d9d9d9; }
.subcategory-filter a:hover { border-color: #1890ff; color: #1890ff; }
.subcategory-filter a.active { background: #1890ff; color: #fff; border-color: #1890ff; }

/* ===== 文章列表 ===== */
.article-list { list-style: none; }
.article-item { padding: 12px 0; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; width: 100%; }
.article-item:last-child { border-bottom: none; }
.article-main { display: flex; align-items: center; flex: 1; min-width: 0; }
.article-category { 
    display: inline-block;
    background: #e6f7ff; 
    color: #1890ff; 
    font-size: 12px; 
    white-space: nowrap; 
    margin-right: 12px;
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px solid #91d5ff;
}
.article-category:hover { 
    background: #1890ff;
    color: #fff; 
}
.article-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; }
.article-title a { color: #333; }
.article-title a:hover { color: #1890ff; }
.article-stats { color: #999; font-size: 12px; white-space: nowrap; margin-left: 30px; }
.elite-badge { background: #faad14; color: #fff; padding: 1px 6px; border-radius: 3px; font-size: 11px; margin-left: 8px; }
.top-badge { font-size: 12px; margin-left: 8px; white-space: nowrap; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 30px 0; }
.pagination a, .pagination span { padding: 8px 16px; background: #fff; border: 1px solid #d9d9d9; border-radius: 4px; color: #666; }
.pagination a:hover { border-color: #1890ff; color: #1890ff; }
.pagination .current { background: #1890ff; color: #fff; border-color: #1890ff; }

/* ===== 友情链接（纯文本样式） ===== */
.friend-links { 
    background: #fff; 
    padding: 15px 20px; 
    margin: 20px auto; 
    max-width: 1100px; 
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-size: 13px;
    color: #666;
}
.friend-links-title { color: #999; margin-right: 5px; }
.friend-links-title a { color: #1890ff; }
.friend-links a { color: #666; margin: 0 5px; }
.friend-links a:hover { color: #1890ff; text-decoration: underline; }

/* ===== 页脚 ===== */
.footer { background: #001529; color: #fff; padding: 40px 0 20px; margin-top: 40px; }
.footer-content { max-width: 1100px; margin: 0 auto; padding: 0 15px; }
.footer-qrcodes { display: flex; justify-content: center; gap: 40px; margin-bottom: 30px; }
.qrcode-item { text-align: center; }
.qrcode-item img { width: 100px; height: 100px; border-radius: 4px; margin-bottom: 8px; }
.qrcode-item p { font-size: 12px; color: rgba(255,255,255,0.7); }
.footer-copyright { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.footer-copyright p { color: rgba(255,255,255,0.6); margin: 5px 0; font-size: 13px; }
.footer-copyright a { color: rgba(255,255,255,0.8); }
.beian { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 10px; }
.beian img { height: 16px; }
.beian-img { width: 14px; height: 14px; vertical-align: middle; }

/* ===== 文章详情页 ===== */
.article-detail { padding: 20px 0; }

/* ===== 内容头部（文章页、书籍章节页共用） ===== */
.content-header { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #f0f0f0; }
.content-header h1 { font-size: 24px; margin-bottom: 15px; line-height: 1.4; color: #333; }
.content-header .subtitle { font-size: 14px; color: #999; margin-bottom: 10px; }
.content-header .meta { color: #999; font-size: 13px; }
.content-header .meta span { margin-right: 20px; }

/* ===== 内容主体（文章页、书籍章节页共用） ===== */
.content-body { line-height: 1.8; font-size: 15px; color: #333; }
.content-body p { margin-bottom: 15px; }
.content-body h2, .content-body h3 { margin: 25px 0 15px; color: #333; }
.content-body img { max-width: 100%; height: auto; border-radius: 4px; }
.content-body blockquote { margin: 20px 0; padding: 15px 20px; background: #f8f9fa; border-left: 4px solid #1890ff; color: #666; }
.content-body pre { background: #f8f9fa; padding: 15px; border-radius: 4px; overflow-x: auto; }
.content-body code { background: #f1f3f4; padding: 2px 6px; border-radius: 3px; font-family: Consolas, Monaco, monospace; }
.content-body table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.content-body th, .content-body td { border: 1px solid #e8e8e8; padding: 12px; text-align: left; }
.content-body th { background: #fafafa; }

/* ===== 内容导航（上一篇/下一篇、上一节/下一节共用） ===== */
.content-nav { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 20px; border-top: 1px solid #f0f0f0; }
.content-nav-prev, .content-nav-next { padding: 10px 0; }
.content-nav-prev a, .content-nav-next a { color: #666; padding: 10px 20px; background: #f5f5f5; border-radius: 4px; }
.content-nav-prev a:hover, .content-nav-next a:hover { background: #1890ff; color: #fff; }
.content-nav-label { color: #999; font-size: 13px; }

/* ===== 侧边栏卡片（相关文章、推荐内容共用） ===== */
.sidebar-card { margin-top: 40px; padding: 20px; background: #f8f9fa; border-radius: 8px; }
.sidebar-card h3 { margin-bottom: 15px; font-size: 16px; color: #333; }
.sidebar-card ul { list-style: none; }
.sidebar-card li { padding: 8px 0; border-bottom: 1px dashed #e8e8e8; }
.sidebar-card li:last-child { border-bottom: none; }
.sidebar-card a { color: #666; }
.sidebar-card a:hover { color: #1890ff; }

/* ===== 书籍阅读页专用 ===== */
.book-reader { display: flex; gap: 20px; }

/* 书籍目录 */
.book-toc { width: 280px; flex-shrink: 0; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); max-height: calc(100vh - 100px); overflow-y: auto; position: sticky; top: 80px; }
.book-toc-header { padding: 15px; background: #1890ff; color: #fff; font-weight: 500; }
.book-toc-header a { color: #fff; }
.toc-list { list-style: none; }
.toc-chapter { border-bottom: 1px solid #f0f0f0; }
.toc-chapter-title { display: flex; align-items: center; padding: 12px 15px; cursor: pointer; font-weight: 500; color: #333; background: #fafafa; }
.toc-chapter-title:hover { background: #f0f0f0; }
.toc-toggle { width: 20px; height: 20px; margin-right: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #999; }
.toc-sections { list-style: none; display: none; }
.toc-sections.expanded { display: block; }
.toc-sections li a { display: block; padding: 10px 15px 10px 43px; color: #666; font-size: 13px; border-left: 3px solid transparent; }
.toc-sections li a:hover { background: #f5f5f5; color: #1890ff; }
.toc-sections li a.active { background: #e6f7ff; color: #1890ff; border-left-color: #1890ff; }

/* 书籍内容区域 */
.book-content { flex: 1; background: #fff; border-radius: 8px; padding: 30px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); min-height: calc(100vh - 100px); }

/* 书籍介绍页 */
.book-intro { text-align: center; padding: 40px 20px; }
.book-intro-cover { width: 220px; height: 300px; margin: 0 auto 30px; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.book-intro-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-intro-cover-default { width: 220px; height: 300px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); margin: 0 auto 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; font-weight: bold; box-shadow: 0 10px 30px rgba(0,0,0,0.2); padding: 20px; text-align: center; }
.book-intro h1 { font-size: 28px; margin-bottom: 15px; color: #333; }
.book-intro-author { color: #666; margin-bottom: 20px; font-size: 15px; }
.book-intro-desc { color: #666; line-height: 1.8; max-width: 600px; margin: 0 auto 30px; text-align: left; }
.book-intro-meta { display: flex; justify-content: center; gap: 30px; color: #999; font-size: 14px; margin-bottom: 30px; }
.book-intro-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 30px; }
.book-intro-stats .stat-item { text-align: center; }
.book-intro-stats .stat-value { font-size: 24px; font-weight: bold; color: #1890ff; }
.book-intro-stats .stat-label { font-size: 13px; color: #999; margin-top: 5px; }
.btn-read { display: inline-block; padding: 12px 40px; background: #1890ff; color: #fff; border-radius: 4px; font-size: 16px; transition: background 0.3s; }
.btn-read:hover { background: #40a9ff; color: #fff; }
.btn-read:disabled { background: #ccc; cursor: not-allowed; }

/* ===== 书籍列表页 ===== */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; padding: 20px 0; }

.book-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.08); transition: transform 0.3s, box-shadow 0.3s; border: 1px solid #f0f0f0; }
.book-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }

.book-cover { width: 100%; height: 180px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: bold; text-align: center; padding: 20px; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }

.book-info { padding: 20px; }
.book-card-title { font-size: 17px; font-weight: 600; margin-bottom: 10px; color: #333; }
.book-card-author { color: #666; font-size: 13px; margin-bottom: 10px; }
.book-card-desc { color: #999; font-size: 13px; line-height: 1.6; margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.book-progress { margin-bottom: 15px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: #666; margin-bottom: 5px; }
.progress-bar { height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: #52c41a; border-radius: 3px; transition: width 0.3s; }

.book-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #999; }
.book-card-link { display: inline-block; padding: 8px 20px; background: #1890ff; color: #fff; border-radius: 4px; font-size: 13px; }
.book-card-link:hover { background: #40a9ff; color: #fff; }

.empty-books { text-align: center; padding: 60px 20px; color: #999; }
.empty-books svg { width: 80px; height: 80px; margin-bottom: 20px; opacity: 0.5; }

/* ===== 软件列表页 ===== */
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.software-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: 1px solid #f0f0f0; transition: transform 0.3s, box-shadow 0.3s; }
.software-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.software-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.software-name { font-size: 16px; font-weight: 600; margin: 0; }
.software-name a { color: #333; }
.software-name a:hover { color: #1890ff; }
.software-license { font-size: 12px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.software-license.free { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.software-license.partial { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.software-license.paid { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.software-category { color: #999; font-size: 13px; margin-bottom: 10px; }
.software-desc { color: #666; font-size: 14px; line-height: 1.6; margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.software-footer { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #999; }
.software-detail { color: #1890ff; }
.software-detail:hover { text-decoration: underline; }

/* ===== 软件详情页 ===== */
.software-detail-header { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #f0f0f0; }
.software-detail-header h1 { font-size: 24px; margin-bottom: 15px; }
.software-meta { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; color: #666; }
.software-meta span { display: flex; align-items: center; }
.software-detail-body h3 { font-size: 18px; margin: 25px 0 15px; color: #333; }
.software-description { line-height: 1.8; color: #333; font-size: 15px; }
.software-download { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 15px; }
.btn-download { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 6px; font-size: 14px; font-weight: 500; transition: all 0.3s; }
.btn-download.primary { background: #1890ff; color: #fff; }
.btn-download.primary:hover { background: #40a9ff; }
.btn-download.secondary { background: #f0f0f0; color: #333; }
.btn-download.secondary:hover { background: #e0e0e0; }
.no-download { color: #999; font-style: italic; }

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .main-wrapper { flex-direction: column; }
    .sidebar-left { width: 100%; }
    .header-content { flex-wrap: wrap; height: auto; padding: 10px 0; }
    .header-nav { width: 100%; justify-content: center; margin-top: 10px; }
    .footer-qrcodes { flex-wrap: wrap; gap: 20px; }
    .friend-links { margin: 10px 15px; }
    .book-reader { flex-direction: column; }
    .book-toc { width: 100%; max-height: 300px; position: relative; top: 0; }
}
