* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	line-height: 1.6;
	color: #333;
	background: #f5f5f5;
	margin: 0;
	padding: 0;
}

/* Header */
.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 70px;
	background: #2c3e50;
	color: white;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	z-index: 1000;
	display: flex;
	align-items: center;
	padding: 0 20px;
}

.site-header h1 {
	font-size: 1.5rem;
	margin: 0;
	margin-right: 30px;
	white-space: nowrap;
}

.site-header h1 a {
	color: white;
	text-decoration: none;
	transition: opacity 0.2s;
}

.site-header h1 a:hover {
	opacity: 0.8;
}

.header-search {
	position: absolute;
	top: 50%;
	right: 20px;
	transform: translateY(-50%);
	width: 40px;
	transition: width 0.3s ease;
	z-index: 10;
}

.container {
	display: flex;
	min-height: calc(100vh - 70px);
	margin-top: 70px;
}

/* Navigation */
.sidebar {
	width: 280px;
	background: #2c3e50;
	color: white;
	padding: 20px;
	position: fixed;
	top: 70px;
	left: 0;
	bottom: 0;
	overflow-y: auto;
}

/* Suche im Header */
.search-input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #34495e;
	border-radius: 20px;
	background: #34495e;
	color: white;
	font-size: 0.9rem;
	transition: all 0.3s ease;
	opacity: 0.8;
}

.header-search:hover .search-input,
.header-search:focus-within .search-input {
	opacity: 1;
	background: #1a252f;
	border-color: #3498db;
}

.header-search:hover,
.header-search:focus-within {
	width: 300px;
}

.search-input::placeholder {
	color: #95a5a6;
}

.search-input:focus {
	outline: none;
	border-color: #3498db;
	background: #1a252f;
}

.search-results {
	position: absolute;
	top: 45px;
	left: 0;
	right: 0;
	max-height: 400px;
	overflow-y: auto;
	background: white;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	display: none;
	z-index: 1001;
	color: #2c3e50;
}

.search-results.show {
	display: block;
}

.search-result-item {
	padding: 12px 15px;
	border-bottom: 1px solid #ecf0f1;
	cursor: pointer;
	transition: background 0.2s;
}

.search-result-item:hover {
	background: #f8f9fa;
}

.search-result-item:last-child {
	border-bottom: none;
}

.search-result-item a {
	color: #2c3e50;
	text-decoration: none;
	display: block;
}

.search-result-title {
	font-size: 0.95rem;
	font-weight: 600;
	margin-bottom: 5px;
	color: #2c3e50;
}

.search-result-context {
	font-size: 0.85rem;
	color: #7f8c8d;
	line-height: 1.4;
}

.search-result-matches {
	font-size: 0.75rem;
	color: #3498db;
	margin-top: 5px;
	font-weight: 600;
}

.search-no-results {
	padding: 20px;
	color: #7f8c8d;
	font-size: 0.9rem;
	text-align: center;
}

.search-result-chapter {
	margin-bottom: 30px;
	padding-bottom: 20px;
	border-bottom: 1px solid #ecf0f1;
}

.search-result-chapter h3 {
	margin: 0 0 10px 0;
	font-size: 1.3rem;
}

.search-result-chapter h3 a {
	color: #2c3e50;
	text-decoration: none;
	transition: color 0.2s;
}

.search-result-chapter h3 a:hover {
	color: #3498db;
}

.search-result-count {
	color: #7f8c8d;
	font-size: 0.85rem;
	margin-bottom: 15px;
}

.search-snippets {
	margin-top: 10px;
}

.search-snippet {
	background: #f8f9fa;
	padding: 12px 15px;
	margin: 8px 0;
	border-left: 3px solid #3498db;
	border-radius: 4px;
	line-height: 1.6;
	font-size: 0.95rem;
}

.snippet-before,
.snippet-after {
	color: #555;
}

.snippet-match {
	background: #ffeb3b;
	padding: 2px 4px;
	border-radius: 2px;
	color: #000;
	font-weight: 700;
}

.search-history {
	position: absolute;
	top: 45px;
	left: 0;
	right: 0;
	background: white;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	display: none;
	z-index: 1001;
}

.search-history.show {
	display: block;
}

.search-history-title {
	padding: 10px 15px;
	font-size: 0.75rem;
	color: #7f8c8d;
	text-transform: uppercase;
	font-weight: 600;
	border-bottom: 1px solid #ecf0f1;
	background: white;
}

.search-history-item {
	padding: 10px 15px;
	cursor: pointer;
	border-bottom: 1px solid #ecf0f1;
	transition: background 0.2s;
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: white;
}

.search-history-item:hover,
.search-history-item.active {
	background: #f8f9fa;
}

.search-history-item.active {
	background: #e3f2fd;
	border-left: 3px solid #3498db;
}

.search-history-item:last-child {
	border-bottom: none;
}

.search-history-text {
	color: #2c3e50;
	font-size: 0.9rem;
	flex: 1;
}

.search-history-clear {
	color: #95a5a6;
	font-size: 0.7rem;
	padding: 2px 6px;
	border-radius: 3px;
	transition: all 0.2s;
}

.search-history-item:hover .search-history-clear {
	color: #e74c3c;
	background: #fef5f5;
}

.sidebar nav ul {
	list-style: none;
}

.sidebar nav > ul > li {
	margin: 8px 0;
}

.sidebar nav li {
	margin: 4px 0;
}

.sidebar nav a {
	color: #ecf0f1;
	text-decoration: none;
	display: block;
	padding: 8px 12px;
	border-radius: 4px;
	transition: background 0.2s;
}

.sidebar nav a:hover {
	background: #34495e;
}

.nav-category {
	margin: 4px 0;
}

.nav-category-header {
	display: flex;
	align-items: center;
	cursor: pointer;
	padding: 8px 12px;
	border-radius: 4px;
	transition: background 0.2s;
	font-weight: 600;
	color: #ecf0f1;
}

.nav-category-header:hover {
	background: #34495e;
}

.nav-category-toggle {
	margin-right: 8px;
	font-size: 0.8rem;
	transition: transform 0.2s;
}

.nav-category.collapsed .nav-category-toggle {
	transform: rotate(-90deg);
}

.nav-category-children {
	margin-left: 12px;
	overflow: hidden;
	transition: max-height 0.3s ease-out;
	max-height: 2000px;
}

.nav-category.collapsed .nav-category-children {
	max-height: 0;
}

.sidebar nav .level-1 { padding-left: 12px; font-weight: 600; }
.sidebar nav .level-2 { padding-left: 24px; font-size: 0.95rem; }
.sidebar nav .level-3 { padding-left: 36px; font-size: 0.9rem; }
.sidebar nav .level-4 { padding-left: 48px; font-size: 0.85rem; }

.main-content {
	flex: 1;
	margin-left: 280px;
	padding: 40px;
	background: white;
	max-width: 1000px;
}

.content-header {
	margin-bottom: 30px;
	padding-bottom: 20px;
	border-bottom: 3px solid #3498db;
}

.content-header h1 {
	font-size: 2.5rem;
	color: #2c3e50;
	margin-bottom: 10px;
}

.content-header .meta {
	color: #7f8c8d;
	font-size: 0.9rem;
}

.chapter {
	margin-bottom: 40px;
}

.chapter h2 {
	font-size: 2rem;
	color: #2c3e50;
	margin-bottom: 20px;
	padding-bottom: 10px;
	border-bottom: 2px solid #ecf0f1;
}

.chapter h3 {
	font-size: 1.5rem;
	color: #34495e;
	margin: 25px 0 15px 0;
}

.chapter h4 {
	font-size: 1.2rem;
	color: #34495e;
	margin: 20px 0 10px 0;
}

.paragraph {
	margin-bottom: 15px;
	text-align: justify;
}

.paragraph.center {
	text-align: center;
}

.paragraph.right {
	text-align: right;
}

/* Listen im Content-Bereich */
.chapter ol,
.chapter ul {
	margin: 15px 0;
	padding-left: 40px;
}

.chapter ol {
	list-style-type: decimal;
}

.chapter ul {
	list-style-type: disc;
}

.chapter li {
	margin-bottom: 10px;
	line-height: 1.6;
	text-align: left; /* Überschreibt justify von .paragraph */
}

.chapter li p {
	margin-top: 10px;
	margin-bottom: 5px;
	margin-left: 0; /* Keine Einrückung */
	margin-right: 0;
	padding: 0; /* Kein zusätzliches Padding */
	text-align: left; /* Kein justify in Listen */
	text-indent: 0; /* Kein Einzug der ersten Zeile */
}

.chapter li p:first-of-type {
	margin-top: 10px; /* Abstand zum ersten Absatz */
}

.chapter li p:last-child {
	margin-bottom: 0; /* Kein Margin beim letzten Absatz */
}

.chapter li:last-child {
	margin-bottom: 0;
}

/* Verschachtelte Listen */
.chapter ol ol {
	list-style-type: lower-alpha;
	margin-top: 10px;
}

.chapter ul ul {
	list-style-type: circle;
	margin-top: 10px;
}

.bold { font-weight: bold; }
.italic { font-style: italic; }
.underline { text-decoration: underline; }
.strike { text-decoration: line-through; }

.search-highlight {
	background-color: #ffeb3b;
	padding: 2px 4px;
	border-radius: 2px;
	font-weight: 600;
	color: #000;
}

.subchapters-hint {
	background: #f8f9fa;
	border-left: 4px solid #3498db;
	padding: 20px;
	margin: 20px 0;
	border-radius: 4px;
}

.subchapters-hint h3 {
	margin: 0 0 15px 0;
	color: #2c3e50;
	font-size: 1.2rem;
}

.subchapters-hint ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.subchapters-hint li {
	margin: 8px 0;
}

.subchapters-hint a {
	color: #2c3e50;
	text-decoration: none;
	display: block;
	padding: 8px 12px;
	background: white;
	border-radius: 4px;
	transition: all 0.2s;
}

.subchapters-hint a:hover {
	background: #3498db;
	color: white;
	transform: translateX(5px);
}

.footnote-ref {
	color: #3498db;
	text-decoration: none;
	font-size: 0.85em;
	vertical-align: super;
	padding: 0 2px;
	cursor: pointer;
}

.footnote-ref:hover {
	text-decoration: underline;
	background: #e3f2fd;
	border-radius: 3px;
}

/* Inline Bilder aus Markdown */
.inline-image {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 20px 0;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.paragraph .inline-image {
	margin: 16px auto;
}

@media (max-width: 768px) {
	.inline-image {
		margin: 12px 0;
	}
}

/* Blockquotes aus Markdown - Dezentes wissenschaftliches Design */
.markdown-quote {
	margin: 24px 0;
	padding: 16px 20px;
	border-left: 3px solid #666;
	background: #fafafa;
	font-style: italic;
	color: #333;
	line-height: 1.6;
}

.markdown-quote p {
	margin: 8px 0;
	font-size: 0.95rem;
}

.markdown-quote p:first-child {
	margin-top: 0;
}

.markdown-quote p:last-child {
	margin-bottom: 0;
}

@media (max-width: 768px) {
	.markdown-quote {
		margin: 16px 0;
		padding: 12px 16px;
	}
}

.footnote-popup {
	position: fixed;
	background: white;
	border: 2px solid #3498db;
	border-radius: 8px;
	padding: 15px 20px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	max-width: 400px;
	z-index: 1000;
	display: none;
	animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.footnote-popup.show {
	display: block;
}

.footnote-popup-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid #ecf0f1;
}

.footnote-popup-title {
	font-weight: bold;
	color: #3498db;
	font-size: 0.9rem;
}

.footnote-popup-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	color: #7f8c8d;
	cursor: pointer;
	padding: 0;
	width: 24px;
	height: 24px;
	line-height: 20px;
	text-align: center;
	border-radius: 50%;
	transition: all 0.2s;
}

.footnote-popup-close:hover {
	background: #ecf0f1;
	color: #2c3e50;
}

.footnote-popup-content {
	font-size: 0.9rem;
	line-height: 1.6;
	color: #2c3e50;
}

.footnote-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.1);
	z-index: 999;
	display: none;
}

.footnote-popup-overlay.show {
	display: block;
}

.footnotes {
	margin-top: 50px;
	padding-top: 20px;
	border-top: 2px solid #ecf0f1;
}

.footnotes h3 {
	font-size: 1.3rem;
	margin-bottom: 15px;
	color: #2c3e50;
}

.footnote {
	margin-bottom: 12px;
	font-size: 0.9rem;
	padding-left: 45px;
	position: relative;
}

.footnote-number {
	position: absolute;
	left: 0;
	color: #3498db;
	font-weight: bold;
	min-width: 35px;
}

.chapter-navigation {
	margin-top: 40px;
	padding: 20px;
	background: #ecf0f1;
	border-radius: 8px;
	display: flex;
	justify-content: space-between;
}

.chapter-navigation a {
	color: #2c3e50;
	text-decoration: none;
	padding: 10px 20px;
	background: white;
	border-radius: 4px;
	transition: background 0.2s;
}

.chapter-navigation a:hover {
	background: #3498db;
	color: white;
}

.toc {
	margin-top: 30px;
}

.toc-item {
	margin: 15px 0;
	padding: 15px;
	background: #f8f9fa;
	border-left: 4px solid #3498db;
	border-radius: 4px;
}

.toc-item h3 {
	margin: 0 0 8px 0;
}

.toc-item a {
	color: #2c3e50;
	text-decoration: none;
	font-weight: 600;
	font-size: 1.1rem;
}

.toc-item a:hover {
	color: #3498db;
}

.toc-item .chapter-info {
	color: #7f8c8d;
	font-size: 0.9rem;
	margin-top: 5px;
}

.mobile-only-nav {
	display: none;
}

.toc-category {
	margin: 15px 0;
	background: #f8f9fa;
	border-left: 4px solid #3498db;
	border-radius: 4px;
	overflow: hidden;
}

.toc-category-header {
	padding: 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	transition: background 0.2s;
	user-select: none;
}

.toc-category-header:hover {
	background: #e9ecef;
}

.toc-category-title {
	font-size: 1.2rem;
	font-weight: 600;
	color: #2c3e50;
	margin: 0;
	flex: 1;
}

.toc-category-toggle {
	font-size: 1.2rem;
	color: #3498db;
	transition: transform 0.3s;
}

.toc-category.collapsed .toc-category-toggle {
	transform: rotate(-90deg);
}

.toc-category-content {
	max-height: 2000px;
	overflow: hidden;
	transition: max-height 0.3s ease-out, padding 0.3s ease-out;
	padding: 0 15px 15px 15px;
}

.toc-category.collapsed .toc-category-content {
	max-height: 0;
	padding: 0 15px;
}

.toc-subitem {
	padding: 8px 12px;
	margin: 5px 0;
	background: white;
	border-radius: 4px;
	transition: background 0.2s;
}

.toc-subitem:hover {
	background: #e3f2fd;
}

.toc-subitem a {
	color: #2c3e50;
	text-decoration: none;
	display: block;
	font-size: 0.95rem;
}

.toc-subitem-info {
	color: #95a5a6;
	font-size: 0.8rem;
	margin-top: 3px;
}

.mobile-menu-toggle {
	display: none;
	background: none;
	border: none;
	color: white;
	font-size: 1.5rem;
	cursor: pointer;
	padding: 5px 10px;
	margin-right: 15px;
}

.mobile-menu-overlay {
	display: none;
	position: fixed;
	top: 70px;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 998;
}

.mobile-menu-overlay.show {
	display: block;
}

@media (max-width: 768px) {
	.site-header {
		top: 0;
		padding: 0 15px;
	}

	.container {
		margin-top: 70px;
		min-height: calc(100vh - 70px);
	}

	.mobile-only-nav {
		display: block;
		border-bottom: 1px solid #34495e;
	}
	
	.site-header h1 {
		font-size: 1.2rem;
		margin-right: 15px;
	}
	
	.header-search {
		position: fixed;
		top: 10px;
		right: 60px;
		width: 50px;
		transform: none;
	}
	
	.header-search:hover,
	.header-search:focus-within {
		width: 200px;
	}
	
	.mobile-menu-toggle {
		display: block;
	}
	
	.sidebar {
		position: fixed;
		left: -280px;
		top: 70px;
		width: 280px;
		transition: left 0.3s ease;
		z-index: 999;
		box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
	}
	
	.sidebar.show {
		left: 0;
	}
	
	.main-content {
		margin-left: 0;
		padding: 20px 15px;
		width: 100%;
	}
	
	.container {
		flex-direction: column;
	}
	
	.search-results {
		left: 0;
		right: 0;
		max-height: 300px;
	}
	
	.search-snippet {
		font-size: 0.85rem;
		padding: 10px;
	}
}


/* ========================================
   IMAGE LIGHTBOX
   ======================================== */
.lightbox-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.9);
	z-index: 10000;
	justify-content: center;
	align-items: center;
	cursor: zoom-out;
}

.lightbox-overlay.show {
	display: flex;
}

.lightbox-image {
	max-width: 90%;
	max-height: 90vh;
	object-fit: contain;
	box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
	cursor: default;
}

.lightbox-close {
	position: absolute;
	top: 20px;
	right: 30px;
	font-size: 40px;
	color: white;
	cursor: pointer;
	user-select: none;
	transition: color 0.2s;
}

.lightbox-close:hover {
	color: #ff6b6b;
}

/* Inline-Bilder */
.inline-image {
	max-width: 250px;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition: transform 0.2s;
}

.image-link:hover .inline-image {
	transform: scale(1.05);
}

/* ========================================
   TOP-BAR (nur Desktop)
   ======================================== */
.top-bar {
	display: block;
	background: #ecf0f1;
	padding: 10px 20px;
	border-bottom: 1px solid #bdc3c7;
}

.top-bar-link {
	color: #2c3e50;
	text-decoration: none;
	font-weight: 500;
}

.top-bar-link:hover {
	color: #3498db;
}

/* Mobile: Top-Bar ausblenden */
@media (max-width: 768px) {
	.top-bar {
		display: none;
	}
}
