p-Type conductivity mechanism and defect structure of nitrogen-doped LiNbO3 from first-principles calculations.