In Romanian, the word "buna" is an adjective that means "good" and can be used to greet someone or bid them farewell. The reason why "buna" comes first in "buna dimineața" (good morning) but second in "noapte buna" (good night) has to do with the way that adjectives are used in Romanian.
In Romanian, adjectives usually follow the noun they modify. However, there are some exceptions to this rule. One of the exceptions is when an adjective is used as a greeting or farewell. In these cases, the adjective comes first, before the noun.
So, in "buna dimineața" (good morning), "buna" comes first because it is being used as a greeting. On the other hand, in "noapte buna" (good night), "buna" comes second because it is being used as a farewell, and the noun "noapte" (night) comes first.
In summary, the position of "buna" in these phrases depends on whether it is being used as a greeting or a farewell and follows the general rule in Romanian that adjectives usually follow the noun they modify.