Theoretical foundations of the quantum drift-diffusion and density-gradient models