Segregation, wage structure and the gender gap