From what I understand temperature is just loss in energy due not having 100% efficiency.

If that is true then how do ideal gasses have temperature, they have conservation of momentum and that also means conservation of mechanical energy, so 100% efficiency.

So ideal gasses have 100% efficiency, how can they have a temperature?

Or is my definition just the thermal energy's definition? If that's so I would like to understand the difference between thermal energy, temperature and heat, I feel like I'm confusing those

Thanks in advance!