/* =========================================================
   Digitnet Store Core Theme v6.2.3
   Shop / Category Archive Product Loading Stabilizer

   Scope:
   - /shop/
   - product category archives
   - product tag archives
   - product-search results shell

   Purpose:
   - restore valid WooCommerce product grid flow
   - keep sidebar and product area in stable columns
   - prevent newsletter/footer from being pulled beside products
   - preserve existing card UI and WooCommerce data/actions
   ========================================================= */

body.woocommerce-shop #dnShopPage,
body.tax-product_cat #dnShopPage,
body.tax-product_tag #dnShopPage,
body.post-type-archive-product:not(.search-results) #dnShopPage {
    position: relative !important;
    display: block !important;
    clear: both !important;
    box-sizing: border-box !important;
    width: min(100% - 32px, 1240px) !important;
    max-width: 1240px !important;
    margin: 32px auto 56px auto !important;
    padding: 0 !important;
    z-index: 1;
}

body.woocommerce-shop .dn-shop-sidebar-layout,
body.tax-product_cat .dn-shop-sidebar-layout,
body.tax-product_tag .dn-shop-sidebar-layout,
body.post-type-archive-product:not(.search-results) .dn-shop-sidebar-layout {
    display: grid !important;
    grid-template-columns: minmax(240px, 286px) minmax(0, 1fr) !important;
    gap: 28px !important;
    align-items: start !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.woocommerce-shop .dn-sidebar-shop,
body.tax-product_cat .dn-sidebar-shop,
body.tax-product_tag .dn-sidebar-shop,
body.post-type-archive-product:not(.search-results) .dn-sidebar-shop {
    min-width: 0 !important;
    max-width: 286px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

body.woocommerce-shop .dn-shop-main,
body.tax-product_cat .dn-shop-main,
body.tax-product_tag .dn-shop-main,
body.post-type-archive-product:not(.search-results) .dn-shop-main {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flow-root !important;
    clear: none !important;
    box-sizing: border-box !important;
}

body.woocommerce-shop .dn-shop-main .woocommerce-notices-wrapper,
body.tax-product_cat .dn-shop-main .woocommerce-notices-wrapper,
body.tax-product_tag .dn-shop-main .woocommerce-notices-wrapper,
body.post-type-archive-product:not(.search-results) .dn-shop-main .woocommerce-notices-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    clear: both !important;
}

body.woocommerce-shop .dn-shop-main .woocommerce-result-count,
body.tax-product_cat .dn-shop-main .woocommerce-result-count,
body.tax-product_tag .dn-shop-main .woocommerce-result-count,
body.post-type-archive-product:not(.search-results) .dn-shop-main .woocommerce-result-count {
    float: none !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 0 18px 0 !important;
    min-height: 40px;
}

body.woocommerce-shop .dn-shop-main .woocommerce-ordering,
body.tax-product_cat .dn-shop-main .woocommerce-ordering,
body.tax-product_tag .dn-shop-main .woocommerce-ordering,
body.post-type-archive-product:not(.search-results) .dn-shop-main .woocommerce-ordering {
    float: right !important;
    margin: 0 0 18px 16px !important;
}

body.woocommerce-shop .dn-shop-main ul.products,
body.tax-product_cat .dn-shop-main ul.products,
body.tax-product_tag .dn-shop-main ul.products,
body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products,
body.dn-product-search-clean-shell ul.products,
body.search-results.post-type-archive-product ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 24px !important;
    align-items: stretch !important;
    clear: both !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    box-sizing: border-box !important;
}

body.woocommerce-shop .dn-shop-main ul.products li.product,
body.tax-product_cat .dn-shop-main ul.products li.product,
body.tax-product_tag .dn-shop-main ul.products li.product,
body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products li.product,
body.dn-product-search-clean-shell ul.products li.product,
body.search-results.post-type-archive-product ul.products li.product {
    float: none !important;
    clear: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    box-sizing: border-box !important;
}

body.woocommerce-shop .dn-shop-main ul.products::before,
body.tax-product_cat .dn-shop-main ul.products::before,
body.tax-product_tag .dn-shop-main ul.products::before,
body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products::before,
body.dn-product-search-clean-shell ul.products::before,
body.search-results.post-type-archive-product ul.products::before {
    display: none !important;
}

body.woocommerce-shop .dn-shop-main ul.products::after,
body.tax-product_cat .dn-shop-main ul.products::after,
body.tax-product_tag .dn-shop-main ul.products::after,
body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products::after,
body.woocommerce-shop #dnShopPage::after,
body.tax-product_cat #dnShopPage::after,
body.tax-product_tag #dnShopPage::after,
body.post-type-archive-product:not(.search-results) #dnShopPage::after,
body.dn-product-search-clean-shell #dnSearchPage::after,
body.dn-product-search-clean-shell .dn-product-search-results-grid::after,
body.dn-product-search-clean-shell ul.products::after,
body.search-results.post-type-archive-product #dnSearchPage::after,
body.search-results.post-type-archive-product .dn-product-search-results-grid::after,
body.search-results.post-type-archive-product ul.products::after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

body.woocommerce-shop nav.woocommerce-pagination,
body.tax-product_cat nav.woocommerce-pagination,
body.tax-product_tag nav.woocommerce-pagination,
body.post-type-archive-product:not(.search-results) nav.woocommerce-pagination {
    clear: both !important;
    width: 100% !important;
    margin-top: 28px !important;
}

body.woocommerce-shop .newsletter,
body.tax-product_cat .newsletter,
body.tax-product_tag .newsletter,
body.post-type-archive-product:not(.search-results) .newsletter,
body.woocommerce-shop .dn-global-newsletter,
body.tax-product_cat .dn-global-newsletter,
body.tax-product_tag .dn-global-newsletter,
body.post-type-archive-product:not(.search-results) .dn-global-newsletter,
body.dn-product-search-clean-shell .newsletter,
body.dn-product-search-clean-shell .dn-global-newsletter,
body.search-results.post-type-archive-product .newsletter,
body.search-results.post-type-archive-product .dn-global-newsletter,
body.woocommerce-shop .dn-footer,
body.tax-product_cat .dn-footer,
body.tax-product_tag .dn-footer,
body.post-type-archive-product:not(.search-results) .dn-footer,
body.dn-product-search-clean-shell .dn-footer,
body.search-results.post-type-archive-product .dn-footer {
    clear: both !important;
    display: block !important;
    float: none !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: none !important;
    transform: none !important;
    z-index: 1;
}

body.dn-product-search-clean-shell #dnSearchPage,
body.search-results.post-type-archive-product #dnSearchPage {
    position: relative !important;
    display: flow-root !important;
    clear: both !important;
    box-sizing: border-box !important;
    width: min(100% - 32px, 1240px) !important;
    max-width: 1240px !important;
    margin: 56px auto 56px auto !important;
    padding: 0 !important;
    z-index: 1;
}

body.dn-product-search-clean-shell .dn-product-search-results-grid,
body.search-results.post-type-archive-product .dn-product-search-results-grid {
    position: relative !important;
    display: flow-root !important;
    clear: both !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 1180px) {
    body.woocommerce-shop .dn-shop-main ul.products,
    body.tax-product_cat .dn-shop-main ul.products,
    body.tax-product_tag .dn-shop-main ul.products,
    body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products,
    body.dn-product-search-clean-shell ul.products,
    body.search-results.post-type-archive-product ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 1024px) {
    body.woocommerce-shop #dnShopPage,
    body.tax-product_cat #dnShopPage,
    body.tax-product_tag #dnShopPage,
    body.post-type-archive-product:not(.search-results) #dnShopPage,
    body.dn-product-search-clean-shell #dnSearchPage,
    body.search-results.post-type-archive-product #dnSearchPage {
        width: min(100% - 24px, 100%) !important;
        margin-top: 32px !important;
        margin-bottom: 44px !important;
    }

    body.woocommerce-shop .dn-shop-sidebar-layout,
    body.tax-product_cat .dn-shop-sidebar-layout,
    body.tax-product_tag .dn-shop-sidebar-layout,
    body.post-type-archive-product:not(.search-results) .dn-shop-sidebar-layout {
        grid-template-columns: 1fr !important;
    }

    body.woocommerce-shop .dn-sidebar-shop,
    body.tax-product_cat .dn-sidebar-shop,
    body.tax-product_tag .dn-sidebar-shop,
    body.post-type-archive-product:not(.search-results) .dn-sidebar-shop {
        max-width: none !important;
        width: 100% !important;
    }

    body.woocommerce-shop .dn-shop-main .woocommerce-ordering,
    body.tax-product_cat .dn-shop-main .woocommerce-ordering,
    body.tax-product_tag .dn-shop-main .woocommerce-ordering,
    body.post-type-archive-product:not(.search-results) .dn-shop-main .woocommerce-ordering {
        float: none !important;
        display: block !important;
        margin: 0 0 18px 0 !important;
    }
}

@media (max-width: 767px) {
    body.woocommerce-shop .dn-shop-main ul.products,
    body.tax-product_cat .dn-shop-main ul.products,
    body.tax-product_tag .dn-shop-main ul.products,
    body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products,
    body.dn-product-search-clean-shell ul.products,
    body.search-results.post-type-archive-product ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 16px !important;
    }
}

@media (max-width: 520px) {
    body.woocommerce-shop #dnShopPage,
    body.tax-product_cat #dnShopPage,
    body.tax-product_tag #dnShopPage,
    body.post-type-archive-product:not(.search-results) #dnShopPage,
    body.dn-product-search-clean-shell #dnSearchPage,
    body.search-results.post-type-archive-product #dnSearchPage {
        width: min(100% - 18px, 100%) !important;
        margin-top: 24px !important;
        margin-bottom: 36px !important;
    }

    body.woocommerce-shop .dn-shop-main ul.products,
    body.tax-product_cat .dn-shop-main ul.products,
    body.tax-product_tag .dn-shop-main ul.products,
    body.post-type-archive-product:not(.search-results) .dn-shop-main ul.products,
    body.dn-product-search-clean-shell ul.products,
    body.search-results.post-type-archive-product ul.products {
        grid-template-columns: 1fr !important;
    }
}
