\documentclass[10pt,aspectratio=169]{beamer}

% =========================================================
% DIRECTORIES
% =========================================================
\graphicspath{{pics/}{Material/}}

% =========================================================
% THEME
% =========================================================
\usetheme{Boadilla}
\setbeamertemplate{navigation symbols}{}

% =========================================================
% PACKAGES
% =========================================================
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[lf,scale=1]{carlito}
\renewcommand*\familydefault{\sfdefault}


\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{microtype}
\usepackage{xparse}
\usepackage{comment}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{wrapfig}
\usepackage{subcaption}
\usepackage[flushleft]{threeparttable}
\usepackage{pifont}

% Optional, only needed if you use minted code blocks.
% Compile with -shell-escape if minted is used.
% \usepackage{minted}

\usepackage{silence}
\WarningsOff*

\hypersetup{hidelinks}

% =========================================================
% COLORS
% =========================================================
\definecolor{upb_hellblau}{rgb}{0.0, 0.47, 0.77}
\definecolor{upb_dunkelblau}{HTML}{0025AA}
\definecolor{titletline}{gray}{0.8}

\setbeamercolor{frametitle}{fg=upb_dunkelblau, bg=white}
\setbeamercolor{title}{fg=white, bg=upb_dunkelblau}
\setbeamercolor{structure}{fg=upb_dunkelblau}
\setbeamercolor{alerted text}{fg=upb_dunkelblau}

\setbeamercolor{itemize item}{fg=upb_dunkelblau}
\setbeamercolor{itemize subitem}{fg=upb_dunkelblau}
\setbeamercolor{itemize subsubitem}{fg=upb_dunkelblau}

% Convenience commands
\newcommand{\hdra}[1]{\alert{#1}}
\newcommand{\hdrb}[1]{\textbf{\color{upb_dunkelblau}{#1}}}

% =========================================================
% BIBLIOGRAPHY
% =========================================================
\usepackage[
  backend=biber,
  style=authoryear,
  natbib=true,
  maxcitenames=1,
  mincitenames=1,
  uniquelist=false,
  dashed=false
]{biblatex}

\addbibresource{references.bib}

\setbeamertemplate{bibliography item}{%
  \ifboolexpr{
    test {\ifentrytype{book}} or
    test {\ifentrytype{mvbook}} or
    test {\ifentrytype{collection}} or
    test {\ifentrytype{mvcollection}} or
    test {\ifentrytype{reference}} or
    test {\ifentrytype{mvreference}}
  }
    {\setbeamertemplate{bibliography item}[book]}
    {\ifentrytype{online}
       {\setbeamertemplate{bibliography item}[online]}
       {\setbeamertemplate{bibliography item}[article]}%
    }%
  \usebeamertemplate{bibliography item}%
}

\setlength{\biblabelsep}{0.25em}

\defbibenvironment{bibliography}
  {\list{}%
     {%
      \settowidth{\labelwidth}{\usebeamertemplate{bibliography item}}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item}

% =========================================================
% TITLE PAGE
% =========================================================

\setbeamercolor{title}{fg=upb_dunkelblau, bg=white}
\setbeamercolor{subtitle}{fg=upb_dunkelblau, bg=white}
\setbeamercolor{author}{fg=black}
\setbeamercolor{institute}{fg=black}
\setbeamercolor{date}{fg=black}

\makeatletter
\setbeamertemplate{title page}{%
  \vspace*{1.35cm}
  {\centering
    \vspace{-3em}
    {\usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle\par}
    \vspace{0.8em}
    {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}
    \vspace{1.5em}
    {\usebeamerfont{author}\usebeamercolor[fg]{author}\insertauthor\par}
    \vspace{1.25em}
    {\usebeamerfont{institute}\usebeamercolor[fg]{institute}\insertinstitute\par}
    \vspace{1.5em}
    {\usebeamerfont{date}\usebeamercolor[fg]{date}\insertdate\par}
  }
}
\makeatother

% =========================================================
% TITLE PAGE LOGOS
% =========================================================

% Left title-page logo.
% Replace with your own logo file.
\newcommand{\titleleftlogo}{Logo_new}

% Right title-page logo.
% Replace or comment out if not needed.
\newcommand{\titlerightlogo}{flyer_new}

\newcommand{\titleleftlogoheight}{1.cm}
\newcommand{\titlerightlogoheight}{1.2cm}

\setbeamertemplate{headline}{%
  \ifnum\insertpagenumber=1
    \vspace{0.5ex}%
    \hbox to \paperwidth{%
      \hspace*{1em}%
      \raisebox{2pt}[\height][0pt]{%
        \includegraphics[height=\titleleftlogoheight]{\titleleftlogo}%
      }%
      \hfill
      \raisebox{-5pt}[\height][0pt]{%
        \includegraphics[height=\titlerightlogoheight]{\titlerightlogo}%
      }%
      \hspace*{1.6em}%
    }%
    \vspace{0.5ex}%
  \fi
}

% =========================================================
% FRAME TITLE / HEADER
% =========================================================

\newlength{\headerlr}
\setlength{\headerlr}{1em}

\newlength{\upblogoboxht}
\setlength{\upblogoboxht}{1.35cm}

\newcommand{\contentlogo}{Material/UPB.pdf}
\newcommand{\contentlogowidth}{2.7cm}
\newcommand{\frametitlegap}{-0.9ex}

% Set true if you want a light gray line below the frame title.
\newif\iftitleline
\titlelinefalse
% \titlelinetrue

\setbeamertemplate{frametitle}{%
  \ifnum\insertpagenumber>1
    \vbox{%
      % Logo row
      \begin{beamercolorbox}[
        wd=\paperwidth,
        leftskip=0pt,
        rightskip=0pt,
        ht=\upblogoboxht,
        dp=0ex
      ]{frametitle}%
        \vspace*{0.15cm}%
        \hspace*{0.59\headerlr}%
        \includegraphics[width=\contentlogowidth]{\contentlogo}%
      \end{beamercolorbox}%
      \vspace*{\frametitlegap}%

      % Title row
      \begin{beamercolorbox}[
        wd=\paperwidth,
        leftskip=\headerlr,
        rightskip=\headerlr,
        ht=2.8ex,
        dp=1.2ex
      ]{frametitle}%
        \usebeamerfont{frametitle}\textbf{\insertframetitle}%
      \end{beamercolorbox}%

      % Optional separator line
      \iftitleline
        \vspace{-1.9ex}%
        \begin{beamercolorbox}[
          wd=\paperwidth,
          leftskip=\headerlr,
          rightskip=\headerlr,
          ht=0.4pt,
          dp=0pt
        ]{frametitle}%
          \color{titletline}\rule{\dimexpr\paperwidth-2\headerlr\relax}{0.4pt}%
        \end{beamercolorbox}%
      \fi

      % Optional frame subtitle
      \ifx\insertframesubtitle\empty\else
        \vspace{-0.3ex}%
        \begin{beamercolorbox}[
          wd=\paperwidth,
          leftskip=\headerlr,
          rightskip=\headerlr,
          ht=2ex,
          dp=0.8ex
        ]{framesubtitle}%
          \usebeamerfont{framesubtitle}\insertframesubtitle%
        \end{beamercolorbox}%
      \fi
    }%
  \fi
}

\newcommand{\semiscriptsize}{\fontsize{6}{7}\selectfont}


% =========================================================
% FOOTLINE — DESIGN C (mit Fortschrittsbalken)
% =========================================================

\newlength{\tikzfootlinethickness}
\setlength{\tikzfootlinethickness}{0.75pt}
\newcommand{\footauthor}{Short Author}

\makeatletter
\newcommand{\footlineTikZ}{%
  \ifnum\value{framenumber}=1\else
    \begin{tikzpicture}[remember picture, overlay]

      % Light base line
      \draw[black!15, line width=\tikzfootlinethickness]
        ([xshift=6pt,yshift=10.5pt]current page.south west) --
        ([xshift=-6pt,yshift=10.5pt]current page.south east);

      % Progress line
      \pgfmathsetmacro{\progress}{\insertframenumber/\inserttotalframenumber}
      \draw[upb_dunkelblau!75, line width=\tikzfootlinethickness]
        ([xshift=6pt,yshift=10.5pt]current page.south west) --
        ([xshift={6pt+\progress*(\paperwidth-12pt)},yshift=10.5pt]current page.south west);

      % Author
      \node[anchor=west,
            font=\semiscriptsize,
            text=black!55,
            inner sep=0pt]
        at ([xshift=8pt, yshift=4.8pt]current page.south west)
        {\footauthor};

      % Short title
      \node[anchor=center,
            font=\semiscriptsize,
            text=black!45,
            inner sep=0pt]
        at ([yshift=4.8pt]current page.south)
        {\insertshorttitle};

      % Page number
      \node[anchor=east,
            font=\semiscriptsize,
            text=black!55,
            inner sep=0pt]
        at ([xshift=-8pt, yshift=4.8pt]current page.south east)
        {\insertframenumber\,/\,\inserttotalframenumber};

    \end{tikzpicture}%
  \fi
}
\setbeamertemplate{footline}{\footlineTikZ}
\makeatother


% =========================================================
% BULLETS
% =========================================================

\setbeamertemplate{itemize item}{\scriptsize\raise1pt\hbox{\textbullet}}
\setbeamertemplate{itemize subitem}{%
  \tikz[baseline=0cm]\draw[upb_dunkelblau,fill=white] (0,0.1) circle (0.04);%
}
\setbeamertemplate{itemize subsubitem}{\scriptsize\raise0pt\hbox{$-$}}

\setlength{\leftmargini}{0.33cm}
\setlength{\leftmarginii}{0.30cm}
\setlength{\leftmarginiii}{0.42cm}

\makeatletter
\renewcommand{\itemize}[1][]%
{%
  \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum\@itemdepth>2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list{%
      \usebeamertemplate{itemize \beameritemnestingprefix item}%
    }{%
      \setlength\topsep{0pt}%
      \setlength\partopsep{0pt}%
      \setlength\itemsep{3pt}%
      \def\makelabel##1{{%
        \hss\llap{{%
          \usebeamerfont*{itemize \beameritemnestingprefix item}%
          \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1%
        }}%
      }}%
    }%
  \fi%
  \beamer@cramped%
  \raggedright%
  \beamer@firstlineitemizeunskip%
}
\makeatother

% =========================================================
% FONTS
% =========================================================

\setbeamerfont{normal text}{size={\fontsize{10}{12}\selectfont}}
\setbeamerfont{frametitle}{series=\bfseries, size={\fontsize{13}{12}}}
\setbeamerfont{structure}{size={\fontsize{9.5}{12}}}
\setbeamerfont{alerted text}{size={\fontsize{9.5}{12}}}
\setbeamerfont{block title}{size={\fontsize{9.5}{12}}, series=\bfseries}
\setbeamerfont{block body}{size={\fontsize{9.5}{12}}}
\setbeamerfont{itemize/enumerate body}{size={\fontsize{9.5}{12}\selectfont}}
\setbeamerfont{itemize/enumerate subbody}{size={\fontsize{9.5}{12}\selectfont}}
\setbeamerfont{itemize/enumerate subsubbody}{size={\fontsize{9}{11}\selectfont}}
\setbeamerfont{caption}{size={\fontsize{9}{9}}}

\setbeamerfont{section in toc}{size={\fontsize{13}{15}}, series=\bfseries}
\setbeamerfont{subsection in toc}{size={\fontsize{8}{11}}}
\setbeamerfont{subsubsection in toc}{size={\fontsize{8}{11}}}

% =========================================================
% TOC, CAPTIONS, BLOCKS
% =========================================================

\setbeamertemplate{section in toc}{%
  \textbf{\inserttocsectionnumber.\hspace{0.5em}\inserttocsection}
}

\setbeamertemplate{subsection in toc}{%
  \hspace{1.5em}\textbf{\inserttocsubsectionnumber.\hspace{0.5em}\inserttocsubsection}
}

\setbeamertemplate{enumerate items}{\textbf{\insertenumlabel.}}
\setbeamertemplate{blocks}[default]
\setbeamertemplate{caption}[numbered]

% =========================================================
% CONTACT PERSON MACRO
% =========================================================

\newlength{\PortraitH}
\setlength{\PortraitH}{2.8cm}

\NewDocumentCommand{\Person}{O{} m m m m}{%
  \centering
  \begin{minipage}[c][\PortraitH][c]{\linewidth}
    \centering
    \includegraphics[width=\linewidth,height=\PortraitH,keepaspectratio,#1]{#2}%
  \end{minipage}\par\vspace{0.2em}
  {\footnotesize
   \textbf{#3}\par
   \href{mailto:#4}{\texttt{#4}}\par
   #5}%
}

% =========================================================
% PDF METADATA CLEANUP
% =========================================================

\pdfstringdefDisableCommands{%
  \def\\{ }%
  \def\inst#1{}%
  \def\texttt#1{#1}%
  \def\textcolor#1#2{#2}%
}

% =========================================================
% TITLE METADATA — PLACEHOLDERS
% =========================================================

\title[Short Presentation Title]{%
  \textbf{Full Presentation TitleOptional Second Title Line}
}

\subtitle{\textbf{Conference / Event Name -- Location}}

\author[Short Author Name]{%
  First Author\inst{1}
  \and
  Second Author\inst{2}
  \and
  Third Author\inst{1}
}

\institute[Short Institute]{%
  \inst{1}
  Department / Chair,\\
  Faculty, University A%
  \and
  \inst{2}
  Department / Chair,\\
  Faculty, University B%
}

\date{\today}

% =========================================================
% DOCUMENT
% =========================================================

\begin{document}

% ---------------------------------------------------------
% TITLE PAGE
% ---------------------------------------------------------

\maketitle

% ---------------------------------------------------------
% OUTLINE
% ---------------------------------------------------------

\begin{frame}{Outline}
  \tableofcontents
\end{frame}

% =========================================================
% SECTION 1
% =========================================================

\section{Motivation}

\begin{frame}{Motivation}
\begin{itemize}
  \item \hdrb{First key point:} Replace this with your content.
  \medskip
  \item \hdrb{Second key point:} Replace this with your content.
  \medskip
  \item \hdrb{Third key point:} Replace this with your content.
\end{itemize}

\bigskip
Example math formula:
\begin{align}
  \int_a^b u\frac{d^2v}{dx^2}\,dx
  &= \left.u\frac{dv}{dx}\right|_a^b
   - \int_a^b \frac{du}{dx}\frac{dv}{dx}\,dx.
\end{align}
\end{frame}

% =========================================================
% SECTION 2
% =========================================================

\section{Method}

\begin{frame}{Method Overview}
\begin{itemize}
  \item Describe the main modeling idea.
  \medskip
  \item Explain the algorithmic contribution.
  \medskip
  \item Summarize the expected benefit.
\end{itemize}
\end{frame}

\begin{frame}{Algorithm}
\vspace{-3mm}
\small
\begin{algorithm}[H]
\caption{Placeholder Algorithm}
\begin{algorithmic}[1]
  \State Initialize input data
  \State Construct model components
  \While{termination criterion not met}
    \State Perform optimization step
    \State Update solution
  \EndWhile
  \State Return final solution
\end{algorithmic}
\end{algorithm}
\end{frame}

% =========================================================
% SECTION 3
% =========================================================

\section{Results}

\begin{frame}{Results}
\small
\begin{table}
\centering
\begin{tabular}{lrrr}
\toprule
Instance & Metric 1 & Metric 2 & Time (s) \\
\midrule
A & 1.00 & 2.00 & 10.0 \\
B & 1.50 & 2.50 & 20.0 \\
C & 2.00 & 3.00 & 30.0 \\
\bottomrule
\end{tabular}
\caption{Placeholder results table.}
\end{table}
\end{frame}

\begin{frame}{Illustration}
\centering
\includegraphics[
  width=0.25\linewidth,
  height=0.25\textheight,
  keepaspectratio
]{fawlty-towers1.png}

\vspace{2mm}
\captionof{figure}{Placeholder illustration caption.}
\end{frame}

% =========================================================
% SECTION 4
% =========================================================

\section{Summary \& Outlook}

\begin{frame}{Summary \& Outlook}
\begin{itemize}
  \item Summarize the main contribution.
  \medskip
  \item Highlight the most important result.
  \medskip
  \item Mention limitations or future work.
\end{itemize}

\vspace{5mm}
\begin{center}
  \hdrb{Thanks for listening! Questions?}
\end{center}
\end{frame}

% ---------------------------------------------------------
% CONTACT
% ---------------------------------------------------------

%\begin{frame}{Contact}
%\vspace{3mm}

%\begin{columns}[T,onlytextwidth]
  %\column{0.33\textwidth}
  %\Person{placeholder-person-1}{First Author}{first.author@example.com}{University A}

  %\column{0.33\textwidth}
  %\Person{placeholder-person-2}{Second Author}{second.author@example.com}{University B}

  %\column{0.33\textwidth}
  %\Person{placeholder-person-3}{Third Author}{third.author@example.com}{University A}
%\end{columns}
%\end{frame}

% ---------------------------------------------------------
% REFERENCES
% ---------------------------------------------------------

\begin{frame}[allowframebreaks=0.82]{References}

\setlength{\bibitemsep}{0.35em}
\printbibliography

\end{frame}

\end{document}