Travel from Afghanistan to Guatemala

I have been invited to an official training in Guatemala, so now I plan to go to Guatemala from Afghanistan and I will use the airport in Madrid and Morocco as transit countries. So, please, let me know if I need Schengen Transit Visa or not.