  We study theoretically mode conversion and resonant overreflection of
magnetohydrodynamic waves in an inhomogeneous plane-stratified plasma in the
presence of a nonuniform shear flow, using precise numerical calculations of
the reflection and transmission coefficients and the field distributions based
on the invariant imbedding method. The cases where the flow velocity and the
external magnetic field are directed perpendicularly to the inhomogeneity
direction and both the flow velocity and the plasma density vary arbitrarily
along it are considered. When there is a shear flow, the wave frequency is
modulated locally by the Doppler shift and resonant amplification and
overreflection occur where the modulated frequency is negative and its absolute
value matches the local Alfv\'en or slow frequency. For many different types of
the density and flow velocity profiles, we find that, especially when the
parameters are such that the incident waves are totally reflected, there arises
a giant overreflection where the reflectance is much larger than 10 in a fairly
broad range of the incident angles, the frequency, and the plasma $\beta$ and
its maximum attains values larger than $10^5$. In a finite $\beta$ plasma, both
incident fast and slow magnetosonic waves are found to cause strong
overreflection and there appear multiple positions exhibiting both Alfv\'en and
slow resonances inside the plasma. We explain the mechanism of overreflection
in terms of the formation of inhomogeneous and open cavities close to the
resonances and the strong enhancement of the wave energy due to the occurrence
of semi-bound states there. We give discussions of the observational
consequences in magnetized terrestrial and solar plasmas.
