In general there is a phase difference between the displacement, x, and the applied force, F. The phase difference depends on the frequency of F relative to the natural frequency of the oscillatory system. At resonance (or, more precisely, when the driving force frequency is the same as the system's undamped natural frequency) the displacement lags behind the driving force by $\tfrac{\pi}{2}$ (a quarter of a cycle).
It's usual to express both F and x as cosines or both as sines, so that the phase difference is simply the difference in the phase constants that are added to or subtracted from, $\omega t$. For example if $F=F_0 \cos (\omega t)$ and $x=x_0 \cos (\omega t +\phi)$, the displacement will be ahead of the driving force by a phase angle of $(\phi-0)=\phi$.
But it's perfectly possible to use $F=F_0 \sin (\omega t)$ for the force and $x=x_0 \cos (\omega t +\phi)$ for the displacement. Simply remember that $\sin (\omega t) =\cos (\omega t-\tfrac{\pi}{2})$. So in this case the displacement will be ahead of the driving force by a phase angle of $[\phi -(-\tfrac{\pi}{2})]=(\phi+\tfrac{\pi}{2})$. At resonance this phase angle is $-\tfrac{\pi}{2}$, so $(\phi+\tfrac{\pi}{2})=-\tfrac{\pi}{2}$, that is $\phi=-\pi$, which is indistinguishable from $\phi=\pi$.