/* ================= TÙY BIẾN CHO TRANG SÁCH ================= */
.sach-page-body {
    background-color: #f9f9f9 !important;
    color: #0f172a;
}

.sach-content-wrapper {
    padding: 16px 24px 60px 24px !important;
}

/* ================= KỆ SÁCH & TIÊU ĐỀ THỂ LOẠI ================= */
.book-shelf-section {
    margin-bottom: 30px;
}

.book-shelf-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.shelf-indicator-bar {
    width: 4px;
    height: 20px;
    background: #0066ff;
    border-radius: 4px;
    display: inline-block;
}

.shelf-category-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.2px;
    margin: 0;
}

/* ================= HÀNG SÁCH LƯỚT NGANG ================= */
.book-shelf-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.book-shelf-row::-webkit-scrollbar {
    height: 6px;
}

.book-shelf-row::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

/* ================= CARD TỪNG QUYỂN SÁCH ================= */
.book-card-item {
    flex: 0 0 175px;
    width: 175px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.book-card-item:hover {
    transform: translateY(-4px);
}

.book-cover-link {
    text-decoration: none;
    display: block;
}

.book-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4.2;
    background-color: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #cbd5e1;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ================= THANH THÔNG TIN MỜ TRÊN GÓC BÌA SÁCH ================= */
.book-top-meta-overlay {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: flex-start;
    z-index: 2;
    pointer-events: none;
}

.book-top-meta-overlay .meta-badge {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.book-top-meta-overlay .meta-badge.date-badge i { color: #38bdf8; }
.book-top-meta-overlay .meta-badge.like-badge i { color: #ef4444; }
.book-top-meta-overlay .meta-badge.dl-badge i { color: #f59e0b; }

/* ================= THÔNG TIN DƯỚI BÌA SÁCH ================= */
.book-info-bottom {
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.book-name-title {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
    margin: 0;
}

.book-name-title a {
    color: #0f172a;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}

.book-name-title a:hover {
    color: #0066ff;
}

.book-author-name {
    font-size: 12.5px;
    color: #64748b;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================= TỐI ƯU GIAO DIỆN TÌM KIẾM TRÊN MOBILE (DƯỚI 768px) ================= */
@media (max-width: 768px) {
    .yt-header-center, 
    .desktop-only {
        display: none !important;
    }

    .yt-header {
        height: 48px !important;
        padding: 0 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    .yt-header-left {
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .btn-sidebar-burger {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
        flex-shrink: 0 !important;
    }

    /* ẨN LOGO KHI ĐANG TÌM KIẾM */
    .yt-brand-container.hide-on-mobile-search {
        display: none !important;
    }

    /* KHUNG TỪ KHÓA BO TRÒN (PILL SHAPE) */
    .mobile-search-keyword-badge {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background-color: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 20px !important;
        height: 36px !important;
        padding: 0 6px 0 12px !important;
        flex: 1 !important;
        min-width: 0 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    }

    .badge-click-area {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex: 1 !important;
        min-width: 0 !important;
        cursor: pointer !important;
        padding-right: 4px !important;
    }

    .badge-click-area i {
        font-size: 13px !important;
        color: #0066ff !important;
        flex-shrink: 0 !important;
    }

    .badge-keyword-text {
        font-size: 13.5px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
        letter-spacing: -0.2px !important;
    }

    .badge-btn-clear {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 24px !important;
        height: 24px !important;
        border-radius: 50% !important;
        color: #64748b !important;
        text-decoration: none !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
        transition: background-color 0.15s, color 0.15s !important;
    }

    .badge-btn-clear:active {
        background-color: #fee2e2 !important;
        color: #ef4444 !important;
    }

    .yt-header-right {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    .btn-mobile-header-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        background-color: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        color: #1e293b !important;
        font-size: 15px !important;
        cursor: pointer !important;
        padding: 0 !important;
        margin: 0 !important;
        line-height: 1 !important;
        flex-shrink: 0 !important;
        transition: background-color 0.15s, color 0.15s !important;
    }

    .btn-mobile-header-icon:active {
        background-color: #e2e8f0 !important;
        color: #0066ff !important;
    }

    /* ẨN TRIỆT ĐỂ AVATAR TRÊN MOBILE KHI CÓ TÌM KIẾM */
    .yt-header-right .yt-user-avatar.hide-on-mobile-search,
    .yt-header-right .yt-btn-login.hide-on-mobile-search {
        display: none !important;
    }

    .yt-main-layout {
        flex-direction: column !important;
        margin-top: 48px !important;
    }

    .yt-chips-bar {
        top: 48px !important;
        padding: 6px 0 10px 0 !important;
    }

    .sach-content-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 10px 10px 75px 10px !important;
    }

    .book-card-item {
        flex: 0 0 135px;
        width: 135px;
    }

    .shelf-category-title {
        font-size: 16px;
    }

    .book-name-title {
        font-size: 13.5px;
    }

    .book-author-name {
        font-size: 11.5px;
    }
}
