I know that a man is not allowed to look at immodest women but what is called immodest (is pants ,hair)
It is true, a man may not look or gaze at women that are dressed immodestly, however he may also not look at women even if they are dressed modestly, if he is looking he is looking at her for pleasure. The gemora says that a man may not even gaze at a woman’s finger, if it is for pleasure. Therefore if he is looking at her for an objective reason, then it is permitted, however it may not be done for pleasure.
Shabbos 64b, Shulchan Aruch E:H 21-1.