Demi Lovato opens up to Cosmopolitan magazine