Actually, Croats have this huge coastline due to Italians, more precisely Venetians who conquered Dalmatia from the Ottoman Turks in the late 17th century, during this:
https://en.wikipedia.org/wiki/Cretan...45%E2%80%9369)

So Croats didn't really gain it and Bosniaks didn't really lose it, it's a result of Ottoman-Venetian wars (just like most of the modern-day land border between Bosnia and Croatia is a result of Ottoman-Austrian wars).