BUDAPEST, May 26 (Reuters) - Hungary needs 3-1/2 to 4 years to shift away from Russian crude and make huge investments to adjust its economy and until there is a deal on all issues, it cannot back the EU's proposed oil embargo, a top Hungarian aide said on Thursday.

Prime Minister Viktor Orban's chief of staff, Gergely Gulyas told Reuters it was not the transition period which was the biggest problem standing in the way of an agreement.

The European Commission this month proposed new sanctions against Russia for invading Ukraine but they require the unanimous support of all 27 EU member states and landlocked Hungary, which is heavily reliant on Russian oil imports via a pipeline, has been blocking them.

"If all other conditions are there, then 3.5 to 4 years would be sufficient ... but until there is an agreement on everything, there is no agreement on anything," Gulyas said in an interview.

Hungary has said it would need about 750 million euros in short-term investments to upgrade refineries and expand a pipeline bringing oil from Croatia.

It also said the longer-term conversion of its economy away from Russian oil could cost as much as 18 billion euros.

Gulyas reiterated that Hungary needed the funds to be able to make this shift.

"If the Commission can offer a solution for this, then we are open (to back the sanctions), if not, then we ask for an opt-out," he said.

"It is not the time that is the biggest problem. This technological shift is possible by Dec. 31, 2025 or mid-2026."

The EU still hopes to be able to agree sanctions on Russian oil before the next meeting of the European Council due next week, President Charles Michel said on Wednesday.

Orban told the EU not to attempt to agree the oil embargo when EU country leaders meet next week in the absence of unanimity, in a letter seen by Reuters.

Gulyas also said negotiations about the release of funds to Hungary from the EU's Recovery Fund could be wrapped up "in an hour" as there was an agreement on all significant aspects.

The European Commission has been withholding its approval to pay out money meant to help lift economies from the COVID-19 crisis to Poland and Hungary, accusing them of undermining the rule of law.

Gulyas said Hungary offered a "constructive response" to all the issues raised by Brussels.

"From the Commission's side it is not a professional question but a lack of or existence of political will which will decide when they sign the agreement with Hungary with respect to the Recovery Fund," he said. (Writing by Krisztina Than; editing by David Evans)