Lust is a psychological force producing intense wanting or longing for an object, or circumstance fulfilling the emotion. Lust can take any form such as the lust for sexuality, love, money or power. It can take such mundane forms as the lust for food as distinct from the need for food.
as salam alaikum
from a psychological perspective, even the mere presence of a person of the opposite gender have a particular influence that mold behavioral tendencies and attitudes that not necessarily relate to lust. That is also why many Islamic places, and traditional societies in general, always had a specific code to limit promiscuity and social contact between genders.
There is no problem in dealing with the opposite gender in the prescribed shar'i way and in case of necessity as long as all Islamic etiquettes are observed but one should try as much as possible to move forward what Allah has commanded in all circumstances.
With prayer for your success.
Glancing at other gender usually has a reason. If it involves lust, it will be definitely Haraam ( forbidden).
If glancing is for other reason which is completely away from desire, it should be avoided as much as possible.
It is forbidden if it influences the viewer and causes moral corruption or arousal. Furthermore on a mandatory precaution watching such movies is to avoided entirely if it contains sexually indecent scenes, accordring to Sayyid Sistani.
If the movie is immoral, which means that it contains obscene scenes that trengthen one's satanic whims, weaken one's will, faith and precipitate for vile consequences and perpetration of sinful acts it is totally impermissible, accordring to Sayyid Khamenei.
You must do an individual evaluation of the specific movies (when skipping the indecent scenes and haram music) to consider whether the rest of the content is decent.
Looking at people of opposite gender is not a problem per se, although it should be avoided because it can cause lust thoughts, as you have described and experienced.
God commands the believing men and women to lower from their gazes in the Qur’an:
“Say to the believing men to lower their gazes and guard their chastity…”(An-Nur, 24: 30)
“And tell the believing women to lower their eyes, and guard their modesty, ….”(An-Nur, 24: 31)
So we should always keep in mind that is it as requirement to avoid looking at opposite sex people and to try to lower our gaze as much as possible.
To understand more about the meaning of lower one’s gaze, please refer to
1. Meaning of Casting Down
1. What “casting down the glances” mean?
It means that a person should not look at the member of the opposite sex except for those parts that may be uncovered.
So, for instance, a man is allowed to look at the face and hands of a non-mahram lady who is not related to him provided it is not done in with a lustful intention. (“Mahram” means person in whose presence hijab is not required. See the list at end of this section.)
Also, you may want to refer to the book A Code of Ethics for Muslim Men and Women in particular the rulings related to looking at others: