/* 书库页面样式 */
body {
    padding-top: 56px; /* 精确匹配导航栏高度，消除缝隙 */
}

/* 书库横幅 - 紧贴导航栏，与其他页面保持完全一致 */
.library-banner.main-container {
    margin-top: 0 !important;
    height: 43.98px !important;
    background: linear-gradient(135deg, #8B0000, #A52A2A) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    border-radius: 0 0 10px 10px !important;
    text-align: center !important;
    color: white !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 0 !important;
    max-width: none !important;
    flex: none !important;
    position: relative !important;
    overflow: hidden !important;
    /* 禁用继承的动画效果 - 横幅容器本身不应该有动画 */
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

.library-banner.main-container::before {
    display: none !important;
}

.library-banner h1 {
    font-size: 16px !important;
    margin: 0 !important;
    line-height: 1.1 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    letter-spacing: 1px !important;
    color: #fff !important;
    position: relative !important;
    z-index: 2 !important;
    text-align: center !important;
}

.library-banner p {
    font-size: 12px !important;
    margin: 2px auto 0 !important;
    line-height: 1.2 !important;
    max-width: 600px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    position: relative !important;
    z-index: 2 !important;
    text-align: center !important;
}

/* 主容器 - 移除白色背景板块 */
.library-container {
    max-width: 1800px !important; /* 从1550px增加到1800px */
    margin: 30px auto !important;
    padding: 20px !important;
    display: flex !important;
    gap: 25px !important; /* 减小间距，从30px改为25px */
    min-height: calc(100vh - 300px) !important;
    background: transparent !important; /* 移除白色背景 */
    border-radius: 0 !important; /* 移除圆角 */
    box-shadow: none !important; /* 移除阴影 */
    backdrop-filter: none !important; /* 移除毛玻璃效果 */
}

/* 侧边栏筛选器 - 调整内边距 */
.library-filters {
    width: 220px; /* 减小宽度，从280px改为220px */
    background: transparent; /* 移除白色背景 */
    border-radius: 0; /* 移除圆角 */
    padding: 0; /* 移除内边距，由各个板块自己控制 */
    box-shadow: none; /* 移除阴影 */
    height: fit-content;
    position: sticky;
    top: 100px;
    flex-shrink: 0;
}

.library-sidebar {
    width: 220px; /* 减小宽度，从280px改为220px */
    background: transparent; /* 移除白色背景 */
    border-radius: 0; /* 移除圆角 */
    padding: 0; /* 移除内边距，由各个板块自己控制 */
    box-shadow: none; /* 移除阴影 */
    height: fit-content;
    position: sticky;
    top: 100px;
    flex-shrink: 0;
}

.library-sidebar h2, .library-filters h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
    padding: 20px; /* 添加内边距 */
    background: #fff; /* 添加白色背景 */
    border-radius: 12px; /* 添加圆角 */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 添加阴影 */
    border-bottom: 2px solid #8B0000;
}

.filter-section {
    margin-bottom: 30px; /* 增加板块间距 */
    background: #fff; /* 添加白色背景 */
    border-radius: 12px; /* 添加圆角 */
    padding: 25px; /* 增加内边距 */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 添加阴影 */
}

.filter-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #444;
    margin: 0 0 12px 0;
}

.category-tags, .theme-tags, .plot-tags, .reader-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* 增加间距以适配更高的标签 */
    align-items: stretch; /* 让所有标签高度一致 */
}

.tag {
    display: inline-block;
    padding: 12px 8px; /* 进一步增加垂直内边距，减少水平内边距 */
    background: #f5f5f5;
    color: #666;
    border-radius: 4px; /* 进一步减小圆角，更接近长方形 */
    font-size: 12px; /* 稍微减小字体 */
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    user-select: none;
    min-width: 50px; /* 增加最小宽度 */
    min-height: 36px; /* 设置最小高度 */
    text-align: center; /* 文字居中 */
    line-height: 1.1; /* 调整行高 */
    display: flex; /* 使用flex布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

.tag:hover {
    background: #e8e8e8;
    color: #333;
}

.tag.active {
    background: #8B0000;
    color: white;
    border-color: #8B0000;
}

/* 主内容区域 - 调整内边距 */
.library-content {
    flex: 1;
    min-width: 1500px; /* 从1250px增加到1500px */
    background: transparent; /* 移除白色背景 */
    border-radius: 0; /* 移除圆角 */
    padding: 0; /* 移除内边距，由各个板块自己控制 */
    box-shadow: none; /* 移除阴影 */
}

/* 排序选项 */
.sort-options {
    margin-bottom: 25px;
    padding: 20px; /* 添加内边距 */
    background: #fff; /* 添加白色背景 */
    border-radius: 12px; /* 添加圆角 */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 添加阴影 */
    border-bottom: 1px solid #eee;
}

.sort-option {
    padding: 8px 16px;
    background: #f8f9fa;
    color: #666;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    user-select: none;
}

.sort-option:hover {
    background: #e9ecef;
    color: #333;
}

.sort-option.active {
    background: #8B0000;
    color: white;
    border-color: #8B0000;
}

.reset-all-btn {
    background: #fff;
    color: #8B0000;
    border: 1px solid #8B0000;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reset-all-btn:hover {
    background: #8B0000;
    color: white;
}

/* 书籍网格 - 优化为横向卡片布局 */
.library-content .novel-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr)) !important; /* 桌面版使用450px */
    gap: 20px !important;
    padding: 20px !important; /* 增加内边距 */
    min-height: 400px !important;
    background: transparent !important; /* 移除白色背景 */
    border-radius: 0 !important; /* 移除圆角 */
    box-shadow: none !important; /* 移除阴影 */
}

/* 支持两种卡片类名：novel-card 和 book-card - 横向布局 */
.library-content .novel-card,
.library-content .book-card {
    position: relative !important;
    width: 100% !important;
    height: 200px !important; /* 桌面版使用200px高度 */
    background: #fff !important; /* 恢复白色背景 */
    border-radius: 12px !important; /* 恢复圆角 */
    overflow: hidden !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important; /* 恢复阴影 */
    cursor: pointer !important;
    display: flex !important;
    flex-direction: row !important; /* 改为横向布局 */
    transition: all 0.3s ease !important;
    margin: 0 !important;
}

.library-content .novel-card:hover,
.library-content .book-card:hover {
    transform: translateY(-5px) !important; /* 恢复悬停位移 */
    box-shadow: 0 8px 25px rgba(139, 0, 0, 0.2) !important; /* 恢复阴影强度 */
}

/* 封面图片 - 横向布局调整 */
.library-content .novel-card img,
.library-content .book-card img {
    width: 150px !important; /* 桌面版使用150px宽度 */
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 12px 0 0 12px !important; /* 恢复左侧圆角，配合卡片背景 */
    flex-shrink: 0 !important;
}

.library-content .book-cover {
    width: 150px !important; /* 桌面版使用150px宽度 */
    height: 100% !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    border-radius: 12px 0 0 12px !important; /* 恢复左侧圆角，配合卡片背景 */
}

.library-content .book-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
}

/* 书籍信息区域 - 横向布局调整 */
.library-content .novel-info,
.library-content .book-info {
    flex: 1 !important;
    padding: 20px 30px !important; /* 从15px 20px增加到20px 30px，为火图标留出更多空间 */
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    min-width: 0 !important; /* 防止文本溢出 */
}

/* 书名 - 横向布局调整 */
.library-content .novel-title,
.library-content .book-title {
    font-size: 19px !important; /* 从17px增加到19px */
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 0 10px 0 !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* 作者 - 横向布局调整 */
.library-content .novel-author,
.library-content .book-author {
    font-size: 13px !important; /* 从14px减小到13px */
    color: #666 !important;
    margin: 0 0 8px 0 !important; /* 从10px减小到8px */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* 分类 - 横向布局调整 */
.library-content .novel-category,
.library-content .book-category {
    font-size: 12px !important;
    color: #8B0000 !important;
    background: rgba(139, 0, 0, 0.1) !important;
    padding: 2px 8px !important;
    border-radius: 10px !important;
    display: inline-block !important;
    margin: 0 0 8px 0 !important; /* 从10px减小到8px */
    max-width: fit-content !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* 人气值 - 横向布局调整 */
.library-content .novel-popularity {
    font-size: 12px !important;
    color: #999 !important;
    margin: 0 !important;
}

/* 简介 - 横向布局新增 */
.library-content .book-desc {
    font-size: 12px !important; /* 从13px减小到12px */
    color: #666 !important;
    line-height: 1.4 !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important; /* 从2行增加到3行 */
    line-clamp: 3 !important; /* 从2行增加到3行 */
    -webkit-box-orient: vertical !important;
    margin: 0 !important;
}

/* 链接样式 - 确保不影响布局 */
.library-content .book-link,
.library-content .novel-card a {
    text-decoration: none !important;
    color: inherit !important;
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
}

.library-content .book-link:hover,
.library-content .novel-card a:hover {
    text-decoration: none !important;
    color: inherit !important;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
    padding: 20px; /* 添加内边距 */
    background: #fff; /* 添加白色背景 */
    border-radius: 12px; /* 添加圆角 */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* 添加阴影 */
    border-top: 1px solid #eee;
}

.prev-page, .next-page {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.prev-page:hover, .next-page:hover {
    background: #8B0000;
    color: white;
    border-color: #8B0000;
}

.prev-page:disabled, .next-page:disabled {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
    border-color: #eee;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background: #f8f9fa;
    border-color: #8B0000;
    color: #8B0000;
}

.page-number.active {
    background: #8B0000;
    color: white;
    border-color: #8B0000;
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
    font-size: 16px;
}

.loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 空状态 */
.no-books {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-books i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.no-books p {
    font-size: 16px;
    margin: 0;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #8B0000;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(139,0,0,0.3);
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #a00000;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139,0,0,0.4);
}

/* 响应式设计 */
@media (max-width: 1600px) {
    .library-container {
        max-width: 95% !important;
    }
    
    .library-content {
        min-width: 1200px; /* 从1000px增加到1200px */
    }
}

@media (max-width: 1400px) {
    .library-container {
        max-width: 98% !important;
    }
    
    .library-content {
        min-width: 1100px; /* 从900px增加到1100px */
    }
}

@media (max-width: 1200px) {
    .library-container {
        max-width: 100% !important;
        padding: 15px !important;
        gap: 20px !important;
    }
    
    .library-sidebar, .library-filters {
        width: 200px; /* 在中等屏幕上进一步减小宽度 */
    }
    
    .library-content {
        min-width: 1000px; /* 从850px增加到1000px */
    }
    
    .library-content .novel-grid {
        grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)) !important; /* 从360px增加到420px */
        gap: 15px !important;
    }
    
    .library-content .novel-card,
    .library-content .book-card {
        height: 190px !important; /* 从170px增加到190px */
    }
    
    .library-content .novel-card img,
    .library-content .book-card img {
        width: 140px !important; /* 从125px增加到140px */
    }
    
    .library-content .book-cover {
        width: 140px !important; /* 从125px增加到140px */
    }
}

@media (max-width: 900px) {
    .library-container {
        max-width: 100% !important;
        flex-direction: column !important;
        gap: 20px !important;
        margin: 20px auto !important;
    }
    
    .library-sidebar, .library-filters {
        width: 100% !important;
        position: static !important;
    }
    
    .library-content {
        min-width: 0 !important; /* 移除最小宽度限制，允许自适应 */
    }
    
    .filter-section {
        margin-bottom: 20px;
    }
    
    .sort-options {
        margin-bottom: 20px;
    }
    
    .sort-options > div {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .library-banner h1 {
        font-size: 32px !important;
    }
    
    .library-banner p {
        font-size: 16px !important;
    }
    
    .library-content .novel-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)) !important; /* 从340px增加到400px */
    }
    
    .library-content .novel-card,
    .library-content .book-card {
        height: 180px !important; /* 从160px增加到180px */
    }
    
    .library-content .novel-card img,
    .library-content .book-card img {
        width: 130px !important; /* 从115px增加到130px */
    }
    
    .library-content .book-cover {
        width: 130px !important; /* 从115px增加到130px */
    }
    
    .library-content .novel-info,
    .library-content .book-info {
        padding: 12px 15px !important;
    }
}

@media (max-width: 600px) {
    body {
        padding-top: 70px;
    }
    
    .library-container {
        max-width: 100% !important;
        margin: 10px auto !important;
        padding: 10px !important;
        border-radius: 8px !important;
    }
    
    .library-sidebar, .library-content, .library-filters {
        border-radius: 8px;
        padding: 15px;
    }
    
    .library-content .novel-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .library-content .novel-card,
    .library-content .book-card {
        height: 140px !important; /* 从120px增加到140px */
    }
    
    .library-content .novel-card img,
    .library-content .book-card img {
        width: 105px !important; /* 从90px增加到105px */
    }
    
    .library-content .book-cover {
        width: 105px !important; /* 从90px增加到105px */
    }
    
    .library-content .novel-info,
    .library-content .book-info {
        padding: 10px 12px !important;
    }
    
    .library-content .novel-title,
    .library-content .book-title {
        font-size: 16px !important;
    }
    
    .library-content .novel-author,
    .library-content .book-author {
        font-size: 12px !important;
    }
    
    .library-content .book-desc {
        font-size: 11px !important;
        -webkit-line-clamp: 1 !important;
        line-clamp: 1 !important;
    }
    
    .tag {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .sort-option {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .library-banner.main-container {
        padding: 40px 15px !important;
    }
    
    .library-banner h1 {
        font-size: 24px !important;
    }
    
    .library-banner p {
        font-size: 14px !important;
    }
}

/* 搜索建议样式 */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: none;
    z-index: 100;
}

.search-suggestions p {
    margin: 0 0 10px;
    color: #666;
    font-size: 14px;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-tag {
    background: #f8f9fa;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-tag:hover {
    background: #8B0000;
    color: white;
}

/* 确保动态背景不影响布局 */
.dynamic-bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

/* 重置可能的Bootstrap样式冲突 */
.library-content .novel-card::before,
.library-content .book-card::before {
    display: none !important;
}

.library-content .novel-card > *,
.library-content .book-card > * {
    position: static !important;
    z-index: auto !important;
}
