/* 
 * 作者：json
 * IT知识屋样式文件
 */

/* 书籍列表容器 */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* 书籍卡片链接 */
.book-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* 书籍卡片 */
.book-card {
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    cursor: pointer;
}

.book-card-link:hover .book-card {
    transform: translateY(-0.25rem);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 书籍封面 */
.book-cover {
    width: 100%;
    height: 14rem;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.05);
}

/* 文档类型书签徽章 */
.book-type-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* 书籍信息区 */
.book-info {
    padding: 1rem;
}

/* 书籍标题 */
.book-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
}

.book-title:hover {
    color: var(--primary-color);
}

/* 书籍标题全称提示 */
.book-title::after {
    content: attr(title);
    position: absolute;
    left: 0;
    top: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.book-title:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 书籍元数据 */
.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.book-meta span {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

/* 文档页数 */
.book-pages {
    background-color: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

/* 下载数 */
.book-downloads {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

/* 响应式调整 */
@media screen and (max-width: 48rem) {
    .book-list {
        grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
        gap: 1rem;
    }

    .book-cover {
        height: 12rem;
    }

    .book-info {
        padding: 0.75rem;
    }

    .book-title {
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 30rem) {
    .book-list {
        grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
        gap: 0.75rem;
    }

    .book-cover {
        height: 10rem;
    }

    .book-info {
        padding: 0.5rem;
    }

    .book-title {
        font-size: 0.875rem;
    }

    .book-meta span {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}
