US appeals court rules against Trump's immigration detention policy