Anisotropic ferromagnetism in carbon-doped zinc oxide from first-principles studies