A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Try this:
DECLARE @trips TABLE (VIN VARCHAR(100),TripStartDateTime DATETIME2(7), TripEndDateTime DATETIME2(7))
INSERT INTO @trips
VALUES
('1','2021-01-01 13:00:00','2021-01-01 18:00'),
('1','2021-01-01 20:00:00','2021-01-03 11:00'),
('1','2021-01-03 20:00:00','2021-01-12 18:00')
SELECT *
, DATEDIFF(MINUTE,TripEndDateTime, Next_TripStartDateTime) as IdleTime_Minutes
FROM (
SELECT VIN
,TripStartDateTime
,TripEndDateTime
,LEAD(TripStartDateTime,1,NULL) OVER (PARTITION BY VIN ORDER BY TripStartDateTime) as Next_TripStartDateTime
FROM @trips
)a
ORDER BY VIN, TripStartDateTime