Multi-scale physics of bipolar membranes in electrochemical processes