Exploring the impact of online and offline teaching methods on the cognitive abilities of medical students: a comparative study