Essays on trade, immigration, and labor market shocks