Some dictionaries say "thanks to somebody/something" means "because of someone or something"
Other dictionaries say "thanks to somebody/something" means "words or actions that show that you are grateful to somebody for something"
Say, you are writing a story about a thief. The thief stole some money and he ran into the forest. Luckily, he found an abandoned house in the forest and he was able to rest in there.
This a a bad thief and you the writer don't want to thank him for what he did.
Do we say "Thanks to somebody/something" for negative meanings?
For example, "Thanks to the abandoned house, the thief took shelter in it".
Or "Thanks to the accident, he lost his arm"