/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
	background-color: #333;
	color: #f2f2f2;
    border-bottom: 1px solid #a2a9b1;
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-weight: bold;
    font-size: 1.2em;
}

.search-box {
    padding: 5px;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
}

/* 'Hamburger' button */
.menu-toggle {
    font-size: 1.2em;
    margin-right: 10px;
    background: none;
    border: none;
    cursor: pointer;
	color: #f2f2f2;
}

/* Layout adjustments */
body {
    display: flex;
    flex-direction: column;
}

.container {
    margin-left: 220px;
}

/* Sidebar (desktop) */
.sidebar {
    position: fixed;
    top: 50px;
    left: 0;
    width: 200px;
    height: 100%;
    background: #f8f9fa;
    border-right: 1px solid #a2a9b1;
    padding: 10px;
    overflow-y: auto;
}
/* Right-side tools panel */
.sidebar-right {
    position: fixed;
    top: 50px;
    right: 0px;
    width: 200px;
	height: 100%;
    background: #f8f9fa;
    border-left: 1px solid #a2a9b1;
    padding: 10px;
    overflow-y: auto;
}
.sidebar-right-list {
	list-style: none;
	padding: 0;
	margin-top: -0.6em;
	text-indent: -1.5em;
}

/* Mobile Styles */
@media screen and (max-width: 768px) {

    .container {
        margin-left: 0;
        padding: 15px;
    }

    .sidebar {
        position: fixed;
        left: -220px;
        top: 50px;
        transition: left 0.3s ease;
    }
	.sidebar-right {
        position: fixed;
        right: -220px;
        top: 50px;
        transition: right 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .search-box {
        width: 120px;
    }
	
	body.width-wide .container { /* Disable wide mode on small screens */
        max-width: 100%;
        margin: 0 10px;
    }
}

/* Base typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Linux Libertine", Georgia, Times, serif;
    background-color: #f8f9fa;
    color: #202122;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Main content container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #a2a9b1;
}
/* Wide mode */
body.width-wide .container {
    max-width: 1400px;
}

/* .container td {
    padding: 0.2em 0.4em;
} */

/* Headings */
h1, h2, h3, h4, h5 {
    font-family: "Linux Libertine", Georgia, Times, serif;
    font-weight: normal;
    color: #000;
    margin-top: 1em;
}

h1 {
    font-size: 2em;
    border-bottom: 1px solid #a2a9b1;
}

h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #a2a9b1;
}

h3 {
    font-size: 1.2em;
}

h4 {
    border-bottom: 1px solid #a2a9b1;
}

/* Links */
a {
    color: #0645ad;
    text-decoration: none;
}

a:visited {
    color: #0b0080;
}

a:hover {
    text-decoration: underline;
}

a.external::after {
	content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 2px;
    background-image: url('images/external_link.svg');
    background-size: contain;
    background-repeat: no-repeat;
}

/* Infobox-style table */
.infobox {
    float: right;
    width: 400px;
    margin: 0 0 1em 1em;
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    font-size: 88%;
}

.infobox th {
    background: #eaecf0;
    text-align: center;
    padding: 5px;
    font-weight: bold;
}

.infobox td {
    padding: 5px;
    border-top: 1px solid #a2a9b1;
}

/* Infobox image styling */
.infobox-image {
    text-align: center;
    padding: 5px;
}

.infobox-image img {
    max-width: 100%;
    height: auto;
}

/* Caption under infobox image */
.infobox-caption {
    font-size: 0.85em;
    color: #54595d;
    margin-top: 4px;
}

/* Table styling */
table {
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9em;
}

th, td {
    border: 1px solid #a2a9b1;
    padding: 6px 10px;
}

th {
    background-color: #eaecf0;
}

/* Sidebar */
.sidebar {
    width: 200px;
    float: left;
    background: #f8f9fa;
    border-right: 1px solid #a2a9b1;
    padding: 10px;
}

.sidebar a {
    display: block;
    margin: 4px 0;
}

/* Code blocks */
pre, code {
    font-family: "Courier New", monospace;
    background: #f6f6f6;
    border: 1px solid #a2a9b1;
    padding: 5px;
}

/* Blockquotes */
blockquote {
    border-left: 3px solid #a2a9b1;
    margin: 1em;
    padding-left: 10px;
    color: #54595d;
}

/* Footer */
.footer {
    font-size: 0.8em;
    color: #54595d;
    border-top: 1px solid #a2a9b1;
    margin-top: 2em;
    padding-top: 10px;
}

/* Clear floats */
.clearfix::after {
    content: "";
    display: block;
    clear: both;
}

/* Thumbnail / image container */
.thumb {
    width: 250px;
    float: right;
    margin: 0 0 1em 1em;
    border: 1px solid #c8ccd1;
    background-color: #f8f9fa;
    font-size: 0.9em;
}

/* Inner wrapper */
.thumbinner {
    padding: 3px;
}

/* Image itself */
.thumb img {
    width: 100%;
    height: auto;
    display: block;
}

/* Caption */
.thumbcaption {
    padding: 3px;
    color: #202122;
}

/* Left-aligned thumbnail option */
.thumb-left {
    float: left;
    margin: 0 1em 1em 0;
}

/* Centered image (like gallery style) */
.thumb-center {
    float: none;
    margin: 1em auto;
    display: block;
}

/* Title styling */
.infobox-title {
    font-size: 1.4em;
    text-align: center;
    background: #e1e4e8;
}

/* Standard image */
.infobox-image img {
    width: 110px;
    height: auto;
    display: block;
    margin: 0 auto;
}
.infobox-election-image img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Candidate row format */
.infobox-row td {
    vertical-align: middle;
    padding: 6px;
    border-top: 1px solid #a2a9b1;
	font-size: 0.9em;
}

/* Overall spacing */
.election-infobox img {
    border: 1px solid #c8ccd1;
}

/* Alternate shading for rows
.election-infobox .candidate-row:nth-child(even) {
    background: #fafafa;
} */

/* Table of Contents (sidebar) */
.toc {
    margin-top: 20px;
    font-size: 0.9em;
}

.toc h3 {
    margin-top: 10px;
    border-bottom: 1px solid #a2a9b1;
    font-size: 1em;
}

.toc ul {
    list-style: none;
    padding-left: 0;
	margin-left: 0em;
}

.toc li {
    margin: 4px 0;
}

.toc a {
    text-decoration: none;
    color: #0645ad;
}

.toc a:hover {
    text-decoration: underline;
}

/* Search bar */
.search-container {
    position: relative; /* this ensures results box aligns with input */
    width: 250px; /* match your input width */
    max-width: 90vw; /* never go wider than viewport */
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto; /* reset in case it was set */
    width: 100%; /* match input width */
    max-width: 400px; /* optional limit */
    background: white;
	color: #333;
    border: 1px solid #a2a9b1;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;

    /* Make sure it wraps inside viewport */
    box-sizing: border-box;
}

.search-result {
    padding: 6px;
    cursor: pointer;
}

.search-result:hover {
    background: #eaecf0;
}

.reference-tooltip {
    position: relative;
    cursor: pointer;
}

.reference-tooltip span {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #a2a9b1;
    padding: 5px;
    width: 200px;
    z-index: 1000;
}

.reference-tooltip:hover span {
    display: block;
}

/* Dark Mode Base */
body.dark {
    background-color: #202122;
    color: #e4e6eb;
}

body.dark h1, 
body.dark h2, 
body.dark h3,
body.dark h4 {
    color: #e4e6eb;
}

/* Links */
body.dark a {
    color: #8ab4f8;
}

body.dark a:visited {
    color: #c58af9;
}

/* Container */
body.dark .container {
    background: #2a2c2f;
    border-color: #444;
}

/* Sidebar */
body.dark .sidebar {
    background: #2a2c2f;
    border-color: #444;
}
body.dark .sidebar-right {
    background: #2a2c2f;
    border-color: #444;
}

/* Topbar */
body.dark .topbar {
    background: #2a2c2f;
    border-bottom: 1px solid #444;
}

/* Tables */
body.dark table,
body.dark th,
body.dark td {
    border-color: #555;
}

body.dark th {
    background-color: #3a3b3c;
}

/* Infobox */
body.dark .infobox {
    background: #2a2c2f;
    border-color: #555;
}
body.dark .infobox-caption {
    color: #e4e6eb;
}

/* Code blocks */
body.dark pre,
body.dark code {
    background: #1e1e1e;
    border-color: #555;
}

/* Search results */
body.dark .search-results {
    background: #2a2c2f;
    border-color: #555;
	color: #e4e6eb;
}
body.dark .search-result:hover {
    background: #3a3b3c;
}

/* Reference tooltips */
body.dark .reference-tooltip span {
    color: #e4e6eb;
	background: #2a2c2f;
}

/* Text size adjustments */
body.text-small {
    font-size: 0.9em;
}

body.text-normal {
    font-size: 1em;
}

body.text-large {
    font-size: 1.2em;
}

.legend-color {
	display: inline-block;
	min-width: 1.25em;
	height: 1.25em;
	line-height: 1.25;
	margin: 1px 0;
	text-align: center;
	border: 1px solid black;
	background-color: transparent;
	color: black;
}

@media screen {
	ul {
		list-style-type: disc;
		margin-top: 0.3em;
		margin-bottom: 0;
		margin-left: 1.6em;
		margin-right: 0;
		margin-inline-start: 1.6em;
		margin-inline-end: 0;
		padding: 0;
	}
}
