Check if the vacuum brake pump is connected properly or is even working
Park the car and turn off the engine.
Pump the brake pedal five or six times
Start the engine, and keep your foot pushing down on the pedal. Check what happens to the pedal.
With the engine running, the engine sucks the air out of the brake booster, restoring the vacuum. Normally, the pedal will drop towards the floor with your foot applying light and steady pressure on it.
If the pedal pushes back against your foot, then there is a problem. This could be a blocked vacuum hose, a leak in the vacuum hose, or a leak in the brake booster check valve.
Given that it happens after the engine has been idle for some time, inspect the check valve for leaks.