/* Search trigger button (in sidebar) */
button.search-trigger {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	display: inline-flex;
	align-items: center;
	color: inherit;
}

/* Modal overlay */
#search-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 8vh;
}

#search-modal[hidden] {
	display: none;
}

.search-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(3px);
}

.search-dialog {
	position: relative;
	z-index: 1;
	background: var(--color-content-bg);
	border: 1px solid var(--color-dialog-border);
	border-radius: 10px;
	box-shadow: 0 12px 40px var(--color-shadow);
	width: min(680px, 90vw);
	max-height: 72vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Search input row */
.search-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--color-border);
	color: var(--color-text);
}

#search-input {
	flex: 1;
	border: none;
	outline: none;
	background: transparent;
	color: var(--color-text);
	font-size: 1rem;
	font-family: inherit;
	min-width: 0;
}

#search-input::placeholder {
	color: var(--color-nav-link);
}

.search-close {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--color-text);
	padding: 2px;
	display: flex;
	align-items: center;
	opacity: 0.55;
	flex-shrink: 0;
}

.search-close:hover {
	opacity: 1;
}

/* Results list */
.search-results {
	overflow-y: auto;
	flex: 1;
}

.search-result-item {
	display: block;
	padding: 12px 16px;
	text-decoration: none;
	color: var(--color-text);
	border-bottom: 1px solid var(--color-border);
}

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

.search-result-item:hover {
	background: var(--color-dialog-header-bg);
}

.search-result-title {
	margin: 0 0 5px;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--color-text);
	line-height: 1.3;
	text-decoration: underline;
	text-decoration-color: var(--color-anchor);
	text-decoration-thickness: .25ex;
	text-underline-offset: 0.1em;
}

.search-result-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 6px;
}

.search-tag {
	font-size: 0.72rem;
	font-weight: bold;
	text-decoration: underline;
	text-decoration-color: var(--color-anchor);
	text-decoration-thickness: .10ex;
	text-underline-offset: 0.1em;
}

.search-snippet {
	margin-top: 6px;
}

.search-snippet-section {
	display: block;
	font-size: 0.72rem;
	font-weight: bold;
	opacity: 0.6;
	margin-bottom: 1px;
}

.search-result-excerpt {
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.5;
	opacity: 0.75;
}

.search-result-excerpt mark {
	background: #ffe033;
	color: #1a1a1a;
	border-radius: 2px;
	padding: 0 2px;
}

html.dark .search-result-excerpt mark {
	background: #b8860b;
	color: #ffffff;
}

.search-no-results {
	padding: 24px 16px;
	text-align: center;
	opacity: 0.55;
	font-size: 0.9rem;
}
