Police detain Catalan mayor in separatist flag row