.mega-menu-item {
    max-width: 2400px; /* Limit the width of the container */
    margin: 0 auto; /* Center the container horizontally */
}
.mega-menu-item ul {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap to the next row */
    justify-content: center; /* Center items horizontally */	
    padding: 0;
    margin: 0;
}

.mega-menu-item ul li {
    /* Was width:auto. Each card's own markup contains a <table width="100%">,
       and inside a flex item with width:auto, that 100%-wide child pulls the
       whole item wide enough to fill the entire row -- one product per row,
       even on desktop (this is the vertical single-column stacking bug). A
       fixed card width with a max-width cap gives flex-wrap actual room to
       fit several cards per row, while still shrinking on narrow screens. */
    width: 300px;
    max-width: 100%;
    list-style: none;
    box-sizing: border-box; /* Ensure padding and border are included in the width */
	margin: 1%;
    margin-bottom: 0px; /* Add space between rows */
}

@media all and (max-width: 480px) {
    .mega-menu-item ul li {
        width: 100%; /* one card per row on very narrow phones */
    }
}