Mg-doped Cu2O thin films with enhanced functional properties grown by magnetron sputtering under optimized pressure conditions