/* Force product images to show without cropping */
.product-item img,
.topbar-product-card img,
.product-image,
img.product-image,
.product-item .product-image,
.topbar-product-card .product-image {
    object-fit: contain !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-position: center !important;
}

/* Fix container heights and remove grey background */
.product-item .position-relative,
.topbar-product-card .position-relative,
.product-image-container {
    height: auto !important;
    min-height: 250px !important;
    max-height: none !important;
    background-color: transparent !important;
}

/* Override any inline styles */
.product-item img[style*="object-fit"],
.topbar-product-card img[style*="object-fit"],
.product-image[style*="object-fit"] {
    object-fit: contain !important;
}

/* Override any width/height inline styles */
.product-item img[style*="width"],
.product-item img[style*="height"],
.topbar-product-card img[style*="width"],
.topbar-product-card img[style*="height"] {
    width: auto !important;
    height: auto !important;
}

/* Remove any grey backgrounds from product containers */
.product-item,
.topbar-product-card,
.product-item .position-relative,
.topbar-product-card .position-relative,
.product-item .product-image-container,
.topbar-product-card .product-image-container {
    background-color: transparent !important;
}

/* Product detail page: main image max-width 100%, no stretching */
.product-detail-main-image,
.productMain .thumbnail-container img,
.productMain .product-detail-main-image-wrap img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}
.productMain .thumbnail-container.product-detail-main-image-wrap {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
