Some people take care to be pious when in front of others but forget that Allah is watching them when they are alone. Such hidden sins can actually destroy a person’s good deeds too.
Allah commands us:
وَذَرُواْ ظَاهِرَ الإِثْمِ وَبَاطِنَهُ إِنَّ الَّذِينَ يَكْسِبُونَ الإِثْمَ سَيُجْزَوْنَ بِمَا كَانُواْ يَقْتَرِفُونَ
And avoid open sins and secret ones. Surely they who earn sin will be rewarded for what they have earned. (6:120)
It has been narrated by Thawban (RA) that the Prophet, may Allah bless him and grant him peace, said:
“Know that some people from my ummah will come on the Day of Judgment with good deeds as (big as) the white mountains of Tihama, but Allah will make them scattered dust.”
Thawban said: O Messenger of Allah! Describe them to us, so that we may not be one of them unknowingly!
He said: They will be your brothers, and from your people, and they will take from the night as you do (meaning offering Tahajjud prayers, etc.), but they are a people who, when they were alone with the prohibitions of Allah, violated them.(meaning that they would commit sins when alone)”