%░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
%░░░      ░░░░░   ░░░░░░░░░░░░░   ░░░░░░░░░░░
%▒   ▒▒▒▒   ▒▒▒   ▒▒▒▒▒▒▒▒▒▒▒▒▒   ▒▒▒▒▒▒▒▒▒▒▒
%▒▒   ▒▒▒▒▒▒▒    ▒  ▒   ▒▒▒   ▒   ▒▒▒▒   ▒▒▒▒
%▓▓▓▓   ▓▓▓▓▓▓▓   ▓▓▓▓   ▓   ▓▓   ▓▓  ▓▓▓   ▓
%▓▓▓▓▓▓▓   ▓▓▓▓   ▓▓▓▓▓▓    ▓▓▓   ▓         ▓
%▓   ▓▓▓▓   ▓▓▓   ▓ ▓▓▓▓▓   ▓▓▓   ▓  ▓▓▓▓▓▓▓▓
%███      ██████   █████   ████   ███     ███
%██████████████████████   ███████████████████

% Global style configs for tcolorbox (to reduce bloat)
\newcommand{\usetcolorboxes}{
    \tcbset{
        mainboxstyle/.style={
            arc=3mm,
            colback=red!5!white,
            colframe=red!75!black,
            colbacktitle=red!75!black,
            fonttitle=\bfseries,
            enhanced,
            attach boxed title to top left={yshift=-2mm,xshift=5mm},
            breakable,
            top=0.4cm,
        }
    }
    \tikzset{
        overlaystyle/.style={
            draw=red!75!black,
            thick,
            fill=red!75!black,
            left,
            anchor=east,
            text=white,
            rounded corners=1mm,
            font=\bfseries,
            xshift=-5mm,
            yshift=1mm,
            inner xsep=3mm,
            inner ysep=1.5mm
        }
    }
}

% -------------------- %
% Small style elements %
% -------------------- %
\renewcommand{\footrulewidth}{0.4pt}
\newcommand{\TODO}{\color{red} \hl{TODO:} \color{black}}

% Add a color shade (similar to \fhlc, but nicer boxes)
\newcommand{\shade}[2]{
    \tcbox[on line, 
        boxsep=3pt, 
        left=0pt,
        right=0pt,
        top=0pt,
        bottom=0pt,
        colframe=white,
        colback=#1!20!white,
        highlight math style={enhanced}
    ] {\textbf{#2}}
}

% Add a gray backdrop
\newcommand{\backdrop}[1]{
    \shade{black}{#1}
}


% Fancy highlighting (Bold, underlined, colorbox behind it. Shorthand for \fhlc{white}{#1}
\newcommand{\fhl}[1]{\fhlc{white}{#1}}

% Add a colorbox around your text with the color specified. Text is bold and underlined
\newcommand{\fhlc}[2]{\textbf{\underline{\colorbox{#1}{#2}}}}


% ----------------- %
% Table of contents %
% ----------------- %

% Print a table of contents as a tcolorbox
\newcommand{\printtoc}[1]{
    \renewcommand{\cfttoctitlefont}{}
    \renewcommand{\cftaftertoctitle}{\vspace{-0.75cm}}
    \renewcommand{\contentsname}{}
    \begin{tcolorbox}[colback=black!5!white,colbacktitle=#1!75!black,coltitle=black,enhanced,attach boxed title to top center={yshift=-2mm},
        title={\Large \ifnum\value{lang}<2{Contents}\else {Inhaltsverzeichnis}\fi},fonttitle=\bfseries,breakable]
        \hspace{1cm}
        \tableofcontents
    \end{tcolorbox}
}
