Optical forces and torques for the levitation and manipulation of nanoparticles near surfaces and in complex beams