/* =========================================================
   CATEGORY PAGE
   ========================================================= */

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    max-width: calc(100% - 48px);
    margin: 30px auto 0;
}

.section-header h2 {
    margin: 0;
    font-weight: 700;
    color: var(--market-text);
}

.category-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    max-width: calc(100% - 50px);
    margin: 20px auto 0;
    align-items: start;
}

/* Sidebar */

.filter-sidebar {
    background: var(--market-white);
    border: 1px solid var(--market-border);
    border-radius: var(--market-radius);
    padding: 22px;
    position: sticky;
    top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 24px;
}

.filter-section:last-of-type {
    margin-bottom: 0;
}

.filter-section h4 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--market-text);
}

.filter-category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--market-muted);
    cursor: pointer;
}

.filter-checkbox input {
    accent-color: var(--market-teal);
    width: 16px;
    height: 16px;
}

.price-range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-range-inputs input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--market-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--market-text);
}

.price-range-inputs input:focus {
    outline: none;
    border-color: var(--market-teal);
    box-shadow: 0 0 0 3px var(--market-teal-soft);
}

.price-range-inputs span {
    color: var(--market-muted);
    font-size: 13px;
}

.filter-apply-btn {
    width: 100%;
    padding: 11px;
    margin-top: 15px;
    border: none;
    border-radius: 10px;
    background: var(--market-teal);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease;
}

.filter-apply-btn:hover {
    background: var(--market-teal-dark);
}

/* Product grid (category page variant) */

.category-layout .product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 25px;
}

.category-layout .product-card {
    background: var(--market-white);
    border: 1px solid var(--market-border);
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}

.category-layout .product-card:hover {
    box-shadow: var(--market-shadow);
    transform: translateY(-2px);
}

.category-layout .thumb {
    display: block;
    aspect-ratio: 1 / 1;
    background: #f6f8f9;
}

.category-layout .thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-layout .name {
    margin: 12px 12px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--market-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
    text-transform: uppercase;
}

.category-layout .price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 12px 14px;
}

.category-layout .price {
    font-size: 15px;
    font-weight: 700;
    color: var(--market-teal-dark);
}

.category-layout .btn-add-cart {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--market-teal-soft);
    color: var(--market-teal);
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.category-layout .cart-btn:hover {
    background: var(--market-teal);
    color: #ffffff;
}

@media (max-width: 900px) {
    .category-layout {
        grid-template-columns: 1fr;
    }

    .filter-sidebar {
        position: static;
    }

    .category-layout .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* btn back to top */

.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: var(--market-teal);
    color: #ffffff;
    font-size: 18px;
    box-shadow: 0 6px 18px rgba(24, 50, 71, .18);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s ease, transform .25s ease, background .2s ease;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--market-teal-dark);
}

@media (max-width: 480px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
}

/* =========================================================
   PAGINATION
   ========================================================= */

.market-pagination-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 10px;
}

.market-pagination {
    display: flex;
    justify-content: center;
    width: 100%;
}

.market-pagination .pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* All pagination buttons */
.market-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 38px;
    height: 38px;
    padding: 0 11px;

    border: 1px solid var(--market-border);
    border-radius: 9px;

    background: var(--market-white);
    color: var(--market-text);

    font-size: 13px;
    font-weight: 600;

    box-shadow: none;

    transition:
        background .2s ease,
        color .2s ease,
        border-color .2s ease,
        transform .2s ease;
}

/* Remove Bootstrap's joined-button styling */
.market-pagination .page-item {
    margin: 0;
}

/* Hover */
.market-pagination .page-link:hover {
    background: var(--market-teal-soft);
    border-color: #b8e5e6;
    color: var(--market-teal-dark);
    transform: translateY(-1px);
}

/* Active page */
.market-pagination .page-item.active .page-link {
    background: var(--market-teal);
    border-color: var(--market-teal);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(21, 157, 163, .18);
}

/* Disabled Previous / Next */
.market-pagination .page-item.disabled .page-link {
    background: #f7f9fa;
    border-color: var(--market-border);
    color: #a8b2b9;
    opacity: 1;
    cursor: not-allowed;
}

/* Previous and Next buttons */
.market-pagination .page-item:first-child .page-link,
.market-pagination .page-item:last-child .page-link {
    min-width: 82px;
    padding: 0 14px;
}

/* Make pagination arrows slightly smaller */
.market-pagination .page-link svg {
    width: 14px;
    height: 14px;
}

/* Ellipsis */
.market-pagination .page-item.disabled .page-link {
    cursor: default;
}

/* Mobile */
@media (max-width: 600px) {

    .market-pagination-footer {
        margin-top: 24px;
    }

    .market-pagination .pagination {
        gap: 5px;
        flex-wrap: wrap;
    }

    .market-pagination .page-link {
        min-width: 35px;
        height: 35px;
        padding: 0 9px;
        font-size: 12px;
        border-radius: 8px;
    }

    .market-pagination .page-item:first-child .page-link,
    .market-pagination .page-item:last-child .page-link {
        min-width: 68px;
        padding: 0 10px;
    }
}