Brazilians are an ethinical group. You are beyond salvation, you will pass being an racist who will not even retract. It saddens me.
you have the choice to portray yourself with something like
“I’m sorry if I referred to Brazilians with demerit, my intention was just to say that you (and not Brazilians) are stupid. I will not refer again to an individual for his nationality”
Then I would simply understand that you are not racist and misplaced your position and would not bring up this issue again.
But you chose the option of arguing that you can offend someone by addressing their ethnic group, without being racist.
Bad choice.