/**
 * Live Search Styles - Hillegom Online
 * Search functionality integrated in navigation bar
 *
 * @package Hillegom_Online
 */

/* ============================================
   SEARCH TOGGLE BUTTON
   ============================================ */

.search-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	background: var(--link-color);
	color: #ffffff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all var(--transition);
	margin-left: 16px;
	flex-shrink: 0;
	z-index: 10;
	position: relative;
}

.search-toggle svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
	flex-shrink: 0;
}

.search-toggle-text {
	display: none;
}

.search-toggle:hover {
	background: var(--link-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(28, 127, 195, 0.3);
}

.search-toggle:focus {
	outline: 2px solid var(--link-color);
	outline-offset: 2px;
}

.search-toggle[aria-expanded="true"] {
	background: var(--link-hover);
}

.nav-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 50px;
	position: relative;
}

/* ============================================
   SEARCH FORM CONTAINER - INLINE VERSION
   ============================================ */

.nav-search-form {
	position: absolute;
	right: 80px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	padding: 0;
	opacity: 0;
	visibility: hidden;
	width: 0;
	transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
	z-index: 15;
	overflow: visible;
}

.nav-search-form[aria-hidden="false"] {
	opacity: 1;
	visibility: visible;
	width: 400px;
	padding-right: 80px; /* Ruimte voor de zoekknop */
}

.nav-search-form .search-form {
	width: 100%;
	position: relative;
}

/* ============================================
   SEARCH INPUT WRAPPER
   ============================================ */

.search-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
	background: #ffffff;
	border: 2px solid var(--link-color);
	border-radius: 8px;
	padding: 4px 4px 4px 14px;
	transition: all var(--transition);
	box-shadow: 0 4px 12px rgba(28, 127, 195, 0.2);
}

.search-input-wrapper:focus-within {
	background: #ffffff;
	border-color: var(--link-color);
	box-shadow: 0 0 0 3px rgba(28, 127, 195, 0.1);
}

.search-field {
	flex: 1;
	border: none;
	background: transparent;
	padding: 10px 8px;
	font-size: 15px;
	color: var(--text-primary);
	outline: none;
	min-width: 0;
}

.search-field::placeholder {
	color: var(--text-secondary);
	opacity: 0.7;
}

.search-submit,
.search-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	min-width: 36px;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	transition: all var(--transition);
	flex-shrink: 0;
}

.search-submit {
	background: var(--link-color);
	color: #ffffff;
}

.search-submit:hover {
	background: var(--link-hover);
	transform: scale(1.05);
}

.search-close {
	background: #e0e0e0;
	color: var(--text-primary);
}

.search-close:hover {
	background: #d0d0d0;
	transform: rotate(90deg);
}

.search-submit svg,
.search-close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.search-submit:focus,
.search-close:focus {
	outline: 2px solid var(--link-color);
	outline-offset: 2px;
}

/* ============================================
   LIVE SEARCH RESULTS
   ============================================ */

.live-search-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #ffffff;
	border: 2px solid var(--link-color);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	max-height: 500px;
	overflow-y: auto;
	display: none;
	z-index: 9999;
	padding: 12px;
}

.live-search-results.has-results {
	display: block;
}

.live-search-results.is-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	color: var(--text-secondary);
}

.search-results-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 2px solid #e0e0e0;
}

.search-results-count {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
}

.search-results-view-all {
	font-size: 14px;
	color: var(--link-color);
	text-decoration: none;
	font-weight: 500;
	transition: color var(--transition);
}

.search-results-view-all:hover {
	color: var(--link-hover);
	text-decoration: underline;
}

.search-results-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.search-result-item {
	display: flex;
	gap: 12px;
	padding: 12px;
	background: #f8f9fa;
	border-radius: 8px;
	transition: all var(--transition);
	text-decoration: none;
	color: inherit;
}

.search-result-item:hover {
	background: #e9ecef;
	transform: translateX(4px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-result-thumbnail {
	width: 80px;
	height: 60px;
	min-width: 80px;
	border-radius: 6px;
	overflow: hidden;
	background: #e0e0e0;
}

.search-result-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.search-result-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.search-result-title {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.search-result-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var(--text-secondary);
}

.search-result-type {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	background: var(--link-color);
	color: #ffffff;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
}

.search-result-date {
	opacity: 0.8;
}

.search-result-excerpt {
	font-size: 13px;
	color: var(--text-secondary);
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-height: 1.4;
}

/* Type-specific colors */
.search-result-type.type-post {
	background: #1C7FC3;
}

.search-result-type.type-event {
	background: #28a745;
}

.search-result-type.type-gallery {
	background: #ffc107;
	color: #000;
}

/* No results state */
.search-no-results {
	text-align: center;
	padding: 40px 20px;
	color: var(--text-secondary);
}

.search-no-results-icon {
	font-size: 48px;
	margin-bottom: 16px;
	opacity: 0.3;
}

.search-no-results-text {
	font-size: 16px;
	margin: 0 0 8px;
}

.search-no-results-hint {
	font-size: 14px;
	opacity: 0.8;
	margin: 0;
}

/* Loading spinner */
.search-loading-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #e0e0e0;
	border-top-color: var(--link-color);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (min-width: 768px) {
	.search-toggle-text {
		display: inline;
	}

	.search-toggle {
		padding: 12px 20px;
		font-size: 15px;
	}

	.search-toggle svg {
		width: 18px;
		height: 18px;
	}

	.nav-search-form[aria-hidden="false"] {
		width: 450px;
		padding-right: 100px;
	}

	.search-result-thumbnail {
		width: 100px;
		height: 75px;
		min-width: 100px;
	}

	.search-result-title {
		font-size: 16px;
	}

	.search-result-excerpt {
		font-size: 14px;
	}
}

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */

@media (min-width: 992px) {
	.search-toggle {
		margin-left: 20px;
	}

	.nav-search-form[aria-hidden="false"] {
		width: 500px;
		padding-right: 120px;
	}

	.search-results-list {
		display: flex;
		flex-direction: column;
		gap: 8px;
	}

	.search-result-item {
		flex-direction: row;
	}

	.search-result-thumbnail {
		width: 80px;
		height: 60px;
		min-width: 80px;
	}
}

/* Mobile: gebruik full-width overlay */
@media (max-width: 767px) {
	.nav-search-form {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.8);
		padding: 20px;
		transform: none;
		display: flex;
		align-items: flex-start;
		padding-top: 80px;
		z-index: 10000;
	}
	
	.nav-search-form[aria-hidden="false"] {
		width: 100%;
		padding: 20px;
		padding-top: 80px;
	}
	
	.nav-search-form .search-form {
		max-width: 600px;
		margin: 0 auto;
	}
	
	.search-input-wrapper {
		background: #ffffff;
	}
	
	.live-search-results {
		position: relative;
		margin-top: 16px;
		top: 0;
	}
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
	.nav-search-form,
	.search-result-item,
	.search-close {
		transition: none;
	}

	.search-loading-spinner {
		animation: none;
		border-top-color: var(--link-color);
		opacity: 0.5;
	}
}

/* Focus visible */
.search-result-item:focus-visible {
	outline: 3px solid var(--link-color);
	outline-offset: 2px;
}

/* Screen reader only */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}
