For a first visit, I think at least 3 nights in Seville, 2 in Cordoba and 3 in Granada should allow you to see the main tourist highlights without being too rushed. And if you have another day or two, I'd allocate them to Seville. But it really all depends on your interests and travel style.