Analysis of Mg-based spinels MgGd2X4 (X = S, Se) for spintronic and thermoelectric device applications: Ab-initio calculations