You might look through my post on this thread. I think it will help explain some things better.
https://www.backyardchickens.com/forum/viewtopic.php?id=500783
If, and this is a big if, you are mainly using the coop as a safe sleeping place for them and they will have access to a large space outside, much larger than the 10 square foot per chicken in the run that is usually recommended, you should be fine with that sized coop for that many chickens. You can feed and water inside or outside as you wish and I'd suggest about 10 nest boxes for 40 hens.
But, if you are going to leave them locked in the coop very long after they wake up, you could be headed for serious problems. You are not there yet, but you are approaching the density of the commercial operations where they have to take special precautions to keep the chickens healthy and keep them from becoming cannibalistic and eating each other. Many of the commercial operations automatically cut off a portion of the top beak so they can't eat each other, for example. That chicken density can cause poop management issues. If it builds up, it can cause serious health issues. The cannibalism and poop management/health issues are the greatest concern. Even if you never keep them in there except to roost, you may be cleaning under the roosts a fair amount.
Many people just think about the weather when they look at how long the chickens will be confined in the coop. Weather is a huge part of it. Mine do not mind going outside and walking around in zero Fahrenheit weather. I cannot personally speak for their actions in colder weather because I usually don't have that in daytime. But most of mine do not like snow. I've got a few that will troop through 9" of snow to go check out the compost heap and in fairly shallow now, where the grass and weeds are still sticking through, most of mine will forage some, but in general most of mine do not like snow and try to stay out of it. Mine don't like the wind either. A general summer breeze does not bother them too much, but they do not like a cold wind or a strong wind. So, yes, weather plays a big part.
But some other things to consider. How well do you like sleeping in on a Saturday morning? Will your household work schedule allow someone to open the coop at daylight? If you travel, say go on a family vacation, can you find someone reliable to open the coop up at daylight?
Many people do have the chicken density you are talking about and make it work, but there are risks and it requires more management than some others. I'd really suggest you look at 4 square feet per chicken in the coop as a minimum to give you some flexibility in how you manage them.
Good luck!