Complex microscopic optical potential and medium energy elastic scattering of 12C on 12C and 208Pb