Power failure/resumption circuit
Best practices?  At your apparent skill level, give up.



I'm not trying to be rude or anything, but:


You're dealing with lethal amounts of energy from a wall plug (true for any country).
You copied/pasted gibberish for us to proofread, presumably because you didn't recognize it yourself.  How are we to know that you won't be similarly sloppy with your physical wiring?




Now, if you really want to continue this, I STRONGLY recommend that you at least ditch the custom power supply and use a small prefab wall-wart / power-brick / DC supply / plug-pack / whatever-you-guys-call-them instead.  That'll prevent people from getting zapped.

Then, and only then, you can slowly redesign the circuit from scratch, learning as you go.  As a hint, I would be tempted to use an RC circuit for both functions that you're looking for.  (ask a different question to learn what that is; don't use the comments here for that)  I would expect the supply to turn on and off relatively quickly while the RC circuit reacts more slowly; the difference tells you which alarm, if any, to activate.  (ask another question about detecting that difference)