be sure that:
sera = evening
notte = night
In Rome people use to say 'buonasera' even in the afternoon, which thing I don't really like
as there is much sunshine, and I don't want to think about the evening and darkness in the early hours of the afternoon, especially in June!
Your confusion is threfore shared by some of us!
You could say 'buon pomeriggio' and start to say 'buona sera' when the sunshine already decresead by a fair amount.
'Buonanotte' is easier to use.