Hi Yufan,
Every French noun has a grammatical gender, either masculine or feminine. The gender does not change depending on the person you talk to. The word "nuit" is always feminine (la nuit) and you say "Bonne nuit" to a man and also to a woman. Same for "Bonne année".
Happy New Year!