\documentclass[10pt]{article}


%% Importing packages
% General things
\usepackage[magyar]{babel}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{fontspec}
\usepackage[fontsize=7pt]{fontsize}

% For frame layout and content
\usepackage{xcolor}
\usepackage[framemethod=tikz,xcolor]{mdframed}
\usepackage{progressbar}

% For hyperlinks
\usepackage[hidelinks]{hyperref}


%% Setting up document
% Setting up colors globally
\definecolor{colbg}{HTML}{D3E5E5}  % Background
\definecolor{coltit}{HTML}{176767} % Question title
\definecolor{coltxl}{HTML}{EFEFEF} % Light text
\definecolor{coltxd}{HTML}{000000} % Dark text
\definecolor{colpbm}{HTML}{176767} % Correct progressbar
\definecolor{colpbs}{HTML}{75A6A6} % Incorrect progressbar
\definecolor{colpbb}{HTML}{A0A0A0} % Progressbar background
\definecolor{colanc}{HTML}{176767} % Correct answer background
\definecolor{colani}{HTML}{D3E5E5} % Incorrect answer background

% Setting up outer frames
\mdfsetup{
    nobreak,
    linewidth=0pt,
    roundcorner=0.3em,
    backgroundcolor=colbg,
}

% Setting up progressbars
\progressbarchange{
    heightr=1.25,
    roundnessa=0.2em,
    borderwidth=0pt,
    subdivisions=1,
    ticksheight=0pt,
    linecolor=colbg,
    emptycolor=colpbb,
    filledcolor=colpbm,
    labelcolor=coltxl
}

% Replacing ToC text
\addto\captionsmagyar{%
  \renewcommand{\contentsname}%
    {\huge Kurzusok}%
}

% Add dotfill to ToC
\makeatletter
\patchcmd{\l@section}{\hfil}{%
  \leaders\hbox{$\m@th
    \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
  mu$}\hfill}{}{}
\makeatother


% Set all font styles to the regular one (we don't have any other)
\setmainfont{AutourOne}[
    UprightFont={*-Regular},
    BoldFont={*-Regular},
    ItalicFont={*-Regular},
    BoldItalicFont={*-Regular},
    SmallCapsFont ={*-Regular},
    SlantedFont ={*-Regular}
]

%% Creating new environments and commands
% Just as the command says
\newcommand{\inputIfFileExists}[1]{\IfFileExists{#1}{\input{#1}}{}}

% A new command to add unnumbered sections which appear in ToC
\newcommand{\unnumsec}[1]{\section*{#1}%
\addcontentsline{toc}{section}{#1}}

% Macros for answers
\newcommand{\answerCorrect}[2]{\progressbar{#1} & \begin{minipage}{0.8\columnwidth}\begin{mdframed}[backgroundcolor=colanc]\color{coltxl}{#2}\end{mdframed}\end{minipage}\\}
\newcommand{\answerIncorrect}[2]{\progressbar[filledcolor=colpbs]{#1} & \begin{minipage}{0.8\columnwidth}\begin{mdframed}[backgroundcolor=colani]\color{coltxd}{#2}\end{mdframed}\end{minipage}\\}

% Environment for questions. The parameter is the question itself, the contents of the environment should consist of \answer*{}{} macros and nothing else
\newenvironment{question}[1]{
\begin{center}
    \begin{mdframed}
    {\color{coltit}\large #1\par}\medskip
        \begin{tabular}{c c}
}{
        \end{tabular}
    \end{mdframed}
\end{center}
}

% An environment to create a quiz containing questions. The parameter is either the title of the quiz, or the name of the course
\newenvironment{quiz}[1]{
    \unnumsec{#1}
}{
    \clearpage
}

\begin{document}
\begin{center}
    \Huge \IfFileExists{stats/title.tex}{\input{title.tex}}{Kvíz eredmények}
\end{center}

\Large
\tableofcontents
\normalsize
\clearpage

\inputIfFileExists{content.tex}

\end{document}
