Adding in Granada/Cordoba for this trip would probably use up too much time/money of your two weeks, so maybe another time - when it’s cooler! Southern Spain is brutal in July.
With 14 days and a $2000 budget you have about $140 a day to spend. Note entry fees for museums, castles, etc. can be $10 to $20. Buy tix for sites you want to see in advance to avoid lines. Food is not expensive, but I assume you will be hosteling (Hostelworld.com?) and in the Algarve, lots of hostels only have private rooms left ($120) in July. Dorm rooms can run $45 which would leave you plenty. Also budget for train/bus tix and get a vivagem tap pass in Lisbon (good for metro and some trains).
BTW, if you have an unlocked phone, you can go to a Vodafone store and have them replace your SIM card with a tourist card good for 30 days (text/100 GB data/phone) for $20 tho you will not have your U.S. phone number. There is a store on Rossio Plaza in Lisbon as well as in the airport, but the airport usually mobbed. You will have to show your passport.
You may want to look at Sintra as a day trip/or overnight trip from Lisbon (leaves from Rossio station; 40 minute train ride/ 3 Euros) which is lovely and has multiple sites, including the Peña Palace and Moorish Castle in one direction and the Quinta de Regaleira and others in the other direction. Entry fees are about E10 to E20 and a tuk-tuk transport would be about E7 to 10 in each direction (up hill and down). Maybe spend a night in Sintra as its much cooler.
Consider a stop in Tomar on the way to Coimbra. There are some interesting sights including the Knights Templar castle/monastery/church.
Two weeks seems about right. For example, arrive Lisbon, train to Faro (3.5 hours); 3 nights Faro and train back to Lisbon; 3 nights Lisbon; 1 night Sintra; or 4 nights Lisbon; train/bus Tomar; 1 night Tomar or go on to Coimbra;; 2 nights Coimbra; train to Porto and 2/3 nights Porto. Leave from Porto or train back to Lisbon.
Have a wonderful time!