This can be quite easily achieved with tcolorbox
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{cleveref}
\usepackage[most]{tcolorbox}
\newtcbtheorem{Theorem}{Theorem}{
enhanced,
sharp corners,
attach boxed title to top left={
yshifttext=-1mm
},
colback=white,
colframe=blue!75!black,
fonttitle=\bfseries,
boxed title style={
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
}
}{thm}
\newtcbtheorem[no counter]{Proof}{Proof}{
enhanced,
sharp corners,
attach boxed title to top left={
yshifttext=-1mm
},
colback=white,
colframe=blue!25,
fonttitle=\bfseries,
coltitle=black,
boxed title style={
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
}
}{prf}
\begin{document}
\begin{Theorem}{}{fermat}
No three positive integers \(a\), \(b\) and \(c\) satisfy the equation \(a^{n}
+ b^{n} = c^{n}\) for any integer greater than two.
\end{Theorem}
\begin{Proof}{Theorem \ref{thm:fermat}}{}
The proof is easy, but too large to fit in this box.
\end{Proof}
\end{document}

Have a read in its documentation for what each setting does (I will admit, the defaults are a little annoying, hence why there are so many options). It also supports breaking boxes across pages!