\documentclass[12pt,a4paper,twoside]{report}

\usepackage[top=1.15in, bottom=1.15in, left=1.15in, right=1.15in, includehead]{geometry}


\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{alphabeta} 
\usepackage{csquotes}

\usepackage[pdftex]{graphicx,wrapfig}

%\usepackage{subfig}
\usepackage{float}
%\usepackage{minibox}
\usepackage[justification=centering]{caption}
\usepackage[framed,useliterate,numbered,autolinebreaks]{mcode}
\usepackage{xcolor}
\usepackage{appendix}
\usepackage{array}
\usepackage{longtable}

\usepackage{colortbl}

%fancyhdr for headers and footlines:
\usepackage{fancyhdr}
% Adjust headheight and topmargin as suggested by fancyhdr
\setlength{\headheight}{8pt}
\addtolength{\topmargin}{-2pt}
% Redefine the chapter format to adjust the space
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\vspace*{-0.5cm}\chaptertitlename\ \thechapter}{20pt}{\Huge}
% Redefine the chapter* format to adjust the space
\titleformat{name=\chapter,numberless}[display]{\normalfont\huge\bfseries}{\vspace*{-0.5cm}}{20pt}{\Huge}
% Adjust spacing after the chapter title
\titlespacing*{\chapter}{0pt}{0pt}{10pt}
% Adjust spacing before and after section titles
\titlespacing*{\section}{0pt}{15pt}{10pt}

\linespread{1.05}
\setlength{\parskip}

\widowpenalty 10000
\clubpenalty 10000

\usepackage{amsmath}

%package for framed sentences
\usepackage{mdframed}
\setlength{\parindent}{0pt}

\usepackage[table,xcdraw]{xcolor}
\usepackage{rotating}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{enumitem}
\setlist{nolistsep,noitemsep}
\usepackage[hidelinks]{hyperref}
\usepackage{lipsum}
\usepackage{verbatim}
\usepackage{listings}
\lstnewenvironment{mycode}[1][]%
{
    \lstset{#1}
}%
{}

%% Pagine bianche
\usepackage{afterpage}
\newcommand\blankpage{%
    \null
    \thispagestyle{empty}%
    \addtocounter{page}{-1}%
    \newpage}


\usepackage{amssymb}
\usepackage{nomencl}
\makenomenclature
\usepackage{etoolbox}
\renewcommand{\nomgroup}[1]{%
  \item[\bfseries
  \ifstrequal{#1}{A}{Roman Symbols}{%
    \ifstrequal{#1}{B}{Greek Symbols}{%
      \ifstrequal{#1}{C}{Subscript}{%
        \ifstrequal{#1}{D}{Dimensionless numbers}{%
          \ifstrequal{#1}{E}{Acronyms}{}%
        }%
      }%
    }%
  }%
]}
% Include your nomenclature file
\input{nomenclature}
%% This will add the units
%----------------------------------------------
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
%----------------------------------------------

% Bibliography
\usepackage[
backend=biber,
  style=numeric-comp,
  sorting=none % or another sorting option as needed
]{biblatex}

\addbibresource{Bibliografia.bib} %Imports bibliography file

%===========================================================
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},   
    commentstyle=\color{codegreen},
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{codepurple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}
\lstset{style=mystyle}
%===========================================================

\begin{document}

%===========================================================
\input{title}
\newpage
\afterpage{\blankpage}

\pagestyle{fancy}
\fancyhf{} % Clear header and footer
% Header for even pages
\fancyhead[RE]{\nouppercase{\leftmark}}

% Header for odd pages
\fancyhead[LO]{\nouppercase{\rightmark}}
\renewcommand{\headrulewidth}{0.4pt} % Add a rule under the header

% Footer for both even and odd pages
\fancyfoot[LE,RO]{\textbf{\thepage}}


%===========================================================
% Set page numbering to Roman numerals for the lists
\pagenumbering{roman}
\setcounter{page}{1} % Reset page counter to 1

% Here there's the abstract
\chapter*{Abstract}
\input{chapters/abstract}
\newpage

\newpage
\thispagestyle{empty}
\mbox{}

%============================================================
% Parte da commentare/scommentare
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}

\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}

\newpage
\thispagestyle{empty}
\mbox{}

\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

%\newpage
%\thispagestyle{empty}
%\mbox{}

\printnomenclature
\addcontentsline{toc}{chapter}{Nomenclature}

\newpage

\newpage
\thispagestyle{empty}
\mbox{}

%===========================================================
\chapter{Background on sloshing}\label{cap:first_chapter}
\input{chapters/First_chapter}
\newpage

\chapter{Experimental setup and methods}\label{cap:setup}
\input{chapters/setup}
\newpage

\newpage
\thispagestyle{empty}
\mbox{}

\chapter{Harmonic base excitation}
\input{chapters/harmonic_base_excitation_1DOF}
\newpage

\chapter{Earthquakes' simulation test series}
\input{chapters/earthquakes'_simulation}
\newpage

\newpage
\thispagestyle{empty}
\mbox{}

\chapter{Conclusion}
\input{chapters/conclusion}
\newpage

%============================================================================
\clearpage
\thispagestyle{empty} % Remove page number
\vspace*{\fill} % Vertical space to center the title vertically on the page
\begin{center}
    {\huge\bfseries Appendices\par}
\end{center}
\vspace*{\fill} % Vertical space to center the title vertically on the page

\newpage
\thispagestyle{empty}
\mbox{}

\appendix
\chapter{Dimensionless analysis}\label{appendix:dimensionless_analysis}
\input{appendix/appendix_Navier_Stokes}
\newpage

\chapter{Monte Carlo method}\label{appendix:MC}
\input{appendix/appendix_Monte_Carlo_method}
\newpage

\newpage
\thispagestyle{empty}
\mbox{}

\chapter{Acquisition program}
\input{appendix/appendix_acquisition_program}
\newpage

\newpage
\thispagestyle{empty}
\mbox{}

\chapter{Harmonic base excitation in 1 DoF}\label{appendix:harmonic_base_excitation_generation}
\input{appendix/sine_signal_codes}
\newpage

\newpage
\thispagestyle{empty}
\mbox{}

\addcontentsline{toc}{chapter}{Bibliography}
\printbibliography[]


%\printbibliography[heading=bibintoc,type=book,title={Books}]
%\printbibliography[heading=bibintoc,type=misc,title={Websites}]
%\printbibliography[heading=bibintoc,type=article,title={Articles}]
%\printbibliography[heading=bibintoc, type=report, title={Reports}]

\end{document}