I have a question about an ideal inductor. I understand the induced EMF due to moving charge and the more turns of an idealized inductor the higher the non-conservative induced emf is opposing current. I am having a hard time with energy conservation though. The induced EMF opposes current flow for some amount of time, therefore the voltage source (battery) gets polarized and has to do work to move charges aganist the electric field resulting in a loss of potential energy (negative work). Therefore in this aspect there would be an energy loss in the inductor correct?
Furthermore, is this energy recovered due to the inverse of the magnetic flux when it starts to drop and the inductor generates an induced emf (PE) to push the charges in the direction of the current drop?
In addition, if the inductor is not ideal and has some winding resistance than some energy would be loss internal as joule heating correct?