/* =====================================================
   USER BOOK SEARCH PAGE - FIX LAYOUT
   - Không bị tràn ngang
   - Guest vẫn hiển thị danh sách sách nếu controller trả dữ liệu
   - Desktop/tablet/mobile đều gọn
===================================================== */

html,
body,
body.user-page,
.uni-main {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

.book-search-page {
    position: relative;
    min-height: calc(100vh - 64px);
    padding: 24px 0 46px;
    overflow: clip;
    background: #f4f4f4;
}

.book-search-page::before {
    content: "";
    position: absolute;
    right: -140px;
    top: -130px;
    width: 430px;
    height: 430px;
    border-radius: 50%;
    background: rgba(0, 32, 69, 0.04);
    pointer-events: none;
}

.book-search-page::after {
    content: "";
    position: absolute;
    left: -150px;
    bottom: -170px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(138, 118, 0, 0.05);
    pointer-events: none;
}

.book-search-page > .uni-container {
    position: relative;
    z-index: 2;
    width: min(1240px, calc(100% - 40px));
    max-width: none;
    padding: 0;
}

/* =====================================================
   LAYOUT
===================================================== */

.book-search-body {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    margin-top: -8px;
}

.book-result-panel {
    width: 100%;
    min-width: 0;
}

/* =====================================================
   CATEGORY SIDEBAR
===================================================== */

.book-category-panel {
    position: sticky;
    top: 80px;
    height: calc(100vh - 104px);
    min-height: 520px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #d7d7d7;
    background: #ffffff;
    box-shadow: none;
}

.book-category-head {
    padding: 20px 20px 16px;
    flex: 0 0 auto;
    border-bottom: 1px solid #dddddd;
    background: #f7f7f7;
}

.book-category-head h2 {
    margin: 0;
    color: #002045;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.book-category-head span {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 10.5px;
    font-weight: 400;
}

.book-category-search {
    margin: 16px 16px 12px;
    min-height: 42px;
    padding: 0 12px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #d6d6d6;
    background: #ffffff;
    transition: border-color 0.16s ease;
}

.book-category-search:focus-within {
    border-color: #8a7600;
}

.book-category-search .material-symbols-outlined {
    color: #8a7600;
    font-size: 19px;
    font-weight: 250;
}

.book-category-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #172033;
    font-family: inherit;
    font-size: 11px;
}

.book-category-search input::placeholder {
    color: #a49b8f;
}

.book-category-filter {
    flex: 1;
    min-height: 0;
    padding: 0 14px 16px;
    display: flex;
    flex-direction: column;
}

.book-category-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 4px;
    padding-right: 4px;
}

.book-category-list::-webkit-scrollbar {
    width: 5px;
}

.book-category-list::-webkit-scrollbar-track {
    background: transparent;
}

.book-category-list::-webkit-scrollbar-thumb {
    background: #d8c99b;
    border-radius: 999px;
}

.book-category-check {
    min-height: 32px;
    padding: 0 10px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    color: #4b5563;
    font-size: 10.5px;
    background: transparent;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.book-category-check input {
    width: 14px;
    height: 14px;
    accent-color: #002045;
    cursor: pointer;
}

.book-category-check span {
    min-width: 0;
    color: inherit;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-category-check strong {
    min-width: 24px;
    height: 18px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f3ead4;
    color: #8a7600;
    font-size: 9px;
    font-weight: 600;
}

.book-category-check:hover {
    background: #f6f6f6;
    color: #002045;
}

.book-category-check.is-active,
.book-category-all.is-active {
    background: #002045;
    color: #ffffff;
    font-weight: 600;
}

.book-category-check.is-active span,
.book-category-all.is-active span {
    color: #ffffff;
}

.book-category-check.is-active strong,
.book-category-all.is-active strong {
    background: #f3d24f;
    color: #002045;
}

.book-category-all {
    flex: 0 0 auto;
    margin-bottom: 10px;
    background: #eef2f5;
    color: #002045;
    font-weight: 500;
}

.book-category-empty {
    display: none;
    margin-top: 8px;
    padding: 10px 8px;
    color: #7a8290;
    font-size: 10.5px;
    font-weight: 400;
    text-align: center;
    border: 1px dashed #ded3bd;
    background: #fffdf8;
}

.book-category-reset {
    margin-top: 10px;
    min-height: 32px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dddddd;
    background: #f5f5f5;
    color: #8a7600;
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.16s ease;
}

.book-category-reset:hover {
    background: #8a7600;
    color: #ffffff;
}

/* =====================================================
   SEARCH + HEAD
===================================================== */

.book-result-top {
    margin-bottom: 14px;
    display: grid;
    gap: 12px;
}

.book-search-form {
    width: 100%;
    min-width: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 150px minmax(240px, 1fr) 190px 130px;
    gap: 10px;
}

.book-search-field {
    min-width: 0;
    min-height: 38px;
    display: flex;
    align-items: center;
    border: 1px solid #d7d7d7;
    border-radius: 6px;
    background: #ffffff;
    transition: border-color 0.16s ease;
}

.book-search-field:focus-within {
    border-color: #8a7600;
}

.book-search-input {
    gap: 8px;
    padding: 0 14px;
}

.book-search-input .material-symbols-outlined {
    color: #8a7600;
    font-size: 16px;
    font-weight: 250;
}

.book-search-field select,
.book-search-field input {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    outline: none;
    background: transparent;
    color: #172033;
    font-family: inherit;
    font-size: 11.5px;
}

.book-search-input input {
    padding: 0;
}

.book-search-field input::placeholder {
    color: #9c9488;
}

.book-search-submit {
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid #8a7600;
    border-radius: 6px;
    background: #8a7600;
    color: #ffffff;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.book-search-submit:hover {
    background: #002045;
    border-color: #002045;
}

.book-result-head {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.book-result-title {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.book-result-head h2 {
    margin: 0;
    color: #002045;
    font-size: 22px;
    font-weight: 850;
    line-height: 1.2;
    white-space: nowrap;
}

.book-result-head p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
}

.book-result-tools {
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.book-sort-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.book-sort-form label {
    color: #7a8290;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.book-sort-form select {
    min-width: 145px;
    min-height: 34px;
    padding: 0 24px 0 8px;
    border: 0;
    outline: none;
    background: transparent;
    color: #172033;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
}

.book-clear-filter {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px dashed #ded3bd;
    background: #fffdf8;
    color: #7a8290;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.book-clear-filter a {
    color: #002045;
    font-size: 11px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* =====================================================
   BOOK GRID
===================================================== */

.book-card-grid {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
    gap: 12px;
    align-items: start;
}

.book-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d7cdb8;
    background: #ffffff;
    box-shadow: none;
    transition: border-color 0.16s ease, transform 0.16s ease;
}

.book-card:hover {
    border-color: #bda86f;
    transform: translateY(-2px);
}

.book-cover {
    position: relative;
    width: 100%;
    height: 190px;
    padding: 6px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-bottom: 1px solid #e1d8c4;
    background: #f4efe3;
    text-decoration: none;
}

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

.book-status {
    position: absolute;
    left: 9px;
    top: 9px;
    min-height: 22px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    color: #ffffff;
    font-size: 10px;
    font-weight: 850;
    z-index: 3;
}

.book-status.is-available { background: #16714b; }
.book-status.is-borrowed { background: #8a7600; }

.book-card-body {
    padding: 8px 9px 9px;
}

.book-category-name {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 4px;
    color: #8a7600;
    font-size: 10.5px;
    font-weight: 850;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-body h3 {
    min-height: 31px;
    margin: 0;
    color: #002045;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-card-body h3 a {
    color: inherit;
    text-decoration: none;
}

.book-card-body h3 a:hover {
    color: #8a7600;
}

.book-author {
    margin: 5px 0 0;
    color: #6b7280;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-meta {
    margin-top: 8px;
    padding: 8px 9px;
    display: grid;
    gap: 3px;
    border: 1px solid #eee4d2;
    background: #faf7f1;
}

.book-meta span {
    min-width: 0;
    color: #5f6875;
    font-size: 9.8px;
    font-weight: 400;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-actions {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.book-detail-btn,
.book-guide-btn,
.book-guide-disabled {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
}

.book-guide-disabled .material-symbols-outlined {
    font-size: 16px;
    font-weight: 300;
}

.book-detail-btn {
    border: 1px solid #eadfca;
    background: #f3ead4;
    color: #8a7600;
}

.book-detail-btn:hover {
    background: #8a7600;
    color: #ffffff;
}

.book-guide-btn {
    border: 1px solid #002045;
    background: #002045;
    color: #ffffff;
}

.book-guide-btn:hover {
    border-color: #8a7600;
    background: #8a7600;
}

.book-guide-disabled {
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    color: #8b95a1;
}

/* =====================================================
   PAGINATION + EMPTY
===================================================== */

.book-pagination {
    margin: 22px 0 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.book-page-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ded3bd;
    background: #fffdf8;
    color: #5f6875;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.book-page-btn:hover,
.book-page-btn.is-active {
    background: #002045;
    border-color: #002045;
    color: #fffdf7;
}

.book-page-btn.is-disabled {
    opacity: 0.48;
    cursor: not-allowed;
    pointer-events: none;
}

.book-empty {
    min-height: 300px;
    padding: 34px 18px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    border: 1px dashed #d7c99f;
    background: #fffdf8;
}

.book-empty .material-symbols-outlined {
    color: #8a7600;
    font-size: 46px;
    font-weight: 250;
}

.book-empty h3 {
    margin: 10px 0 0;
    color: #172033;
    font-size: 20px;
    font-weight: 850;
}

.book-empty p {
    margin: 7px 0 0;
    color: #6f7885;
    font-size: 13px;
}

.book-empty a {
    margin-top: 16px;
    min-height: 38px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #002045;
    color: #fffdf7;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.book-empty a:hover {
    background: #8a7600;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 1280px) {
    .book-search-page > .uni-container {
        width: min(1240px, calc(100% - 40px));
    }

    .book-search-body {
        grid-template-columns: 230px minmax(0, 1fr);
        gap: 18px;
    }

    .book-search-form {
        grid-template-columns: 135px minmax(220px, 1fr) 165px 118px;
        gap: 8px;
    }

    .book-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    }
}

@media (max-width: 1080px) {
    .book-search-body {
        grid-template-columns: 212px minmax(0, 1fr);
    }

    .book-search-form {
        grid-template-columns: 1fr 1fr;
    }

    .book-search-input {
        grid-column: 1 / -1;
    }
}

@media (max-width: 960px) {
    .book-search-page {
        padding-top: 18px;
    }

    .book-search-body {
        grid-template-columns: 1fr;
        margin-top: 0;
    }

    .book-category-panel {
        position: static;
        margin-top: 0;
        height: auto;
        min-height: 0;
    }

    .book-category-list {
        max-height: 260px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .book-result-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .book-result-title {
        display: block;
    }

    .book-result-head p {
        margin-top: 4px;
        white-space: normal;
    }

    .book-result-tools {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .book-search-page > .uni-container {
        width: min(100% - 28px, 1240px);
    }

    .book-search-form {
        grid-template-columns: 1fr;
    }

    .book-search-input {
        grid-column: auto;
    }

    .book-category-list {
        grid-template-columns: 1fr;
    }

    .book-result-tools,
    .book-sort-form,
    .book-sort-form select {
        width: 100%;
    }

    .book-sort-form {
        justify-content: space-between;
    }

    .book-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .book-cover {
        height: 175px;
    }
}

@media (max-width: 430px) {
    .book-card-grid {
        grid-template-columns: 1fr;
    }

    .book-cover {
        height: 220px;
    }
}
/* =====================================================
   CLEAN RESPONSIVE PATCH - USER BOOK SEARCH
===================================================== */
.book-search-page,
.book-search-page * {
    min-width: 0;
}

@media (max-width: 960px) {
    .book-search-body {
        grid-template-columns: 1fr !important;
    }

    .book-category-panel {
        position: static !important;
        max-height: none !important;
    }
}

@media (max-width: 640px) {
    .book-search-page > .uni-container {
        width: calc(100% - 24px) !important;
    }

    .book-search-form,
    .book-result-head,
    .book-result-tools,
    .book-sort-form {
        align-items: stretch !important;
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
    }

    .book-search-form input,
    .book-search-form select,
    .book-search-form button,
    .book-sort-form select {
        width: 100% !important;
    }
}

@media (max-width: 520px) {
    .book-card-grid {
        grid-template-columns: 1fr !important;
    }
}

/* =====================================================
   CLEAN MOBILE OVERFLOW GUARD
===================================================== */
@media (max-width: 640px) {
    input,
    select,
    textarea,
    button {
        max-width: 100%;
    }
}

/* =====================================================
   MOBILE RESPONSIVE - RESULT HEAD + BOOK CARD GIỐNG TRANG CHỦ
===================================================== */

@media (max-width: 640px) {
    /* Kết quả tra cứu */
    .book-result-head {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .book-result-title {
        width: 100% !important;
        display: block !important;
    }

    .book-result-head h2 {
        margin: 0 !important;
        font-size: 22px !important;
        line-height: 1.2 !important;
        white-space: normal !important;
    }

    .book-result-head p {
        margin-top: 4px !important;
        font-size: 13px !important;
        line-height: 1.35 !important;
        white-space: normal !important;
    }

    /* Sắp xếp + Mới cập nhật nằm cùng 1 hàng */
    .book-result-tools {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        align-items: stretch !important;
    }

    .book-sort-form {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 10px !important;
        flex-direction: row !important;
    }

    .book-sort-form label {
        margin: 0 !important;
        color: #7a8290 !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }

    .book-sort-form select {
        width: 100% !important;
        min-width: 0 !important;
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 28px 0 10px !important;
        border: 1px solid #eadfca !important;
        border-radius: 8px !important;
        background: #fffdf8 !important;
        color: #002045 !important;
        font-size: 12px !important;
        font-weight: 700 !important;
    }

    .book-clear-filter {
        width: 100% !important;
        justify-content: space-between !important;
        border-radius: 8px !important;
    }

    /* Card sách giống card sách mới bên trang chủ */
    .book-card-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .book-card {
        padding: 10px !important;
        border: 1px solid #ded3bd !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        overflow: hidden !important;
        box-shadow: 0 8px 22px rgba(0, 32, 69, 0.055) !important;
        transition: 0.18s ease !important;
    }

    .book-card:hover {
        transform: translateY(-3px) !important;
        border-color: rgba(0, 32, 69, 0.25) !important;
        box-shadow: 0 12px 28px rgba(0, 32, 69, 0.09) !important;
    }

    .book-cover {
        width: 100% !important;
        height: 230px !important;
        padding: 6px !important;
        border: 1px solid #e4d8c0 !important;
        border-radius: 8px !important;
        background: #f4efe3 !important;
        overflow: hidden !important;
    }

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

    .book-status {
        top: 10px !important;
        left: 10px !important;
        min-height: 20px !important;
        padding: 0 8px !important;
        font-size: 9px !important;
        font-weight: 800 !important;
    }

    .book-card-body {
        padding: 11px 2px 2px !important;
    }

    .book-card-body h3 {
        min-height: 32px !important;
        margin: 0 !important;
        color: #002045 !important;
        font-size: 11.8px !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
        display: -webkit-box !important;
        line-clamp: 2 !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .book-author {
        margin: 6px 0 0 !important;
        color: #727b88 !important;
        font-size: 10.5px !important;
        line-height: 1.35 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .book-meta {
        margin-top: 8px !important;
        padding: 0 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        border: 0 !important;
        background: transparent !important;
    }

    .book-meta span {
        max-width: 100% !important;
        padding: 4px 8px !important;
        border: 1px solid #eee4d2 !important;
        border-radius: 999px !important;
        background: #faf7f1 !important;
        color: #5f6875 !important;
        font-size: 9.5px !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .book-actions {
        margin-top: 9px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 7px !important;
    }

    .book-detail-btn,
    .book-guide-btn,
    .book-guide-disabled {
        min-height: 31px !important;
        border-radius: 6px !important;
        font-size: 10.5px !important;
        font-weight: 700 !important;
    }
}

@media (max-width: 380px) {
    .book-cover {
        height: 210px !important;
    }

    .book-sort-form {
        gap: 8px !important;
    }

    .book-sort-form label,
    .book-sort-form select {
        font-size: 11.5px !important;
    }
}

/* =====================================================
   MOBILE - CHỈ CHỈNH ẢNH BÌA SÁCH CHO GỌN VỪA KHUNG
===================================================== */

@media (max-width: 640px) {
    .book-cover {
        height: 220px !important;
        padding: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #f4efe3 !important;
        overflow: hidden !important;
    }

    .book-cover img {
        width: auto !important;
        height: 100% !important;
        max-width: 68% !important;
        object-fit: contain !important;
        object-position: center !important;
        display: block !important;
        margin: 0 auto !important;
    }
}

@media (max-width: 380px) {
    .book-cover {
        height: 205px !important;
    }

    .book-cover img {
        max-width: 64% !important;
    }
}
/* =====================================================
   MOBILE - PHÂN TRANG NẰM CÙNG 1 HÀNG
===================================================== */

@media (max-width: 640px) {
    /* Khung phân trang */
    .pagination,
    nav[role="navigation"] .pagination,
    .book-pagination,
    .books-pagination {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        margin: 14px auto 0 !important;
        padding: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
        scrollbar-width: none !important;
    }

    .pagination::-webkit-scrollbar,
    nav[role="navigation"] .pagination::-webkit-scrollbar,
    .book-pagination::-webkit-scrollbar,
    .books-pagination::-webkit-scrollbar {
        display: none !important;
    }

    /* Từng nút */
    .pagination li,
    .pagination a,
    .pagination span,
    nav[role="navigation"] a,
    nav[role="navigation"] span {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    .pagination a,
    .pagination span,
    nav[role="navigation"] a,
    nav[role="navigation"] span {
        min-width: 28px !important;
        height: 28px !important;
        padding: 0 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid #eadfca !important;
        border-radius: 0 !important;
        background: #fffdf8 !important;
        color: #002045 !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        text-decoration: none !important;
    }

    /* Nút active */
    .pagination .active span,
    .pagination .active a,
    nav[role="navigation"] [aria-current="page"] span,
    nav[role="navigation"] [aria-current="page"] {
        background: #002045 !important;
        border-color: #002045 !important;
        color: #ffffff !important;
    }

    /* Nút Trước / Sau nhỏ lại để không rớt dòng */
    .pagination li:first-child a,
    .pagination li:first-child span,
    .pagination li:last-child a,
    .pagination li:last-child span {
        min-width: auto !important;
        padding: 0 9px !important;
        font-size: 10.5px !important;
    }

    /* Nếu vẫn chật thì ẩn bớt nút disabled */
    .pagination .disabled span {
        color: #9ca3af !important;
        background: #f8f5ed !important;
    }
}

@media (max-width: 380px) {
    .pagination,
    nav[role="navigation"] .pagination,
    .book-pagination,
    .books-pagination {
        gap: 4px !important;
        justify-content: flex-start !important;
    }

    .pagination a,
    .pagination span,
    nav[role="navigation"] a,
    nav[role="navigation"] span {
        min-width: 26px !important;
        height: 26px !important;
        padding: 0 7px !important;
        font-size: 10.5px !important;
    }
}