I wasn’t really in the know either, but I stumbled upon the https://barcelonaweedmap.com/ website. There you can find information about cannabis clubs where everything is legal and you can smoke without worrying. It’s not just a map, but a real help in finding places where they operate according to the rules, where the atmosphere is comfortable, and everything is legal. If you want to understand how it works, I think this is a good place to start.