/* ============================================
   Books 读书笔记模块样式
   ============================================ */

/* 统计卡片看板 */
.books-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em;
    margin: 1.5em 0;
}

.stat-card {
    text-align: center;
    padding: 1.2em 0.8em;
    border-radius: 10px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.stat-card .stat-number {
    font-size: 2em;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85em;
    margin-top: 0.3em;
    opacity: 0.9;
}

.stat-total   { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-completed { background: linear-gradient(135deg, #43e97b, #38f9d7); color: #1a3a2a; }
.stat-reading { background: linear-gradient(135deg, #f6d365, #fda085); color: #4a3520; }
.stat-planned { background: linear-gradient(135deg, #a1c4fd, #c2e9fb); color: #1a3050; }

/* 分类卡片网格 */
.books-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5em;
    margin: 1.5em 0;
}

.books-category-card {
    display: flex;
    align-items: flex-start;
    gap: 1em;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.5em;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.books-category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    text-decoration: none;
    color: inherit;
}

.books-category-card .category-card-icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.books-category-card .category-card-content {
    flex: 1;
    min-width: 0;
}

.books-category-card .category-card-content h3 {
    margin: 0 0 0.2em;
    font-size: 1.2em;
    color: #333;
}

.books-category-card .category-card-content .category-card-subtitle {
    margin: 0 0 0.5em;
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.books-category-card .category-card-content .category-card-desc {
    margin: 0 0 0.8em;
    font-size: 0.85em;
    color: #777;
    line-height: 1.5;
}

.books-category-card .category-card-content .category-card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #888;
    margin-bottom: 0.4em;
}

.books-category-card .category-card-content .category-progress-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.books-category-card .category-card-content .category-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #43e97b, #38f9d7);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* 书籍条目卡片 */
.books-entry-card {
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.2em 1.5em;
    margin-bottom: 1em;
    transition: box-shadow 0.2s ease;
}

.books-entry-card:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.books-entry-card.books-entry-completed {
    border-left: 4px solid #4caf50;
}

.books-entry-card.books-entry-reading {
    border-left: 4px solid #ff9800;
}

.books-entry-card.books-entry-planned {
    border-left: 4px solid #9e9e9e;
}

.books-entry-card .entry-status-badge {
    position: absolute;
    top: 1em;
    right: 1em;
    font-size: 0.75em;
    padding: 0.2em 0.7em;
    border-radius: 12px;
    font-weight: 500;
}

.books-entry-card .entry-status-badge.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.books-entry-card .entry-status-badge.status-reading {
    background: #fff3e0;
    color: #e65100;
}

.books-entry-card .entry-status-badge.status-planned {
    background: #f5f5f5;
    color: #616161;
}

.books-entry-card .entry-content h4 {
    margin: 0 0 0.3em;
    font-size: 1.05em;
    color: #333;
}

.books-entry-card .entry-content h4 a {
    color: #333;
    text-decoration: none;
}

.books-entry-card .entry-content h4 a:hover {
    color: #00369f;
    text-decoration: underline;
}

.books-entry-card .entry-content .entry-date {
    margin: 0 0 0.4em;
    font-size: 0.8em;
    color: #999;
}

.books-entry-card .entry-content .entry-category {
    margin: 0 0 0.4em;
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.books-entry-card .entry-content .entry-excerpt {
    margin: 0 0 0.6em;
    font-size: 0.9em;
    color: #555;
    line-height: 1.6;
}

.books-entry-card .entry-content .entry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
}

.books-entry-card .entry-content .entry-tags .entry-tag {
    background: #e8eaf6;
    color: #3f51b5;
    padding: 0.2em 0.6em;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .books-dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .books-category-grid {
        grid-template-columns: 1fr;
    }

    .books-category-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .books-category-card .category-card-content .category-card-stats {
        justify-content: center;
        gap: 1em;
    }
}

/* ============================================
   Book Article 文章详情页样式
   ============================================ */

.book-article-page .page__content {
    max-width: 1200px;
    margin: 0 auto;
}

/* 文章头部（紧凑） */
.book-article-header {
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 2px solid #e0e0e0;
}

.book-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
}

.book-article-back {
    display: inline-block;
    color: #3f51b5;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.book-article-back:hover {
    text-decoration: underline;
    color: #1a237e;
}

.book-article-title {
    font-size: 1.6em;
    margin: 0.2em 0 0.4em;
    color: #222;
    line-height: 1.3;
}

.book-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 0.5em;
}

.book-status {
    padding: 0.15em 0.6em;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 500;
}

.book-status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.book-status-reading {
    background: #fff3e0;
    color: #e65100;
}

.book-status-planned {
    background: #f5f5f5;
    color: #616161;
}

.book-article-excerpt {
    font-size: 0.95em;
    color: #555;
    line-height: 1.6;
    margin: 0.3em 0 0;
}

/* 两栏布局容器 */
.book-article-layout {
    display: flex;
    gap: 2em;
    align-items: flex-start;
}

/* 左侧章节目录（sticky） */
.book-chapter-nav {
    flex-shrink: 0;
    width: 260px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.2em;
    position: sticky;
    top: 80px;
    z-index: 10;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.book-chapter-nav h3 {
    margin: 0 0 0.8em;
    font-size: 1em;
    color: #333;
}

.chapter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: chapter-counter;
}

.chapter-item {
    margin-bottom: 0.2em;
}

.chapter-item.chapter-active .chapter-link {
    background: #e8eaf6;
    color: #1a237e;
    font-weight: 600;
}

.chapter-link {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    padding: 0.5em 0.6em;
    border-radius: 6px;
    text-decoration: none;
    color: #444;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 0.9em;
}

.chapter-link:hover {
    background: #f0f0f0;
    text-decoration: none;
    color: #1a237e;
}

.chapter-number {
    flex-shrink: 0;
    font-size: 0.8em;
    color: #888;
    font-weight: 500;
    min-width: 3.5em;
}

.chapter-title-text {
    flex: 1;
    font-size: 0.95em;
    line-height: 1.4;
}

/* 右侧章节内容 */
.book-chapters-content {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}

.book-chapter {
    padding: 1.5em 0;
}

.chapter-heading {
    display: flex;
    align-items: center;
    gap: 0.8em;
    font-size: 1.4em;
    color: #222;
    margin-bottom: 0.3em;
}

.chapter-badge {
    display: inline-block;
    background: #3f51b5;
    color: white;
    padding: 0.2em 0.7em;
    border-radius: 15px;
    font-size: 0.55em;
    font-weight: 600;
    flex-shrink: 0;
}

.chapter-subtitle {
    font-size: 0.95em;
    color: #777;
    margin: 0 0 1.2em;
    font-style: italic;
}

.chapter-body {
    line-height: 1.8;
    color: #333;
}

.chapter-body h2,
.chapter-body h3,
.chapter-body h4 {
    color: #222;
    margin-top: 1.5em;
}

.chapter-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9em;
}

.chapter-body table th,
.chapter-body table td {
    padding: 0.6em 0.8em;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.chapter-body table th {
    background: #f5f5f5;
    font-weight: 600;
}

.chapter-body blockquote {
    border-left: 4px solid #3f51b5;
    background: #f8f9fa;
    padding: 0.8em 1.2em;
    margin: 1.2em 0;
    border-radius: 0 6px 6px 0;
    color: #444;
}

.chapter-body code {
    background: #f0f0f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.chapter-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
}

.chapter-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.chapter-divider {
    border: none;
    border-top: 2px dashed #e0e0e0;
    margin: 2em 0;
}

/* 底部提示 */
.book-chapter-pagination {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 2px solid #e0e0e0;
}

.pagination-hint {
    text-align: center;
    color: #888;
    font-size: 0.9em;
    padding: 1em;
    background: #f8f9fa;
    border-radius: 8px;
}

/* 响应式 */
@media (max-width: 900px) {
    .book-article-layout {
        flex-direction: column;
    }

    .book-chapter-nav {
        width: 100%;
        position: static;
        max-height: none;
    }

    .book-article-title {
        font-size: 1.3em;
    }

    .chapter-heading {
        font-size: 1.1em;
        flex-wrap: wrap;
    }

    .book-article-meta {
        flex-direction: column;
        gap: 0.3em;
    }

    .book-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5em;
    }
}
