The term “goodnight” can be considered a single word or a phrase depending on the context and the grammatical rules being applied.

From a linguistic perspective, “goodnight” is commonly classified as a compound word, which is formed by combining two or more separate words into a single word with a distinct meaning. In this case, “goodnight” is formed by combining the adjective “good” and the noun “night” to create a noun phrase that refers to the act of bidding someone farewell at the end of the day. Compound words are a common feature of many languages, and they can be formed in various ways, including by combining nouns, adjectives, verbs, and other word classes.
However, from a grammatical perspective, the term “goodnight” can be treated as a phrase rather than a single word. In English grammar, a phrase is a group of words that functions as a unit within a sentence. A phrase may consist of a single word, such as a noun or a verb, or it may consist of several words that work together to convey a specific meaning. In this sense, “goodnight” can be considered a phrase that functions as a complete sentence or as part of a longer sentence. For example, “I said goodnight to my friend” is a complete sentence that contains the phrase “goodnight” as its object.
Additionally, the way “goodnight” is used in conversation can vary depending on the context and the speaker’s intention. In some cases, “goodnight” may be spoken as a single word as a simple way of saying farewell at the end of the day. However, in other situations, it may be used more elaborately, such as when a parent tucks in a child for the night and says “goodnight, sleep tight, don’t let the bedbugs bite.” In this context, “goodnight” is part of a longer phrase that serves to express a more complex set of sentiments.
In conclusion, “goodnight” can be considered a compound word or a phrase depending on the context and the grammatical rules being applied. While it is generally classified as a compound word, it can also be analyzed as a phrase that functions as a complete sentence or as part of a longer sentence. Ultimately, the way “goodnight” is used and understood will depend on the specific context in which it is used, the intention of the speaker, and the rules of grammar being applied.