/**
 * TokoBandung — Products listing (/products)
 * Pola sociolita.radarbandung.com: max 1280px, gutter Bootstrap, padding horizontal clamp
 */

/*
 * Ruang vertikal di bawah navbar (sociolita memakai body.page-products + padding minimal di fluid).
 * Setelah body offset diperbesar di shopkeeper-header.css, beri sedikit jarak lagi agar filter/judul jelas.
 */
body.page-products .page-products-content > .container-fluid.py-5 {
    padding-top: 1rem !important;
    padding-bottom: 2.5rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (max-width: 991.98px) {
    body.page-products .page-products-content > .container-fluid.py-5 {
        padding-top: 1.15rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Main: lebar penuh, tidak overflow horizontal (tampak “tidak tengah”) */
body.page-products main.page-products-content {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-x: clip;
}

/* Kalahkan style.css (1140px !important) + layout-fix (1200px) — sama seperti global-centering sociolita */
body.page-products .page-products-content > .container-fluid > .container {
    max-width: min(1280px, 100%) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: clamp(1rem, 4vw, 2.5rem) !important;
    padding-right: clamp(1rem, 4vw, 2.5rem) !important;
    box-sizing: border-box !important;
}

@media (max-width: 991.98px) {
    body.page-products .page-products-content > .container-fluid > .container {
        padding-left: clamp(0.75rem, 4vw, 1.25rem) !important;
        padding-right: clamp(0.75rem, 4vw, 1.25rem) !important;
    }
}

/*
 * global-centering.css memaksa .row { margin-left:0; margin-right:0 } — merusak gutter Bootstrap.
 * JANGAN pakai selector .page-products-content .row { margin:0 } — itu bikin grid mobile tidak tengah.
 */
body.page-products .page-products-content > .container-fluid > .container > .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Grid produk: gutter rapat di mobile, tetap simetris */
body.page-products .page-products-content .products-grid-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
    justify-content: center;
}

@media (max-width: 576px) {
    body.page-products .page-products-content .products-grid-row {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }
}

body.page-products .page-products-content .products-grid-row > [class*="col-"] {
    padding-left: calc(var(--bs-gutter-x) * 0.5) !important;
    padding-right: calc(var(--bs-gutter-x) * 0.5) !important;
}

body.page-products .products-heading {
    text-align: left;
}

/* Judul — tengah di mobile (toolbar sudah dihapus) */
@media (max-width: 991.98px) {
    body.page-products .products-heading {
        text-align: center;
    }
}

/* Default: Show filter on desktop */
body.page-products #filterCollapse {
    display: block;
}

/* Mobile Filter Dropdown Styling */
@media (max-width: 991.98px) {
    body.page-products #filterCollapse {
        margin-top: 10px;
        display: none !important;
    }

    body.page-products #filterCollapse.show {
        display: block !important;
    }

    body.page-products #filterToggleBtn {
        border-radius: 8px;
        font-weight: 500;
        transition: all 0.3s ease;
    }

    body.page-products #filterToggleBtn:hover {
        background-color: #0d6efd;
        color: white;
    }

    body.page-products #filterChevron {
        transition: transform 0.3s ease;
    }
}

/* Desktop - always show filter */
@media (min-width: 992px) {
    body.page-products #filterCollapse {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
    }

    body.page-products #filterCollapse.d-none {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.page-products #filterToggleBtn {
        display: none !important;
    }

    body.page-products .product-image-container {
        position: relative !important;
        width: 100% !important;
        padding-bottom: 100% !important;
        height: 0 !important;
        overflow: hidden !important;
        background-color: #f8f9fa !important;
        display: block !important;
    }

    body.page-products .product-image-container img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        transition: transform 0.3s ease !important;
    }

    body.page-products .card:hover .product-image-container img {
        transform: scale(1.05) !important;
    }
}

/* Products grid — mobile 2 kolom; gutter dari .products-grid-row (--bs-gutter-x) */
@media (max-width: 768px) {
    body.page-products .page-products-content .col-xl-6.col-lg-6.col-md-6.col-sm-6,
    body.page-products .page-products-content .col-xl-4.col-lg-4.col-md-6.col-sm-12 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    body.page-products .product-image-container {
        position: relative !important;
        width: 100% !important;
        padding-bottom: 100% !important;
        height: 0 !important;
        overflow: hidden !important;
        background-color: #f8f9fa !important;
        display: block !important;
    }

    body.page-products .product-image-container img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        transition: transform 0.3s ease !important;
    }

    body.page-products .card {
        margin-bottom: 15px;
    }

    body.page-products .card-body {
        padding: 15px !important;
    }

    body.page-products .card-title {
        font-size: 1rem !important;
        line-height: 1.3 !important;
        margin-bottom: 10px !important;
    }

    body.page-products .card-text {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    body.page-products .badge {
        font-size: 0.7rem !important;
        padding: 4px 6px !important;
    }

    body.page-products .btn-sm {
        font-size: 0.8rem !important;
        padding: 6px 8px !important;
    }

    body.page-products .h5 {
        font-size: 1.1rem !important;
    }
}

@media (max-width: 576px) {
    body.page-products .page-products-content .col-xl-6.col-lg-6.col-md-6.col-sm-6,
    body.page-products .page-products-content .col-xl-4.col-lg-4.col-md-6.col-sm-12 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    body.page-products .product-image-container {
        position: relative !important;
        width: 100% !important;
        padding-bottom: 100% !important;
        height: 0 !important;
        overflow: hidden !important;
        background-color: #f8f9fa !important;
        display: block !important;
    }

    body.page-products .product-image-container img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        transition: transform 0.3s ease !important;
    }

    body.page-products .card {
        margin-bottom: 12px;
    }

    body.page-products .card-body {
        padding: 12px !important;
    }

    body.page-products .card-title {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
        margin-bottom: 8px !important;
    }

    body.page-products .card-text {
        font-size: 0.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }

    body.page-products .badge {
        font-size: 0.65rem !important;
        padding: 3px 5px !important;
    }

    body.page-products .btn-sm {
        font-size: 0.75rem !important;
        padding: 5px 6px !important;
    }

    body.page-products .h5 {
        font-size: 1rem !important;
    }
}
