Random Fourier series and continuous additive functionals of Lévy processes on the torus