/* Filter */

.filter-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.filter-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: var(--font-size-md);
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.library-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    font-size: var(--font-size-md);
}

.library-content h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: var(--spacing-xl) 0 var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--color-primary);
}

.library-content h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: var(--spacing-lg) 0 var(--spacing-md);
}

.library-content p {
    margin-bottom: var(--spacing-md);
}

.library-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

/* Literature */
.references-section {
    padding: var(--spacing-xl) 0;
    max-width: 800px;
    margin: 0 auto;
}

.references-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-lg);
}

.reference-list {
    list-style: none;
}

.library-detail {
    background-color: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
}

.library-info-item .info-label {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.library-stats .stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* widget-title / sidebar-widget / widget-list 已统一到 page_layout.css，此处不再重复定义 */

.widget-list li {
    margin-bottom: var(--spacing-sm);
}

.widget-list a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
}

.widget-list a:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-primary);
}

.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.search-result-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.result-actions {
    display: flex;
    gap: var(--spacing-sm);
}


@media (max-width: 992px) {
    .library-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .library-info-container {
        flex-direction: column;
    }

    .library-info-cover {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .library-info-title {
        font-size: var(--font-size-xl);
    }

    .library-nav {
        flex-direction: column;
    }

    .library-nav-prev,
    .library-nav-next {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .library-grid {
        grid-template-columns: 1fr;
    }

    .library-info-title {
        font-size: var(--font-size-lg);
    }
}

.library-stats .stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.library-stats .icon {
    opacity: 0.6;
}


/* AutoSearch */
#autoSearchResults {
    margin-top: var(--spacing-md);
}


/* ======================================== - Animation - ======================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================================== 图书馆列表页（library.php） ======================================== */

/* 页面主体包裹 */
.library-list-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 60px;
}

/* 书籍卡片 */
.book-card {
    background: var(--hx-ffffff);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: all 0.25s;
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* 书籍标题 */
.book-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--hx-222222);
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 书籍作者 */
.book-author {
    font-size: 12px;
    color: var(--hx-aaaaaa);
}

/* 书籍统计元信息 */
.book-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: var(--hx-aaaaaa);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--hx-f5f0eb);
}









/* Album list page styles - Waterfall layout (7 columns) */

/* ===== 瀑布流布局由 list.css 统一控制（body.page-album-list .items-grid） ===== */
/* 本文件只负责相册卡片样式和兼容性 */

/* 相册卡片在瀑布流中的微调 */
body.page-album-list .card--grid {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--hx-e8e0d8);
    transition: transform 0.25s, box-shadow 0.25s;
}
body.page-album-list .card--grid .card-cover img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}
body.page-album-list .card--grid:hover .card-cover img {
    transform: scale(1.03);
}

@media (max-width: 1600px) { .waterfall { columns: 6; } }
@media (max-width: 1400px) { .waterfall { columns: 5; } }
@media (max-width: 1100px) { .waterfall { columns: 4; } }
@media (max-width: 900px)  { .waterfall { columns: 3; } }
@media (max-width: 600px)  { .waterfall { columns: 2; } }
@media (max-width: 400px)  { .waterfall { columns: 1; } }

/* Album card（老站模板兼容） */
.album-card {
    break-inside: avoid;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--hx-ffffff);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}
.album-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.album-cover {
    position: relative;
    width: 100%;
    overflow: hidden;
}
.album-cover img {
    width: 100%;
    display: block;
    transition: transform 0.3s;
}
.album-card:hover .album-cover img {
    transform: scale(1.05);
}
.album-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.album-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--gray-500);
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--gray-500);
    font-size: 14px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 2) page-layout-wrapper — 骨架层 flex 容器（限制器） */
body.page-library-detail .page-layout-wrapper {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    display: block !important;   /* 从 flex 切 block，消除 flex 子项收缩 */
}

/* 3) main-with-sidebar —— 骨架层主内容区 */
body.page-library-detail .main-with-sidebar {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: none !important;
}

/* 4) library-detail-section —— 覆盖 theme.css (max-width:1100px) + library.css (padding) */
body.page-library-detail .library-detail-section {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Layout */
.book-reader-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    height: calc(100vh - 56px);
    overflow: hidden;
    background: var(--hx-faf6ee);
    min-width: 0;
}
.book-left-sidebar.show { transform: translateX(0); }
.book-drawer-backdrop.show { opacity: 1; visibility: visible; }

.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--hx-6b6254);
    transition: all 0.3s;
}

.sidebar-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    font-weight: 600;
}

/* ==================== 工具栏 ==================== */
.book-content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--hx-faf6ee);
    border-bottom: 1px solid var(--hx-e5dfd0);
    gap: 12px;
    flex-shrink: 0;
    min-height: 48px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--hx-6b6254);
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--hx-ffffff);
    border-color: var(--hx-e5dfd0);
    color: var(--accent);
}

.toolbar-btn.active {
    background: var(--accent);
    color: var(--hx-ffffff);
    border-color: var(--accent);
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* 章节正文（主显示区） */
#modeText {
    font-size: 17px;
    line-height: 2.2;
    color: var(--hx-2c2418);
    writing-mode: horizontal-tb !important;
    direction: ltr !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}


.mode-scan {
    display: none;
}

.mode-scan.active {
    display: flex;
}

.scan-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--hx-faf6ee);
    border-bottom: 1px solid var(--hx-e5dfd0);
}

.no-content .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--gold-hover));
    color: var(--hx-ffffff);
    font-size: 48px;
    font-weight: 700;
}

.cover-placeholder.large {
    font-size: 72px;
}

.right-sidebar-tab {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--hx-6b6254);
    transition: all 0.3s;
    text-align: center;
}

.right-sidebar-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    font-weight: 600;
}

/* Search */
.right-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.search-box {
    padding: 12px;
    border-bottom: 1px solid var(--hx-e5dfd0);
}

.search-box input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--hx-e5dfd0);
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    color: var(--hx-2c2418);
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.search-box input[type="text"]:focus {
    border-color: var(--accent);
}

.search-box button {
    width: 100%;
    margin-top: 8px;
    padding: 7px;
    background: var(--accent);
    color: var(--hx-ffffff);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.2s;
}

.search-box button:hover {
    opacity: 0.9;
}

.search-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--hx-a89b87);
    font-size: 14px;
}

/* 增强搜索结果样式 */
.search-result-count {
    font-size: 12px;
    color: var(--hx-a89b87);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--hx-e5dfd0);
}

.search-result-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--hx-f0ebe0);
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.search-result-item:hover {
    background: var(--hx-faf6ee);
    margin: 0 -8px;
    padding: 10px 8px;
    border-radius: 6px;
}

/* ==================== 隐藏类 ==================== */
.hidden { display: none !important; }
.c-icon-btn .like-count,
.c-icon-btn .fav-count { font-size: 12px; }

.comment-login-tip {
    padding: 24px 16px;
    text-align: center;
    color: var(--hx-a89b87);
    font-size: 13px;
}
.ann-list { min-height: 60px; }
.ann-empty {
    text-align: center;
    padding: 30px 16px;
    color: var(--hx-a89b87);
    font-size: 13px;
}
.ann-form-actions button.primary {
    background: var(--accent);
    color: var(--hx-ffffff);
    border-color: var(--accent);
}
.split-left-panel,
.split-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.split-left-panel { border-right: 1px solid var(--hx-e5dfd0); }
.split-divider {
    width: 4px;
    background: var(--hx-e5dfd0);
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PDF 模式 */
.pdf-viewer {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.settings-dropdown.show { display: block; }
.check-icon { color: var(--accent); font-weight: bold; }

/* ==================== 响应式适配 ==================== */
@media (max-width: 1024px) {
    .book-reader-wrapper {
        grid-template-columns: 1fr 280px;
    }
    .book-content-body,
    .related-books-section,
    .citations-section { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 768px) {
    .book-reader-wrapper {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    .book-right-sidebar {
        display: none;
    }
    .book-right-sidebar.mobile-show {
        display: flex;
        position: fixed;
        top: 60px;
        bottom: 0;
        left: 0;
        width: 280px;
        z-index: 9999;
        box-shadow: 4px 0 16px rgba(0,0,0,0.15);
    }
    .book-left-sidebar { width: 85vw; max-width: 85vw; }
    .book-right-sidebar.mobile-show {
        left: auto;
        right: 0;
        width: 300px;
    }
}