See this real-world conversation:
A: Something big going on in there?
B: I couldn't say.
A: You were in there a long time.
I would say "a long time" in the 3rd sentence is a noun & acts as an adverb.
I could see "a long time" adverb in the dictionary.
We got "awhile" (adverb) meaning "for a while" Source
But we don't have "alongtime" adverb in dictionaries, although we have "longtime" adjective
a lot of noun can act as adverbs
Yesterday was great
I saw her yesterday
So, Can "a long time" be an adverb meaning "for a long time"?