I think there have been a few threads on here already that you can try and read for ideas. Other than that, here are a few options. You can decide for yourself what you're comfortable with and what's allowed for your region. These are just some thoughts, so do with them whatever you like.
- Wearing underwear with pads and skin coloured tights under the leo. The tights should stop your underwear or pads from poking out, while still keeping the look the coaches want.
- Wearing underwear with pads and hoping for the best.
- Talking to your coach (ideally well before the competition). I think the more you say, the more likely the coach is to give in I expect but you have to choose what you're comfortable sharing. It can range from "I have to wear shorts for medical/female reasons" to "I'm on my period" to "I'm on my period and I can't wear tampons" or even adding "so the other option is bleeding through my leotard and I worry they'll take a deduction for that".
- Talking to your parents or a trusted adult. They can also help you talk to your coach, then can help stand up for you. And they may just have generally good ideas that you've not thought of.
- Wearing tampons anyway. I would advise you to only do this if you're okay with it. Like, if your concerns about it are "it's scary" or "it's expensive" or such, then I say maybe try it. But if you're not okay with doing it, I would say don't let anybody force you. Just my thoughts on this...
For the long term, something to take into consideration is how often this may occur again and if you can solve it. In theory, in the long term there are ways to control when you get your period via medicine, but those shouldn't be taken too lightly. If you're a high level athlete, it might be something to ask your doctor about, but then it should be because its the right call for you and not because your gym doesnt respect your autonomy to wear shorts.
(Personally if the coach isn't accommodating I'd be tempted to be super blunt about it. He's causing the issue, so he's not gonna have to face the reality of it. But I have little patience for no shorts allowed attitudes to begin with)