"Bye, good night."
You can use "buonanotte" if you're saying goodbye to someone for the evening. For example, you are out to dinner with a friend, you finish and both go your separate way home. When leaving, you would say, "Ciao, buonanotte" because you won't be at their bedside when they go to sleep, so this is the last time you see them for the night. Hence "ciao, buonanotte" is ok to use in the evening, even if someone isn't going straight to sleep. Hope I make sense.
I think the point is that where in English you would use the term "Good night," in Italian it is split into two specific meanings, the one where "notte" is correct and the one where "sera" is correct. They may not overlap so much in Italian but in English there's only the one expression... well, "Good evening" as a form of goodbye does exist but it's kind of formal.