I was happy riding in running trainers for years. Bought a pair of Shimano flat shoes 5? years ago, and not been happy in running trainers since. Squishy, flexible midsole, instep, ramped midsole so your toes were closer to the pedal than your midfoot. Pedal spikes ripped through the sole in no time.
any flat soled shoe is better than that. as long as the tread is small and closely spaced to mesh well with the pedal spikes, rather than big knobs like a hiking boot that might lose them, that’s 90% of the benefit.
“proper” mtb shoes will have some or all of: a stiffer sole (but some prefer flexier), grippier rubber (but some prefer less), armour and some mudproofing eg flap to keep laces clean. You might not need or want any of these, in which case you can choose any flat-soled shoe as above.