NSA surveillance exposed by Snowden was illegal, court rules seven years on