# [Tex/LaTex] Header line doesn’t span width of page

I am using the following code to create a header using fancyhdr:

\documentclass{report}
\usepackage[margin=3.0cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

% We want italics
\itshape
% The chapter number only if it's greater than 0
\ifnum\value{chapter}>0 \chaptername\ \thechapter. \fi
% The chapter title
\leftmark}
\fancyfoot[C]{\thepage}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[C]{\thepage}
}

\begin{document}
test
\end{document}


The problem is the following:

The header line doesn't span the whole width of the page.
I suspect this is because I have \usepackage[margin=3.0cm]{geometry} loaded which adjusts the margins. How can I make sure that the header line still spans the whole page while keeping these margins?

loading geometry befor fancyhdr will fix it
\usepackage[margin=3.0cm]{geometry}