Morocco & Spain trip from US

I’m planning on doing my first solo trip abroad this October. Here’s my itinerary:

Day 1: Land at Marrakech

Day 2 to 4: Merzouga desert tour

Day 5: Explore Marrakech

Day 6: Fly to Barcelona

Day 7 to 8: Explore Barcelona

Day 9: Fly to Granada

Day 10-11: Explore Granada

Day 12: Fly back to US

Concerns I have:
1) Am I giving enough time to explore the three cities ?
2) Chefchaouen is another destination I want to see, but it seems difficult to get to. Is it worth seeing the blue pearl? And if so, are there tours available that doesn’t take too much time
3) Best way to travel around the city apart from walking? For example downloading Uber or Taxi apps, or relying on public transportation

Morocco & Spain trip from US