A Logically Consistent Chain-of-Thought Approach for Stance Detection