Refactored responsive tab behavior