First-principles study of structural, elastic, and electronic properties of chromium carbides