/*
 * Shop and product category archive refinements.
 * Scoped to catalog archive contexts to avoid side effects.
 */

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .shop-content-area .container {
    width: min(96%, 1320px);
}

/* Product card imagery: consistent framing with subtle depth. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product a img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid #ece8e2;
    box-shadow: 0 8px 20px rgba(20, 20, 20, 0.06);
    border-radius: 8px;
}

/* Keep image corners clean if inner wrappers clip differently across theme styles. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .woocommerce-loop-product__link {
    display: block;
}

/* Sorting dropdown: reserve room for caret and improve clarity. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woocommerce .woocommerce-ordering {
    position: relative;
    min-width: 300px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woocommerce .woocommerce-ordering select {
    padding-right: 56px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woocommerce .woocommerce-ordering:before {
    content: "";
    position: absolute;
    top: 1px;
    bottom: 1px;
    right: 34px;
    width: 34px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #ffffff 58%);
    pointer-events: none;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woocommerce .woocommerce-ordering:after {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
    z-index: 2;
}

/* Sidebar search field rounding and subtle structure. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .woocommerce-product-search .search-field {
    border-radius: 10px;
    border: 1px solid #e4dfd7;
    background-color: #ffffff;
}

/* Product categories sidebar: soft panel for visual symmetry. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar {
    background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
    border: 1px solid #ede7dd;
    border-radius: 10px;
    padding: 24px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .blog_widget {
    border-bottom: 1px solid #f1ece4;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .blog_widget:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories .widget-title {
    font-size: 18px;
    margin-bottom: 12px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories ul li {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 6px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories ul ul {
    padding-left: 14px;
}

/* Top-level category row */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li > a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700 !important;
    font-size: 14px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li > .count {
    flex: 0 0 auto;
    margin-left: 6px;
    font-weight: 700;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li > ul.children {
    flex: 0 0 100%;
    display: block;
    margin-top: 8px;
    margin-bottom: 0;
    padding-left: 14px;
}

/* Subcategory rows — flex so count stays right, text truncates */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li > ul.children > li {
    display: flex;
    align-items: center;
    font-weight: 500;
    margin-bottom: 5px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li > ul.children > li > a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar .widget_product_categories > ul > li > ul.children > li > .count {
    flex: 0 0 auto;
    margin-left: 6px;
}

@media (max-width: 991px) {
    :is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woocommerce .woocommerce-ordering {
        min-width: 100%;
    }

    :is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .shop-content-area .container {
        width: 94%;
    }

    :is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) .woo-sidebar {
        padding: 18px;
    }
}
