Hello, some sugestions and tips:
Staying in San Gimignano won't make make it easier to reach Lucca. It takes less time to get there from say Florence.
Cinque Terre is very much out of the way.
I sugest 3 days in Florence. More than enough time to see most of it at a very relaxed pace.
2 days in San gimignano. First day spent exploring SG itself and a short trip to Siena. Second day either rent a car for, or book a wine tour. Alternatively go with a rent car/tour visit of the nearby medieval cities.
Spend last 2 days in Pisa. Day 1 visit Lucca. Day 2 visit Pisa itself. If you don't mind a more adventurous aproach, skip Lucca and do a day trip to CT.