Good questions. The biggest problem is getting from the ship to the Livorno train station. If you can get a taxi (best to split the cost with 4) that is the best. Otherwise, you can take the shuttle bus into town, but than you would still need a taxi (pretty cheap from in town) or you can take a local bus...or you can walk it in about 30 min. Most do grab a taxi. You than take any train to Pisa (usually about 2 an hour) which is about a 15 min ride. In Pisa, you need to change to the train for Lucca which generally has at least one train an hour. Depending on your connections in Pisa, it will take anywhere from 50 min to about 1 1/2 hours to get to Lucca (total time from Livorno). Beware in Pisa because the train to Lucca is usually at the far end of the tracks towards your right as you exit onto the platform (they used to use some kind of weird track number like 2B. Once you get to Lucca its a short walk across the road and you will be at the walls of the city. Lucca is a walled city (all the walls are perfectly intact) and many like to rent a bike and ride around the walls. Just walk towards the center of the city (you can get a map at the information place at the station) and you will find shops, cafes, and a lot of atmosphere. You will have enough time to explore the entire city. You might want to download a map from one of many sites such as:
and you should be able to find some good info on-line at sites like tripadvisor.com and other travel sites.
The trains do run constantly and you should have no problems. Of course its smart to check the return schedules so you know when you must be back at the station. As to eating in Lucca, there are a few relatively small piazzas where they have outdoor cafes. If the weather is good, we generally like the outdoor places and eat whereever the daily menu looks good. Italy is pretty expensive, but if you eat the daily menus (usually written on chalk boards) you can still get some real bargains. As to shopping, the sad truth is that you will find most Italian (and European) goods are cheaper in the states (its why the Europeans are flocking here to shop). But its fun to browse. In Tuscany, we have still seen some good buys for leather (coats and bags) but you have to be a little lucky.