% ========================================================================
% Paper Presentation Navigation for Beamer
% ========================================================================
% Usage: \input{paper-navbar.tex} in the preamble (after \usetheme and color definitions)
%
% Provides:
%   - Top navigation bar: section names + miniframe dots (no subsection row)
%   - Bottom footer: Author | Paper Title | Journal, Year | Page number
%   - All colors follow myblue (adapts to any Preset Color Palette)
%
% Prerequisites (must be defined before \input):
%   - \definecolor{myblue}{HTML}{...}   (from chosen Preset Color Palette)
%   - \useoutertheme{miniframes}        (required for top navigation)
%
% Paper metadata setup (in preamble, after \input):
%   \title[Short Title]{Full Title}
%   \author[Author (Affiliation)]{Full Author List}
%   \date[Journal Name, Year]{}         % leave empty if no journal: \date[]{}
% ========================================================================

% ── Unify header and footer colors (follow myblue) ─────────────────────
% Top navbar: light tint of theme color
\setbeamercolor{section in head/foot}{bg=myblue!15, fg=myblue!80!black}
\setbeamercolor{subsection in head/foot}{bg=myblue!15, fg=myblue!80!black}
% Bottom footer: author/journal/page use light tint, title uses mid tint
\setbeamercolor{author in head/foot}{bg=myblue!15, fg=myblue!80!black}
\setbeamercolor{title in head/foot}{bg=myblue!30, fg=white}
\setbeamercolor{date in head/foot}{bg=myblue!15, fg=myblue!80!black}

% ── Remove navigation symbols ─────────────────────────────────────────
\setbeamertemplate{navigation symbols}{}

% ── Compress miniframes + remove subsection empty row ─────────────────
\makeatletter
\let\beamer@writeslidentry@miniframeson=\beamer@writeslidentry
\def\beamer@writeslidentry@miniframesoff{%
  \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}%
  {\addtocontents{nav}{\protect\headcommand{%
    \protect\beamer@partpages{\the\c@page}{\the\c@page}}}}}
\newcommand*{\miniframeson}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframeson}
\newcommand*{\miniframesoff}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframesoff}
\beamer@compresstrue
\makeatother

% ── Top navigation: section names + miniframe dots, no subsection row ──
\setbeamertemplate{headline}{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}{section in head/foot}
    \vskip2pt\insertnavigation{\paperwidth}\vskip2pt
  \end{beamercolorbox}%
}

% ── Bottom footer: Author | Paper Title | Journal | Page ──────────────
\makeatletter
\setbeamertemplate{footline}{%
  \leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.5ex,dp=1ex,center]{author in head/foot}%
      \usebeamerfont{author in head/foot}\insertshortauthor
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.42\paperwidth,ht=2.5ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertshorttitle
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.22\paperwidth,ht=2.5ex,dp=1ex,center]{date in head/foot}%
      \usebeamerfont{date in head/foot}\insertshortdate
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.11\paperwidth,ht=2.5ex,dp=1ex,right]{date in head/foot}%
      \usebeamerfont{date in head/foot}\insertframenumber{}/\inserttotalframenumber\kern2em
    \end{beamercolorbox}%
  }%
}
\makeatother
