In the Quran, we read the story about the very rich man who lost all his wealth. The biggest takeaway from this story is all good and bad comes from God and that in the end, all of it is good.
He had two huge gardens






So he thought he was better than his poor friend...


But his friend was looking out for him, reminding him he's just a human and that anything can happen. And he was hopeful in God's blessings.


The rich man finally came to his senses, but only when it was too late:


Something subtle in the last verse is that God helps everyone, even if they don’t believe in Him or are arrogant or make mistakes. God definitely helped this man by showing him his mistakes and taking away his garden. By taking his most beloved blessings, He let him change his ways and gave him a chance to be a better person and trust Him more.
So whenever you lose something, it's just God calling you back to Him, to remember Him, so He can give you better than what you had. And remembering Him is better than anything you could ever have in this world.
Since He created us, He knows how much we hurt when we lose something, so trust Him and say "Perhaps my Lord will give me better".