/* Product grid card styles for categorieswithfilters (extracted from blade). */
/* Global override for all product images */
        .product-item img,
        .topbar-product-card img,
        .product-image {
            object-fit: contain !important;
            width: auto !important;
            height: auto !important;
            max-width: 100% !important;
            max-height: 100% !important;
        }
        
        .topbar-product-card {
            transition: all 0.3s ease;
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        /* Equal-height columns: stretch card to fill the Bootstrap col */
        .product-item {
            display: flex;
            flex-direction: column;
        }
        .product-item > .topbar-product-card {
            flex: 1 1 auto;
            width: 100%;
        }

        /* Product card and image container — fixed height comes from block settings / categorieswithfilters */
        .topbar-product-card .position-relative.product-image-container,
        .topbar-product-card .product-image-container {
            width: 100%;
            min-height: 250px;
            flex-shrink: 0;
            overflow: hidden;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            background-color: #ffffff;
            position: relative;
        }

        .topbar-product-card .product-image,
        .product-item .product-image,
        .topbar-product-card img,
        .product-item img {
            max-width: 100% !important;
            max-height: 100% !important;
            width: auto !important;
            height: auto !important;
            object-fit: contain !important;
            /* Use contain to preserve aspect ratio and show full image */
            object-position: center !important;
            transition: all 0.3s ease;
            display: block !important;
            margin: 0 auto !important;
            position: relative !important;
        }

        .topbar-product-card:hover .product-image {
            transform: scale(1.05);
        }

        /* SUP-1211: tile uses the product photo box (centered contain) + empty info for uniform card height. */
        .product-grid-tile,
        section[data-block-type="productswithfilters"] .product-grid-tile {
            display: flex !important;
            flex-direction: column !important;
            align-self: stretch !important;
        }
        .product-grid-tile > .product-grid-tile-card,
        section[data-block-type="productswithfilters"] .product-grid-tile > .product-grid-tile-card {
            flex: 1 1 auto !important;
            width: 100% !important;
            height: 100% !important;
            min-height: 100% !important;
        }
        .product-grid-tile.product-item .product-grid-tile-media,
        .product-grid-tile.product-item .product-image-container,
        .product-grid-tile .product-grid-tile-media,
        .product-grid-tile .product-image-container,
        section[data-block-type="productswithfilters"] .product-grid-tile.product-item .product-image-container,
        section[data-block-type="productswithfilters"] .product-grid-tile .product-image-container {
            position: relative !important;
            flex-shrink: 0 !important;
            width: 100% !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            overflow: hidden !important;
            background-image: none !important;
        }
        .product-grid-tile .product-grid-tile-link,
        section[data-block-type="productswithfilters"] .product-grid-tile .product-grid-tile-link {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            width: 100% !important;
            height: 100% !important;
        }
        .product-grid-tile.product-item .product-grid-tile-image,
        .product-grid-tile.product-item .product-image-container img,
        .product-grid-tile.product-item img,
        .product-grid-tile .product-grid-tile-image,
        .product-grid-tile .product-image-container img,
        .product-grid-tile img,
        section[data-block-type="productswithfilters"] .product-grid-tile.product-item img,
        section[data-block-type="productswithfilters"] .product-grid-tile img {
            max-width: 100% !important;
            max-height: 100% !important;
            width: auto !important;
            height: auto !important;
            object-fit: contain !important;
            object-position: center !important;
            margin: 0 auto !important;
            border-radius: inherit;
            transform: none !important;
            position: relative !important;
            inset: auto !important;
        }
        .product-grid-tile .product-grid-tile-info,
        section[data-block-type="productswithfilters"] .product-grid-tile .product-grid-tile-info {
            flex-grow: 1 !important;
            min-height: 4.5rem;
            pointer-events: none;
        }

        /* Colour-variant swatches: card img rules use width:auto (intrinsic), which blows up swatch images */
        .topbar-product-card .product-color-list,
        .product-item .product-color-list {
            max-width: 100%;
            flex-wrap: wrap;
            row-gap: 8px;
        }

        .topbar-product-card .product-color-list img,
        .product-item .product-color-list img,
        .topbar-product-card a.color-badge img,
        .product-item a.color-badge img {
            width: 100% !important;
            height: 100% !important;
            max-width: 100% !important;
            max-height: 100% !important;
            min-width: 0 !important;
            min-height: 0 !important;
            object-fit: cover !important;
            margin: 0 !important;
        }

        /* Force centering for all product images */
        .product-image-container {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            text-align: center !important;
        }

        .product-image-container img {
            display: block !important;
            margin: 0 auto !important;
            max-width: 100% !important;
            height: auto !important;
        }

        /* Ensure proper image loading and centering */
        .product-image-container img {
            opacity: 1;
            transition: opacity 0.3s ease, transform 0.3s ease;
            background-color: #ffffff;
            max-height: 100%;
        }

        .product-image-container img[src=""] {
            opacity: 0;
        }

        /* Loading state styling */
        .product-image-container {
            background-color: transparent;
            background-image: url('/theme/defaultlaravel/assets/images/placeholder-light-grey.svg');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }

        .product-image-container img:not([src=""]) {
            background-image: none;
        }

        .product-info {
            display: flex;
            flex-direction: column;
        }

        .product-title {
            height: 40px;
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        .product-title a {
            font-weight: normal !important;
            text-decoration: none;
        }

        .product-title a:hover {
            text-decoration: underline;
        }

        .object-fit-cover {
            object-fit: contain;
        }

        /* Badge colours/position: Setup Wizard Step 4 (theme-product-badge-css in master layout) */
        .topbar-product-card .new-label,
        .topbar-product-card:hover .new-label {
            z-index: 1000 !important;
            visibility: visible !important;
            opacity: 1 !important;
        }

        .product-image {
            transition: transform 0.3s ease;
        }

        /* Ensure product info fills remaining card height so ATC pins to bottom */
        .product-info {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            width: 100%;
            min-height: 0;
        }

        .product-card-brand-slot {
            min-height: 1.25em;
            line-height: 1.25;
        }

        @media (max-width: 992px) {
            .topbar-product-card .position-relative {
                height: 250px;
                /* Smaller height for medium screens */
            }
        }

        @media (max-width: 576px) {
            .topbar-product-card .position-relative {
                height: 200px;
                /* Smaller height for small screens */
            }
        }

        .topbar-product-card .product-image-container {
            isolation: isolate;
        }
        .topbar-product-card .product-image-container .product-image-link {
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: 100% !important;
            z-index: 1 !important;
        }
        .topbar-product-card .product-image-container > .new-label,
        .topbar-product-card .product-image-container > .product-tag {
            z-index: 40 !important;
        }

        .product-image-link {
            text-decoration: none;
        }

        .product-image-link:hover {
            text-decoration: none;
        }

        /* Available sizes: centered below colour thumbnails, hover only */
        .topbar-product-card .product-hover-available,
        .product-item .product-hover-available {
            display: none;
            width: 100%;
            margin-top: 0.5rem;
            text-align: center;
        }
        .product-hover-available__row {
            justify-content: center;
            text-align: center;
        }
        @media (hover: hover) and (pointer: fine) {
            .topbar-product-card:hover .product-hover-available,
            .product-item:hover .product-hover-available {
                display: block;
            }
        }
        @media (hover: none), (pointer: coarse) {
            .topbar-product-card .product-hover-available,
            .product-item .product-hover-available {
                display: block;
            }
        }
    