Vietnam Railways Tickets

We plan to go Sapa, and I guess the best time saving travelling method will be travelling by night, by train. Vietnam Railways is informative in term of schedule only, and not helpful in all other way. Worse, it doesn’t allow online booking. There is no photos, no introduction to classes of the train and etc. It seems like our plan to get to Sapa on the night we arrive at Hanoi is not possible if we cannot get the train tickets before hand.