It can be much simpler.
Use an opto-coupler to sense the ac. On the photo-transistor side, parallel it to a small capacitor and pull up the whole thing with a resistor. Essentially, the presence of ac signal is shorting the capacitor, preventing the voltage across it to go up. Put a mcu IOC or INTx pin on the capacitor, active high.
When power is lost, nothing is shorting the capacitor and its voltage gets pulled up triggering the IOC or INTx.
If you don't already have an opto-coupler, you can make one out of a LED + photo transistor / diode or a photo resistor: you must have some in your junk box, right?