Density Functional Theory For Confined Electrolytes: Phase Behavior, Interfacial Phenomena And Application To Capacitive Energy Storage