  Adopting the thin-layer improved brick-wall method, we investigate the
thermodynamics of a black hole embedded in a spatially flat
Friedmann-Robertson-Walker universe. We calculate the temperature and the
entropy at every apparent horizon for arbitrary solution of the scale factor.
We show that the temperature and entropy display a non-trivial behavior as
functions of time. In the case of black holes immersed in universe driven by
phantom energy, we show that for specific ranges of the equation-of-state
parameter and apparent horizons the entropy is compatible with the D-bound
conjecture, even the null, dominant and strong energy conditions are violated.
In the case of accretion of phantom energy onto black hole with small
Hawking-Hayward quasi-local mass, we obtain an equation-of-state parameter in
the range $w\leq-5/3$, guaranteeing the validity of the generalized second law.
