"Cultural highlights", recommend you include stepping away from tourist zones and invest time in being among the current culture of locals via walking among where they live, shop, work and eat/drink in non-tourist restaurants/bars.
In Madrid enjoy a picnic in Retiro Park and then take a stroll through the business residential zone north of the park.
You itinerary creates the opportunity to return with more memories about transportation then experiences with culture. You are also creating the potential for increased travel stress of getting from point to point and encountering "glitches" which could adversely impact the effectiveness of your journey.
Am I reading your comments to understand you will be flying to Barcelona via a connection in Madrid?
For fun lets count from Sept 18 to Oct 4 as being 17 full days to create a journey in Spain. and lets also pretend this is your first trip, but you will have the opportunity to make a second trip. So......
Arrive in Barcelona and stay five days as this is a big place with a huge menu of opportunities to partake. Barcelona has an excellent subway and you could also use the train system to take a day trip (I recommend Montserrat).
Take the AVE train (high speed, comfortable, ez to use and efficient with taking you to a station adjacent to the main tourist area of Madrid) to Madrid. Travel during late afternoon to enjoy the scenery. Online ticket purchase will save you $, purchase second class tickets and be surprised at how nice is this form of transport.
Stay four days in Madrid with a day trip to Toledo.
Ok, 9 days gone with 8 remaining.
Hop back on the AVE and scoot down to Seville. Hopping off at Cordoba is an option, but no real need to spend a night. Stay three days in Seville and take in a flamenco show (I advocate the Red Door).
Now sit back and recognize you have just experienced three vastly different aspects of Spain served in three very different "containers".
Five days remain and I want to be selfish by asking you to spend the last three of them in Granada.
So you have two extra days in which you face a number of decisions, but here is a tip.....use both days at the same location to reduce the "one night stands" (which I find to be weary and not very effective). For me Gibraltar is Meh! (It is a rock), but others can rightfully advocate why you should go. My choice would be to add a day to Seville and take a day trip to Ronda and stay four days in Granada and end your trip on a relaxing romantic note.
Travel back to Madrid on the evening of the 4th and stay at a hotel near the airport to ease your departure on the 5th.
A couple of tips.............
We prefer to stay in apartments, if we are staying a minimum of three nights in one place, and for a trip of this duration recommend you do so for the following reasons: better economics, more space to spread out, having a kitchen and you can find apartments with a clothes washer. Use Airbnb to get a sense of what is available in the destinations of your choice.
Pack way less then you are comfortable in bringing. Take the risk that what you leave behind will be found in where you go. Again, a trip of this duration will become a chore (especially if you stick with your original itinerary) of hauling your luggage from point A to B. Pack less, carry less, enjoy more.
Finally, get out a map and recognize how much geography you will cover via Barcelona, Madrid, Seville and Granada. The menu of experiences is vast, but............................. please take the time to enjoy the experiences which means.......... slow down!