/* DPP WooCommerce Layout Fixer v3.0 */

body.dpp-layout-fixer,
body.dpp-layout-fixer #page,
body.dpp-layout-fixer #content {
    overflow-x: clip;
}

/* Archive: stop Astra's old sidebar layout from forcing filters full-width. */
body.dpp-custom-shop-filter #content > .ast-container,
body.dpp-custom-shop-filter .site-content > .ast-container {
    display: block !important;
    width: min(100%, 1440px) !important;
    max-width: 1440px !important;
    margin-inline: auto !important;
}

body.dpp-custom-shop-filter #primary {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

body.dpp-custom-shop-filter #secondary {
    display: none !important;
}

/* Main custom shop shell. */
.dpp-shop-layout {
    display: grid;
    grid-template-columns: minmax(240px, var(--dpp-sidebar-width)) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}

.dpp-products-area {
    min-width: 0;
    width: 100%;
}

/* Professional desktop filter. */
.dpp-filter-panel {
    background: #fff;
    border: 1px solid #e9edf3;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, .08);
    box-sizing: border-box;
}

@media (min-width: 922px) {
    .dpp-filter-panel--desktop {
        display: block;
        position: sticky;
        top: 22px;
    }
}

.dpp-filter-heading,
.dpp-mobile-filter__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.dpp-filter-kicker {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .16em;
    color: var(--dpp-accent);
    margin-bottom: 5px;
}

.dpp-filter-heading h3,
.dpp-mobile-filter__header h3 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
    color: #0f172a;
}

.dpp-filter-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 13px;
    background: #0f172a;
    color: #fff;
}

.dpp-filter-group {
    padding: 0 0 18px;
    margin: 0 0 18px;
    border-bottom: 1px solid #edf0f4;
}

.dpp-filter-group:last-of-type {
    border-bottom: 0;
}

.dpp-filter-label {
    display: block;
    margin: 0 0 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.dpp-filter-form input[type="search"],
.dpp-filter-form input[type="number"] {
    width: 100%;
    min-height: 44px;
    margin: 0;
    border: 1px solid #dbe2ea !important;
    border-radius: 11px !important;
    background: #f8fafc !important;
    color: #111827 !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    padding: 10px 12px !important;
    box-shadow: none !important;
    outline: none;
    box-sizing: border-box;
}

.dpp-filter-form input:focus {
    border-color: var(--dpp-accent) !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dpp-accent) 16%, transparent) !important;
}

.dpp-search-wrap {
    position: relative;
}

.dpp-search-wrap .dpp-field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: #64748b;
    pointer-events: none;
}

.dpp-search-wrap input[type="search"] {
    padding-left: 40px !important;
}

/* Category selection: multi-select checkbox options instead of a dropdown. */
.dpp-category-group {
    border: 0;
    min-width: 0;
}

.dpp-category-group legend {
    padding: 0;
}

.dpp-category-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.dpp-category-option {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 9px 11px;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.dpp-category-option:hover {
    border-color: #cbd5e1;
    background: #fff;
    transform: translateY(-1px);
}

.dpp-category-option input {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.dpp-category-option__ui {
    width: 17px;
    height: 17px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    box-sizing: border-box;
    position: relative;
}

.dpp-category-option input:checked + .dpp-category-option__ui {
    border-color: #0f172a;
    background: #0f172a;
}

.dpp-category-option input:checked + .dpp-category-option__ui::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dpp-category-option:has(input:checked) {
    border-color: #0f172a;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, .06);
}

.dpp-category-option__text {
    min-width: 0;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.dpp-category-option__count {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eef2f7;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    box-sizing: border-box;
}

.dpp-price-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
    align-items: end;
    gap: 7px;
}

.dpp-price-row label span {
    display: block;
    margin: 0 0 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.dpp-price-sep {
    text-align: center;
    color: #94a3b8;
    padding-bottom: 12px;
}

.dpp-checks {
    display: grid;
    gap: 10px;
}

.dpp-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #334155;
    font-size: 14px;
    user-select: none;
}

.dpp-check-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.dpp-check-ui {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    position: relative;
    transition: .2s ease;
}

.dpp-check-row input:checked + .dpp-check-ui {
    background: #0f172a;
    border-color: #0f172a;
}

.dpp-check-row input:checked + .dpp-check-ui::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dpp-filter-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    align-items: center;
}

.dpp-apply-filter {
    min-height: 46px;
    border: 0 !important;
    border-radius: 12px !important;
    background: #0f172a !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: .01em;
    padding: 10px 14px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.dpp-apply-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, .18);
}

.dpp-reset-filter {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none !important;
}

/* Result count + sorting: clean compact row. */
.dpp-products-area .woocommerce-result-count {
    margin: 8px 0 18px !important;
    color: #64748b;
    font-size: 14px;
}

.dpp-products-area .woocommerce-ordering {
    margin: 0 0 18px !important;
}

.dpp-products-area .woocommerce-ordering select {
    min-height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 34px 8px 12px;
    background-color: #fff;
}

/* Product grids. */
body.dpp-layout-fixer.woocommerce.archive ul.products,
body.dpp-layout-fixer.post-type-archive-product ul.products,
body.dpp-layout-fixer.tax-product_cat ul.products,
body.dpp-layout-fixer.tax-product_tag ul.products {
    display: grid !important;
    grid-template-columns: repeat(var(--dpp-shop-cols), minmax(0, 1fr)) !important;
    gap: var(--dpp-grid-gap) !important;
    align-items: stretch !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body.dpp-layout-fixer.home .woocommerce ul.products,
body.dpp-layout-fixer.home ul.products {
    display: grid !important;
    grid-template-columns: repeat(var(--dpp-home-cols), minmax(0, 1fr)) !important;
    gap: var(--dpp-grid-gap) !important;
    align-items: stretch !important;
}

body.dpp-layout-fixer ul.products::before,
body.dpp-layout-fixer ul.products::after {
    display: none !important;
}

body.dpp-layout-fixer ul.products li.product {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    float: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

body.dpp-layout-fixer ul.products li.product img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block !important;
}

/* Hide archive-only variation/account chips. */
body.dpp-layout-fixer:not(.single-product) ul.products li.product form.variations_form,
body.dpp-layout-fixer:not(.single-product) ul.products li.product table.variations,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .variations,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .wvs_archive_variation_wrapper,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .woo-variation-items-wrapper,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .variable-items-wrapper,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .cfvsw_variations_form,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .cfvsw-swatches-container,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .swatchly_loop_variation_form,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .archive-variation-wrapper {
    display: none !important;
}

/* Mobile controls hidden on desktop. */
.dpp-mobile-shop-toolbar,
.dpp-mobile-filter {
    display: none;
}

/* Tablet + mobile: full-width products, filter becomes off-canvas button. */
@media (max-width: 921px) {
    .dpp-shop-layout {
        display: block;
        width: 100%;
    }

    .dpp-filter-panel--desktop {
        display: none !important;
    }

    .dpp-mobile-shop-toolbar {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        margin: 0 0 16px;
    }

    .dpp-mobile-filter-trigger {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 15px;
        border: 0;
        border-radius: 999px;
        background: #0f172a;
        color: #fff;
        font-size: 13px;
        font-weight: 800;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .14);
        cursor: pointer;
    }

    .dpp-active-count {
        min-width: 20px;
        height: 20px;
        border-radius: 999px;
        padding: 0 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--dpp-accent);
        color: #06131f;
        font-size: 11px;
        font-weight: 900;
    }

    .dpp-mobile-filter {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999999;
        pointer-events: none;
        visibility: hidden;
    }

    .dpp-mobile-filter.is-open {
        pointer-events: auto;
        visibility: visible;
    }

    .dpp-mobile-filter__overlay {
        position: absolute;
        inset: 0;
        background: rgba(2, 6, 23, .58);
        opacity: 0;
        transition: opacity .25s ease;
    }

    .dpp-mobile-filter.is-open .dpp-mobile-filter__overlay {
        opacity: 1;
    }

    .dpp-mobile-filter__drawer {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(92vw, 390px);
        background: #fff;
        padding: max(18px, env(safe-area-inset-top)) 20px 22px;
        overflow-y: auto;
        box-sizing: border-box;
        transform: translateX(-102%);
        transition: transform .28s cubic-bezier(.2,.8,.2,1);
        box-shadow: 20px 0 60px rgba(2, 6, 23, .25);
    }

    .dpp-mobile-filter.is-open .dpp-mobile-filter__drawer {
        transform: translateX(0);
    }

    .dpp-mobile-filter__header {
        position: sticky;
        top: 0;
        z-index: 2;
        margin: -2px 0 18px;
        padding: 0 0 14px;
        background: #fff;
        border-bottom: 1px solid #eef2f7;
    }

    .dpp-mobile-filter__header h3 {
        margin: 0 !important;
        font-size: 20px !important;
        line-height: 1.2 !important;
        font-weight: 800 !important;
        color: #0f172a !important;
    }

    .dpp-mobile-filter__close {
        -webkit-appearance: none !important;
        appearance: none !important;
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 50% !important;
        background: #0f172a !important;
        color: #fff !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 38px !important;
        line-height: 1 !important;
        box-shadow: none !important;
        text-shadow: none !important;
        cursor: pointer;
    }

    .dpp-mobile-filter__close:hover,
    .dpp-mobile-filter__close:focus {
        background: #1e293b !important;
        color: #fff !important;
        outline: 2px solid color-mix(in srgb, var(--dpp-accent) 35%, transparent);
        outline-offset: 2px;
    }

    .dpp-mobile-filter__close svg {
        display: block !important;
        width: 18px !important;
        height: 18px !important;
        margin: 0 !important;
    }

    html.dpp-filter-open,
    body.dpp-filter-open {
        overflow: hidden !important;
    }

    body.dpp-layout-fixer.woocommerce.archive ul.products,
    body.dpp-layout-fixer.post-type-archive-product ul.products,
    body.dpp-layout-fixer.tax-product_cat ul.products,
    body.dpp-layout-fixer.tax-product_tag ul.products,
    body.dpp-layout-fixer.home .woocommerce ul.products,
    body.dpp-layout-fixer.home ul.products {
        grid-template-columns: repeat(var(--dpp-tablet-cols), minmax(0, 1fr)) !important;
    }
}


@media (min-width: 520px) and (max-width: 921px) {
    .dpp-filter-form--mobile .dpp-category-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .dpp-filter-form--mobile .dpp-category-options {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .dpp-filter-form--mobile .dpp-category-option {
        min-height: 40px;
        padding: 8px 10px;
    }

    body.dpp-layout-fixer.woocommerce.archive ul.products,
    body.dpp-layout-fixer.post-type-archive-product ul.products,
    body.dpp-layout-fixer.tax-product_cat ul.products,
    body.dpp-layout-fixer.tax-product_tag ul.products,
    body.dpp-layout-fixer.home .woocommerce ul.products,
    body.dpp-layout-fixer.home ul.products {
        grid-template-columns: repeat(var(--dpp-mobile-cols), minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    body.dpp-layout-fixer ul.products li.product .woocommerce-loop-product__title,
    body.dpp-layout-fixer ul.products li.product h2,
    body.dpp-layout-fixer ul.products li.product h3 {
        font-size: 13px !important;
        line-height: 1.35 !important;
        overflow-wrap: anywhere !important;
        margin-top: 8px !important;
    }

    body.dpp-layout-fixer ul.products li.product .price {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    body.dpp-layout-fixer ul.products li.product .button {
        font-size: 11px !important;
        padding: 8px 9px !important;
        white-space: normal !important;
    }

    body.dpp-layout-fixer ul.products li.product .ast-woo-product-category {
        font-size: 11px !important;
        line-height: 1.25 !important;
    }

    body.dpp-layout-fixer ul.products li.product .onsale {
        min-width: auto !important;
        min-height: auto !important;
        line-height: 1 !important;
        font-size: 10px !important;
        padding: 7px 9px !important;
    }

    .dpp-products-area .woocommerce-result-count {
        font-size: 12px;
        margin-bottom: 10px !important;
    }

    .dpp-products-area .woocommerce-ordering {
        width: 100%;
        float: none !important;
    }

    .dpp-products-area .woocommerce-ordering select {
        width: 100%;
    }
}

/* WooCommerce blocks fallback. */
@media (max-width: 767px) {
    body.dpp-layout-fixer .wc-block-grid__products {
        display: grid !important;
        grid-template-columns: repeat(var(--dpp-mobile-cols), minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
    body.dpp-layout-fixer .wc-block-grid__product {
        width: 100% !important;
        max-width: none !important;
        flex: none !important;
        margin: 0 !important;
    }
}

/* v5 AJAX filter states */
.dpp-products-area {
    position: relative;
}
.dpp-products-area.is-filtering ul.products {
    opacity: .42;
    pointer-events: none;
    transition: opacity .18s ease;
}
.dpp-products-area.is-filtering::after {
    content: '';
    position: absolute;
    top: 120px;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    border: 3px solid rgba(15,23,42,.14);
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: dppShopSpin .7s linear infinite;
    z-index: 20;
}
@keyframes dppShopSpin { to { transform: rotate(360deg); } }
.dpp-apply-filter:disabled { opacity: .72; cursor: wait; transform: none !important; }
ul.products .dpp-no-products {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: 150px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 28px !important;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #475569;
    text-align: center;
    font-size: 15px;
}


/* V6: keep archive cards clean — product detail is opened by clicking the card/title/image. */
body.dpp-layout-fixer:not(.single-product) ul.products li.product a.button,
body.dpp-layout-fixer:not(.single-product) ul.products li.product button.button,
body.dpp-layout-fixer:not(.single-product) ul.products li.product .added_to_cart {
    display: none !important;
}


/* V7: keep the single-product gallery at a comfortable, standard desktop size. */
@media (min-width: 922px) {
    body.dpp-layout-fixer.single-product .woocommerce div.product div.images,
    body.dpp-layout-fixer.single-product.woocommerce-page div.product div.images {
        width: 42% !important;
        max-width: 520px !important;
        float: left !important;
        margin-right: 4% !important;
        margin-bottom: 28px !important;
    }

    body.dpp-layout-fixer.single-product .woocommerce div.product div.summary,
    body.dpp-layout-fixer.single-product.woocommerce-page div.product div.summary {
        width: 54% !important;
        max-width: none !important;
        float: right !important;
    }

    body.dpp-layout-fixer.single-product .woocommerce-product-gallery__wrapper,
    body.dpp-layout-fixer.single-product .woocommerce-product-gallery__image,
    body.dpp-layout-fixer.single-product .woocommerce-product-gallery__image a,
    body.dpp-layout-fixer.single-product .woocommerce-product-gallery__image img {
        max-width: 100% !important;
    }

    body.dpp-layout-fixer.single-product .woocommerce-product-gallery__image img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }
}

@media (max-width: 921px) {
    body.dpp-layout-fixer.single-product .woocommerce div.product div.images,
    body.dpp-layout-fixer.single-product.woocommerce-page div.product div.images,
    body.dpp-layout-fixer.single-product .woocommerce div.product div.summary,
    body.dpp-layout-fixer.single-product.woocommerce-page div.product div.summary {
        width: 100% !important;
        max-width: none !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
