Structural, elastic and electronic properties of MgB2C2 under pressure from first-principles calculations