Does not seeing sunlight for several days impair moral judgment and lower mood? Background: In winter, daytime is very short where I live. A few months ago, due to a bad sleeping habit, I had not seen sunlight for almost a month. Then I noticed some strange things had been happening to me for a few days. I wasn't feeling any emotion (especially fear). In addition, ability to distinguish between right and wrong was slowly fading away.

Does not seeing any sunlight for some number of days affect sense of morality and emotions?

Update: As I recall, this happened to me 3 times over 4 years of time. But I wasn't aware of it.
Although not the question you asked, there has been at least one study looking at the influence of 'cave-like environments' on cognition - people are more prone to magical thinking/illogical beliefs (not their term) when placed in a dark, windowless environment.
Rigoli et al (2013): Cave-like Environments Facilitate Magical Thinking

Abstract
The cognitive mechanisms that underlie beliefs in the supernatural are not well understood. In an attempt to understand this phenomenon, we hypothesized that the cave environment “affords” such usage. In our experiment, 52 participants completed a survey about their metaphysical beliefs inside a room providing a great deal of natural light, while another 52 participants completed the same survey in a dark and windowless room. The survey asked participants to rate their beliefs in a variety of supernatural phenomena and also included multiple-choice questions which described bizarre scenarios that could be explained either scientifically or supernaturally. The supernatural responses to both the rating-scale questions and to the multiple-choice questions were significantly higher in the cave-like condition. These results are consistent with anthropological claims that the dark zones of caves may have played a role in the environment of evolutionary adaptedness that contributed to humans’ tendency toward magical thinking.