The maritime border dispute began when Croatia and Slovenia gained independence during the 1991 breakup of the former Yugoslavia .