iMac issue when idle
I'm having an issue recently where most of the time when my iMac is left idle, it activates the screen saver and then goes to sleep as scheduled. However on occasion, maybe 1 in every 6-7 times, I get something different. It returns to the log in page and while I can shake the mouse and the cursor moves around the screen but I can't click on anything including the log in box. The keyboard doesn't work at all when this happens either.
The only way to resolve the issue is to turn the Mac off using the button the back and restart.
I've done safe boot, reset the PRMA and NVRAM but the issue still persists. Does anyone have any ideas? I'm running Big Sur 11.2.3
iMac 21.5″, macOS 10.15