First-principles investigations of electronic properties and optical spectra of Cd1−xMnxTe dilute magnetic semiconductors