Front safety distance

Do you know what is the safety distance you have to keep with your motorcycle?

EXAMPLE

I am a regular scooter rider in my city, Zaragoza. One day I was driving down a street with two lanes with lots of traffic. I was behind a car in the left lane and suddenly he jammed on the brakes and I hit the car from behind. Luckily, it was not a hard impact. When the traffic stopped suddenly, I did not have enough time to react and brake within the necessary distance.

Second chance:

Leaving a few extra meters of separation and concentrating better on what I’m doing would have given me time to brake comfortably and safely. You also have to take into account that the vehicle behind you needs time to react to this or any other maneuver, so leaving an even greater distance would have been even better.