FR 573 then FR 6410 at Madrid
Porto → Madrid → Sofia
Timetable, Madrid time
13:30FR 573 from Porto at the gate
05:45FR 6410 to Sofia leaves the gate
16 h 15 apart on the timetable, overnight
FR 6410 leaves 16 h 15 after FR 573 arrives on the timetable: more than half a day, so not a connection we count.