Why is it considered not a good idea to compliment coworker's clothes?

*I asked this question already but posted in wrong topic*

My coworker complimented my sweater yesterday, said it has really cool patter and that it suits me and the comment made me so happy (We aren't great friends and he's never done this before but we do have occasional friendly chats outside of working hours). I rarely receive compliments so this one made my day and I saw absolutely nothing wrong or unprofessional about it.

I however googled whether it's common for coworkers/guys to compliment or just comment on other girls' clothes and I just got bunch of questions and threads about how it's never good idea, especially when it's man to woman and in work environment, because it may be even considered as a form of sexual harassment and I was like? since when is it considered sexual harassment to give compliments? I mean sure If you say stuff like "your tits look good in this dress" but If you give nice compliment about the clothing itself and that the person looks good in it, it's just a simple compliment and I actually think we should do this more often?

Why is it considered not a good idea to compliment coworker's clothes?
Post Opinion