Fundamentals of Nonequilibrium Thermodynamics