/* 大图书馆 - 统一视觉艺术馆风格 */

/* ==================== 书架网格 - 与视觉艺术馆一致 ==================== */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ==================== 书本卡片 - 保持书本样式但统一卡片风格 ==================== */
.book-card {
    background: rgba(30, 30, 35, 0.8);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(212, 175, 55, 0.1);
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(212, 175, 55, 0.1);
}

/* 书本封面区域 */
.book-cover-area {
    position: relative;
    height: 280px;
    background: linear-gradient(135deg, #1a1a1f 0%, #2a2a2f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    perspective: 1000px;
}

/* 书本立体效果 */
.book-3d {
    position: relative;
    width: 160px;
    height: 220px;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.book-card:hover .book-3d {
    transform: translateY(-5px) rotateY(-8deg);
}

/* 书脊 */
.book-spine {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 100%;
    border-radius: 3px 0 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    box-shadow: 
        inset -3px 0 6px rgba(0, 0, 0, 0.4),
        inset 2px 0 3px rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.spine-title {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    letter-spacing: 2px;
    max-height: 160px;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 封面 */
.book-cover-front {
    position: absolute;
    left: 30px;
    right: 10px;
    top: 0;
    bottom: 0;
    border-radius: 0 8px 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem;
    text-align: center;
    box-shadow: 
        6px 8px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 封面光泽 */
.book-cover-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.12) 0%,
        transparent 40%,
        transparent 60%,
        rgba(0, 0, 0, 0.2) 100%
    );
    pointer-events: none;
}

/* AI类型标签 - 封面上的标签 */
.ai-type-tag {
    position: absolute;
    top: 10px;
    right: 5px;
    font-size: 0.6rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ai-type-tag.pure {
    background: rgba(76, 175, 80, 0.9);
    color: #fff;
}

.ai-type-tag.assisted {
    background: rgba(156, 136, 255, 0.9);
    color: #fff;
}

.cover-title {
    font-size: 0.85rem;
    color: #fff;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    font-family: 'Noto Serif SC', serif;
    z-index: 1;
}

.cover-author {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: auto;
    font-style: italic;
    z-index: 1;
}

.cover-icon {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.15);
    margin-top: 0.5rem;
    z-index: 1;
}

/* 书页 */
.book-pages-side {
    position: absolute;
    right: 0;
    top: 4px;
    bottom: 4px;
    width: 10px;
    background: linear-gradient(90deg, 
        #e8e4dc 0%,
        #d4d0c8 20%,
        #e8e4dc 40%,
        #d4d0c8 60%,
        #e8e4dc 80%,
        #d4d0c8 100%
    );
    border-radius: 0 4px 4px 0;
    box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.1);
}

/* 悬停遮罩 */
.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-overlay {
    opacity: 1;
}

.btn-read {
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
    color: #1a1a1f;
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-read:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

/* 书本信息 - 与视觉艺术馆一致 */
.book-info {
    padding: 1.5rem;
}

.book-title {
    font-size: 1.1rem;
    color: #d4af37;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.book-desc {
    color: #aaa;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.book-pages-count {
    color: #666;
    font-size: 0.8rem;
}

.book-price {
    font-size: 1.1rem;
    color: #e74c3c;
    font-weight: 700;
}

/* ==================== 阅读器弹窗 - 带翻页功能 ==================== */

.book-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(231, 76, 60, 0.8);
    transform: scale(1.1);
}

.book-reader {
    position: relative;
    width: 900px;
    max-width: 95vw;
    height: 92vh;
    max-height: 850px;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 
        0 30px 100px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(212, 175, 55, 0.1);
}

/* 阅读器头部 - 缩小 */
.reader-header {
    text-align: center;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #2d2416 0%, #1a1510 100%);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    flex-shrink: 0;
}

.reader-header h2 {
    color: #d4af37;
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
    font-weight: 600;
    font-family: 'Noto Serif SC', serif;
}

.reader-author {
    color: #888;
    font-size: 0.75rem;
}

.reader-category {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0.1rem 0.5rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 15px;
    font-size: 0.6rem;
    color: #d4af37;
}

/* 阅读器主体 - 翻页区域 */
.reader-content-wrapper {
    flex: 1;
    background: #1a1a1f;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;
}

/* 翻页按钮 */
.page-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #d4af37;
    width: 50px;
    height: 80px;
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-btn.prev {
    left: 1rem;
}

.page-btn.next {
    right: 1rem;
}

/* 书本显示区域 */
.reader-book-display {
    width: 100%;
    max-width: 700px;
    height: 100%;
    background: #f5f0e8;
    border-radius: 0 10px 10px 0;
    box-shadow: 
        inset 30px 0 40px -20px rgba(0, 0, 0, 0.1),
        inset -30px 0 40px -20px rgba(0, 0, 0, 0.05),
        0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    overflow: hidden;
    position: relative;
}

/* 单页模式 */
.book-page-single {
    flex: 1;
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, #faf8f5 0%, #f5f2eb 100%);
    overflow-y: auto;
    position: relative;
}

/* 双页模式 */
.book-page-left,
.book-page-right {
    flex: 1;
    padding: 1rem 1.2rem;
    overflow-y: auto;
    position: relative;
}

.book-page-left {
    background: 
        linear-gradient(to right, rgba(0,0,0,0.02) 0%, transparent 10%),
        linear-gradient(180deg, #faf8f5 0%, #f5f2eb 100%);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.book-page-right {
    background: 
        linear-gradient(to left, rgba(0,0,0,0.015) 0%, transparent 10%),
        linear-gradient(180deg, #faf8f5 0%, #f5f2eb 100%);
}

.book-spine-center {
    width: 40px;
    background: linear-gradient(90deg, 
        rgba(0,0,0,0.1) 0%,
        rgba(0,0,0,0.04) 40%,
        rgba(0,0,0,0.015) 50%,
        rgba(0,0,0,0.04) 60%,
        rgba(0,0,0,0.1) 100%
    );
    position: relative;
    flex-shrink: 0;
}

.book-spine-center::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, 
        transparent 0%,
        rgba(0,0,0,0.08) 20%,
        rgba(0,0,0,0.12) 50%,
        rgba(0,0,0,0.08) 80%,
        transparent 100%
    );
}

/* 页面内容 */
.page-header {
    text-align: center;
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 0.8rem;
    font-style: italic;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 0.4rem;
    font-family: 'Noto Serif SC', serif;
}

.page-content {
    color: #2c2c2c;
    line-height: 1.7;
    font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
    font-size: 0.9rem;
}

.page-content h1, 
.page-content h2, 
.page-content h3 {
    color: #1a1a1a;
    margin: 1rem 0 0.5rem;
    font-weight: 700;
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
}

.page-content p {
    margin-bottom: 0.6rem;
    text-align: justify;
    text-indent: 2em;
}

.page-number-display {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: #bbb;
    font-style: italic;
}

/* 页码指示器 */
.page-indicator {
    position: absolute;
    bottom: 0.8rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.page-dot.active {
    background: rgba(212, 175, 55, 0.6);
    transform: scale(1.2);
}

/* 滚动条 */
.book-page-single::-webkit-scrollbar,
.book-page-left::-webkit-scrollbar,
.book-page-right::-webkit-scrollbar {
    width: 4px;
}

.book-page-single::-webkit-scrollbar-thumb,
.book-page-left::-webkit-scrollbar-thumb,
.book-page-right::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* 阅读器底部 - 缩小 */
.reader-footer {
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #2d2416 0%, #1a1510 100%);
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    text-align: center;
    flex-shrink: 0;
}

.price-section {
    margin-bottom: 0.5rem;
}

.price-label {
    display: block;
    color: #888;
    font-size: 0.7rem;
    margin-bottom: 0.1rem;
}

.price-value {
    display: block;
    color: #e74c3c;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.copyright-note {
    color: #666;
    font-size: 0.65rem;
}

.btn-buy {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

/* 响应式 */
@media (max-width: 768px) {
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .book-cover-area {
        height: 220px;
    }
    
    .book-3d {
        width: 130px;
        height: 180px;
    }
    
    .book-spine {
        width: 25px;
    }
    
    .book-cover-front {
        left: 25px;
        right: 8px;
        padding: 0.8rem;
    }
    
    .cover-title {
        font-size: 0.75rem;
    }
    
    .reader-book-display {
        flex-direction: column;
    }
    
    .book-spine-center {
        display: none;
    }
    
    .book-page-left,
    .book-page-right {
        padding: 1rem;
        height: 50%;
    }
    
    .page-btn {
        width: 40px;
        height: 60px;
        font-size: 1.2rem;
    }
    
    .page-btn.prev {
        left: 0.5rem;
    }
    
    .page-btn.next {
        right: 0.5rem;
    }
}
