/*
 * Single product page refinements.
 * Scoped to body.single-product to avoid side effects.
 */

/* ── Sidebar: same treatment as shop archive ──────────────────────────── */

body.single-product .woo-sidebar {
    background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
    border: 1px solid #ede7dd;
    border-radius: 10px;
    padding: 24px;
}

body.single-product .woo-sidebar .blog_widget {
    border-bottom: 1px solid #f1ece4;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

body.single-product .woo-sidebar .blog_widget:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Search field */
body.single-product .woo-sidebar .woocommerce-product-search .search-field {
    border-radius: 10px;
    border: 1px solid #e4dfd7;
    background-color: #ffffff;
}

/* Product categories widget */
body.single-product .woo-sidebar .widget_product_categories .widget-title {
    font-size: 18px;
    margin-bottom: 12px;
}

body.single-product .woo-sidebar .widget_product_categories ul li {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 6px;
}

body.single-product .woo-sidebar .widget_product_categories ul ul {
    padding-left: 14px;
}

/* Top-level category row */
body.single-product .woo-sidebar .widget_product_categories > ul > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

body.single-product .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;
}

body.single-product .woo-sidebar .widget_product_categories > ul > li > .count {
    flex: 0 0 auto;
    margin-left: 6px;
    font-weight: 700;
}

body.single-product .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 */
body.single-product .woo-sidebar .widget_product_categories > ul > li > ul.children > li {
    display: flex;
    align-items: center;
    font-weight: 500;
    margin-bottom: 5px;
}

body.single-product .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;
}

body.single-product .woo-sidebar .widget_product_categories > ul > li > ul.children > li > .count {
    flex: 0 0 auto;
    margin-left: 6px;
}

/* ── Product gallery: uniform image sizing ─────────────────────────────── */

/* Main/active gallery image */
body.single-product .woocommerce-product-gallery .woocommerce-product-gallery__image {
    overflow: hidden;
    border-radius: 8px;
}

body.single-product .woocommerce-product-gallery .woocommerce-product-gallery__image 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;
    display: block;
}

/* Thumbnail strip */
body.single-product .woocommerce-product-gallery .flex-control-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 0;
    list-style: none;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs li {
    flex: 0 0 auto;
    width: calc(25% - 6px);
    overflow: hidden;
    border-radius: 6px;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs li img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid #ece8e2;
    border-radius: 6px;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs li img:hover,
body.single-product .woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(20, 20, 20, 0.12);
}

/* -- Related Products: uniform image sizing -- */

body.single-product .kd-shop-related .products li.product .woo-entry-image {
    overflow: hidden;
    border-radius: 8px;
}

body.single-product .kd-shop-related .products li.product .woo-entry-image 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;
    display: block;
}

@media (max-width: 991px) {
    body.single-product .woo-sidebar {
        padding: 18px;
    }

    body.single-product .woocommerce-product-gallery .flex-control-thumbs li {
        width: calc(25% - 6px);
    }
}
