Mouse and Keyboard disconnect and bluetooth squiggly line
I have a mid 2011 iMac 27". It runs perfectly with 16 gb of ram, 500 gb SSD. I have the latest OS installed (high sierra). for the last couple of months now, my Magic Mouse (1st generation) and wireless Apple keyboard will disconnect and then reconnect very randomly at different times of the day, for different periods of time and its not specific to a particular thing I am doing.
Most of the time it reconnects both devices without issue. However every so often it will not reconnect and then the Bluetooth icon on the top right will show a squiggly line through it and I obviously cannot click it or do anything due to both the keyboard and mouse being disconnected. when this happens, I have to hold down the power button on the iMac and reboot it. I have to do this about once per day sometimes twice.
I have checked batteries in both devices and changed them out even if the devices says 50% remaining. I have tried clearing the Bluetooth files in the OS and doing a reboot with no success. Yesterday, I even did a complete OS reinstall and started completely fresh. Guess what, the mouse and keyboard started disconnecting again......
Any suggestions?? bad Bluetooth card? bad mouse and keyboard?
HELP!!!!!
Thank YOU!
iMac (27-inch Mid 2011), macOS Sierra (10.12)