Kohli shines but South Africa on top in second Test