Widespread flooding has killed at least 21 people in Thailand after the heaviest rains the Southeast Asian country has seen for 30 years.