It borders Serbia to the east , Bosnia and Herzegovina and Montenegro to the southeast , Hungary to the northeast , and Slovenia to the northwest , sharing a maritime border with Italy .
Croatia borders the Republic of Macedonia to the southeast .