If I forget to turn off all lights, I can not go to work the next day because of battery de-charing. I was wondering if there is any mechanism to prevent this by turning off electronics in a car when the battery level is below a specific level when the engine is off.
A search of "12v low voltage disconnect" will yield a variety of items. The cost will vary depending on the current rating and adjustability. Some vehicles have a system factory installed. They typically use a current sensor that surrounds the cable, while an aftermarket unit will most likely have two terminals that the cables attach to.
Yes, there is.
For the headlights, there is the headlight buzzer, as Solar Mike observed.
For interior lights that turn on after opening a door, usually, when you leave a door open for a long time, the interior lights automatically turn off.
Some cars have a smart key system, where you don't have to take the key from your pocket: you just touch the door handle, and it detects the key in your pocket. This consumes the battery charge so much that it won't work if you leave your car unused for several weeks or months. To prevent the battery from fully discharging, the smart key systems revert to a regular remote key system after few weeks. Some systems enable the smart key function only for driver's door after a week or so, turning off the system for other doors. This means if you have a smart key car, and leave it unused, you may need to press the remote button on the key fob, or use the driver's door.
For high voltage hybrid batteries in non-plug-in hybrid cars, they are disconnected from the car's electrical system by a relay after you turn off the ignition current. This means the only possible discharge is self discharge.
So, the systems to prevent discharge vary depending on what kind of discharge it is protecting against.
For headlights, on simpler cars, it is easy to wire a buzzer between the parking light circuit (hot in marker lights on) and the door switch (grounded to chassis when door open). The buzzer needs a diode in series with it, or it will have odd side effects. (Some buzzers act as diodes so that is built-in).
For other things like radio, they can be moved to a "hot in run" circuit, or be interrupted by a relay that is energized by "hot in run" power. Most cars have plenty of "hot in run" circuits and you can add more with relays.