Electronic spectroscopy of carbazole and N- and C-substituted carbazoles in homogeneous media and in solid matrix