Catalonia declares independence as Spain prepares to impose direct rule