Stiges is another beach town easily reached from Barcelona by train (it's on the way to Tarragona). I haven't been but it's well known for it's charm. I wouldn't recommend Tarragona for the beach, but the Roman ruins and archeological museum are worth seeing. Very dramatic setting along the coast. It would be a full day, but you could ride to Tarragona early and see a few of the main Roman sites in the center, then spend the afternoon/evening at Stiges. Trains run almost hourly.
Toledo is the main daytrip to take from Madrid and easily fills a full day. An easy 35 minute ride by train. Don't miss the cathedral, the two Jewish synagogues and the museum with numerous El Greco works (not to be confused with the El Greco House). The tiny little Mezquita is a gem if you enjoy Moorish architecture and history (Roman, Visagoth, Moors and Medieval Christian). With only 4 nights, that's about all you'll have time for but the backup is Segovia. Note that the Moorish castle (alcazar) in Segovia is nice but is mostly a late 19th century reconstruction. You'll see better examples of Moorish architecture in Toledo. The aqueduct is pretty stunning though and the cathedral is nice. El Escorial, the rural royal palace, is another option and would take less than a day. It is reached by bus (45 minute ride).