It sounds like the sunroof drain is blocked, common problem.
Look around the sides of the sunroof and at the inside of the door hinge area. There is a drain that is probably blocked. Take a wire hanger and gently run it up and down - that should clear it. Follow up with some water at the top to flush it out.