Let's see: English, Spanish, Portuguese, Italian, French, German. Those are the ones duolingo teached for a while now, that's already six. Mandarin, Japanese, Russian to add some you've definitely heard of as well. Now just pick a random country you know and add their language. Say... Denmark: Danish. Done. Or the Netherlands: Dutch. Switzerland: Romansh. Okay, that one was a bit obscure, but the point stands.
I was going to come on here and give this response, but I was SURE someone else had already beaten me to it!
Now THAT finally gives you an idea about where the things are going here.. (way back it all started for me with an "él es bilingüe" sentence in Spanish)
You can use them as synonyms in some senses but, in others, there can be a subtle difference between them:
Idioma refers to an official language of a country. It is linked to the existence of a national State and is proposed to identify this country among others by the language.
Língua refers to a language spoken by a group of people.
The Portuguese language is thus both an idioma and a língua. It is official in Brazil and is also spoken by its people.
The Basque language or the Sami language are línguas but not idiomas. Surely they are official regionaly but they can not be considered idiomas since they are not used to identify the national State in which they are spoken.
There can be also a country with two idiomas. In Canada both English and French are official.