Non-Physical interaction with the opposite gender:
A man is required to distance himself from women very very much. It is forbidden to do any activity for the sake of sexual pleasure or lust. All the above matters receive Makas Mardus, and the above matters are forbidden also due to a negative command
Talking and Flirting:
It is permitted for a man to talk to a woman regarding work/business related subjects, as well as all necessary conversations. One is not to talk excessively, more than necessary. A woman who talks to men more than necessary, even if it is not a lightheaded/flirtatious conversation, transgresses Daas Yehudis. Some Poskim rule that one is not to stare directly at the woman while talking with her. [This law applies to men/woman of all ages, whether young or old.]
Flirtation/affection/intimate subjects: It is absolutely forbidden to flirt with a girl/woman or do any lightheaded activity with her. ]This is defined as any speech or activity which is done with the other gender for the sake of pleasure, or from which pleasure is derived.] Doing so transgresses a Biblical negative command [of Lo Sikravu]. Doing so falls under the prohibition of Giluiy Arayos of which we rule Yaharog Veaal Yavor. It goes without saying that one may not say to her words of affection that can lead towards feelings for one another, even when talking of business related subjects, as even the saying of Shalom to a woman is forbidden for this reason, as explained next. It is certainly forbidden to talk with her regarding intimate subjects that can lead to Erva.
Saying Hello/good morning: This was discussed already in a previous Halacha.
It is permitted to talk with the opposite gender regarding necessary subjects. One is not to talk excessively, regarding unnecessary matters. It is Biblically forbidden to flirt with the opposite gender due to a negative command, and doing so is included in Yaharog Veal Yavor.
 Michaber 21/1; Rambam Issurei Biya 21
 See Michaber 21/1 and Ohel Yaakov p. 169
 Pirkeiy Avos 1/5 “Do not talk excessively with a woman, certainly not with another man’s wife”; Eiruvin 53; Nedarim 20; See Beis Shmuel 21/4 “However hearing her voice during speech is permitted”; There is no prohibition found in Poskim regarding interaction with a woman for business related matters or other everyday activity, and so is the custom even amongst G-d fearing Jews to have work conversations with women when necessary; See Maharsha Bava Metzia 87a that Eily spoke with Chanah and Elisha spoke with the Shunamis.
 Beis Shmuel E.H. 115/12; Bach 115; Pirkeiy Avos ibid; Maggid Mishneh Issurei Biyah 21/2 “One who talks excessively receives Makas Mardus”; See also Maharal Nedarim 20a that talking with a woman is the beginning of an intimate connection that can lead to sin; See Shabbos 140b and Rashi there; See Derech Pikudecha Lo Sasei 35-8 that ideally it is forbidden to talk even one word more than necessary, although the custom is to be lenient being that in today’s society, men are used to seeing woman and talking to them, and it hence does not lead to forbidden thought. Nonetheless, he concludes, it is best to turn one’s head slightly during the conversation.
 Beis Shmuel E.H. 115/12; Bach 115; Such a woman can be divorced without a Kesuba. [Michaber 115/4; Kesubos 72]
 Derech Pikudecha ibid; Igros Moshe 1/40; Nitei Gavriel Yichud 50/1
 Nitei Gavriel 50/5
 Beis Shmuel and Bach ibid; Michaber 21/1 “One is to distance himself from Arayos very much….It is forbidden to have fun with her [i.e. Lischok Ima], to be light headed with her.”; Based on this Rama Y.D. 195/1 explicitly prohibits flirtatious conversation regarding a wife who is a Nida; Shach Y.D. 157/10, Rambam Yesodei Hatorah 5/9, Sanhedrin 75 “Even to speak with her behind the fence is forbidden, and better he die from his infatuation”; Pirkeiy Avos 1/5 “Do not talk excessively with a woman, certainly not with another man’s wife”; Maggid Mishneh ibid that he receives Makas Mardus; Gur Aryeh Vayeira 18/9 “If he intends to hear her voice it is forbidden”; If even asking Shalom to a woman is forbidden [as brought in Halacha] then certainly flirting with her is forbidden, Upashut! Those who state that the Shulchan Aruch does not forbid flirting are walking in darkness and miss the entire spirit of the laws mentioned here by the Michaber, aside for the fact that even saying Shalom was explicitly prohibited. There is no greater gateway action that leads towards promiscuity than flirting with the opposite gender. It is certainly included in the ruling of Michaber 21/1 “One must distance himself very very much from women”; See also Maharal Nedarim 20a that talking with a woman is the beginning of an intimate connection that can lead to sin.
 See Gur Aryeh ibid
 Michaber ibid “All the above matters receive Makas Mardus and the above matters are forbidden also due to a negative command”; Shach ibid “And he may not even talk to her for pleasure, and doing so is Biblically forbidden under Lo Sikrav”; Nitei Gavriel 50/2
 Shach Y.D. 157/10; Rambam Yesodei Hatorah 5/9; Sanhedrin 75
 See Rama Y.D. 195/1