The basic rule is, that you use one travel day for every train you ENTER before midnight.
This means, like the nightrain from Milan to Palermo (Sicily) starts at 20:00 and arrives at 16:00 on the next day. This counts as one travel day, because you don’t change trains after midnight.
If you go like from Paris to Budapest via Vienna, you take Nightjet from Paris to Vienna (1 travel day, but you change to the train to Budapest in the morning. This means a new travel day.
But for deine Route there are hardly any useful nighttrains: except in summer from ES/FR border (Hendaye) to Paris-but then there is NO more a direct connection into that train out of PT.
DO-wiederhole-MACHE the very little and time eating and uncomfortable 3 trains that still run from PT to ES-f.e. on seat61.com. For a reasonable route you then have to go with superfast AVE trains MADrid-Barca-FRance and this will cost a lot extra to pay. Every day we have to warn Pass-newbees about these pitfalls and some even wanted to cancel the pass when they found it out the hard way! It CAN be done, but not easy and its much better to see this as a nice meandering route to make some stops you would never have dreamt of before.