OK - first of all there is an error in your line of code - because .input-group and .foo are declared on the same element, there should not be a space between them in your css rule
#loginbox .loginform .input-group.foo input:focus { background:#002f5e; }
Secondly - and this may be intentional - I presume you are aware that your rule will only apply when that particular input has the web page focus and will retain its original colour the rest of the time? To change the colour at all times, remove the :focus.
As a hint for your theme, too, you should try to avoid the use of all those inline styles where practical. They make it much harder to style or restyle using css or settings in the future. They could all be added to your theme stylesheets.