% Encoding
\usepackage[utf8]{inputenc}

% Math packages (load before fonts to avoid conflicts)
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{appendix}
\usepackage[inline]{enumitem}

% Define theorem environments
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}

% Font and spacing
\usepackage{newtxtext,newtxmath}
\usepackage{setspace}
\doublespacing

% Page geometry
\usepackage[margin=1in]{geometry}

% Essential packages
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{csquotes}
\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{cleveref}
\usepackage{adjustbox}
\usetikzlibrary{trees}
% Configure cleveref for algorithm2e
\crefname{algocf}{Algorithm}{Algorithms}

\usetikzlibrary{positioning, shapes, arrows.meta, fit, backgrounds}
\lstset{
    basicstyle=\ttfamily\footnotesize,
    breaklines=true,
    frame=single,
    numbers=left,
    numberstyle=\tiny\color{gray},
    keywordstyle=\color{blue},
    commentstyle=\color{green!60!black},
    stringstyle=\color{red},
    showstringspaces=false,
    captionpos=b,
    inputencoding=utf8,
    extendedchars=true,
    literate={·}{{\textperiodcentered}}1 {−}{{\textminus}}1 {—}{{---}}1 {–}{{--}}1
}

% Use biblatex with authoryear style for in-text citations like (Author, Year)
\usepackage[backend=bibtex,style=authoryear,natbib=true,maxcitenames=2]{biblatex}
\addbibresource{bib/references.bib}

% Page headers (SciTech format)
\usepackage{fancyhdr}
\setlength{\headheight}{14.5pt}
\addtolength{\topmargin}{-2.5pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{PHANTOM}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
