The issue with foreigners working in Costa Rica is that it is frowned upon by local immigration and labor laws, however there are ways around it.

One way is to start your own business, you can work for yourself, however you are not technically allowed to take away potential employment from locals who could do the job. If you have any hustle in your game you can find a way to help travelers find what they are looking for.

Another option if you have the necessary skills is to work remotely as was mentioned in a previous post. However, it sounds to me like you are going primarily to surf and that you are not really interested in working much.

Good luck with that!