I've set up a grid with 5 columns. What I aim to achieve is, when columns 1, 2, and 5 are filled as shown in the picture, I want to position an item in the open spaces of columns 3 and 4.
Since the occupied columns may vary, I need the code to be adaptable and fill the first available empty columns before moving on to the next ones.