/* =========================================================================
   M50 Search — full-screen search popup.
   Mirrors the M50 Header Menu's palette and overlay treatment
   (#F4F4F4 surface, saturated backdrop blur, Larsseit type).
   ========================================================================= */

.m50-search-overlay {
	--m50-search-bg: rgba(244, 244, 244, .92);
	--m50-search-surface: #F4F4F4;
	--m50-search-text: #111111;
	--m50-search-muted: #555555;
	--m50-search-line: rgba(0, 0, 0, .12);
	--m50-search-accent: #111111;
	--m50-search-max: 1200px;
	--m50-search-font: "Larsseit", "Helvetica Neue", Arial, sans-serif;

	position: fixed;
	inset: 0;
	z-index: 1200; /* above the header (1000) and its own overlay (1100) */
	background: var(--m50-search-bg);
	backdrop-filter: saturate(180%) blur(14px);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	font-family: var(--m50-search-font);
	color: var(--m50-search-text);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.m50-search-overlay[hidden] {
	display: none;
}

/* Lock background scroll while the popup is open. */
html.m50-search-locked,
html.m50-search-locked body {
	overflow: hidden;
}

.m50-search-overlay a {
	color: inherit;
	text-decoration: none;
}

.m50-search-overlay__inner {
	width: min(var(--m50-search-max), 92vw);
	margin: 0 auto;
	/* Top padding clears the fixed close button in the corner. */
	padding: clamp(72px, 9vh, 96px) 0 60px;
}

/* ---- Close (top-right corner) ------------------------------------------ */

.m50-search-overlay__close {
	position: fixed;
	top: 18px;
	right: 24px;
	z-index: 10;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	cursor: pointer;
	color: var(--m50-search-text);
	transition: opacity .2s ease;
}

.m50-search-overlay__close:hover,
.m50-search-overlay__close:focus-visible {
	opacity: .55;
	outline: none;
}

.m50-search-overlay__close .m50-icon-close {
	width: 40px;
	height: 40px;
	display: block;
}

/* ---- Search bar -------------------------------------------------------- */

.m50-search-bar {
	display: flex;
	align-items: center;
	gap: 14px;
	
	padding-bottom: 10px;
}

.m50-search-bar__icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: var(--m50-search-text);
}

.m50-search-bar__icon .m50-icon {
	width: 26px;
	height: 26px;
}

.m50-search-bar__field {
	flex: 1 1 auto;
	min-width: 0;
	background: transparent;
	border: 0;
	outline: none;
	font-family: inherit;
	font-size: clamp(22px, 4vw, 34px);
	font-weight: 300;
	line-height: 1.1;
	padding: 6px 0;
	color: var(--m50-search-text);
}

.m50-search-bar__field::placeholder {
	color: var(--m50-search-muted);
	opacity: .7;
}

/* Loading spinner (shown via data-wp-bind--hidden). */
.m50-search-bar__spinner {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border: 2px solid var(--m50-search-line);
	border-top-color: var(--m50-search-text);
	border-radius: 50%;
	animation: m50-search-spin .7s linear infinite;
}

.m50-search-bar__spinner[hidden] {
	display: none;
}

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

/* ---- Suggestions dropdown ---------------------------------------------- */

.m50-search-bar-wrap {
	position: relative;
}

.m50-search-suggest {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 5;
	margin: 0;
	padding: 6px;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px;
	background: #fff;
	border: 1px solid var(--m50-search-line);
	border-radius: 4px;
	box-shadow: 0 14px 34px rgba(0, 0, 0, .14);
	max-height: 340px;
	overflow-y: auto;
}

.m50-search-suggest[hidden] {
	display: none;
}

.m50-search-suggest__item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: none;
	border: 0;
	border-radius: 3px;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.2;
	color: var(--m50-search-text);
	transition: background-color .15s ease;
}

.m50-search-suggest__item:hover,
.m50-search-suggest__item:focus-visible {
	background: rgba(0, 0, 0, .05);
	outline: none;
}

.m50-search-suggest__icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: var(--m50-search-muted);
}

.m50-search-suggest__icon .m50-icon {
	width: 16px;
	height: 16px;
}

.m50-search-suggest__label {
	min-width: 0;
	color: var(--m50-search-muted);
}

.m50-search-suggest__label strong {
	font-weight: 600;
	color: var(--m50-search-text);
}

/* ---- Hint + status ----------------------------------------------------- */

.m50-search-hint,
.m50-search-status {
	margin: 16px 0 0;
	font-size: 14px;
	color: var(--m50-search-muted);
	letter-spacing: .02em;
}

.m50-search-hint[hidden],
.m50-search-status[hidden],
.m50-search-panes[hidden] {
	display: none;
}

.m50-search-status {
	text-transform: uppercase;
	letter-spacing: .06em;
	font-size: 12px;
}

/* ---- Results (simple, full-width vertical listing) --------------------- */

.m50-search-panes {
	display: block;
	margin-top: 22px;
}

.m50-search-panes__list {
	min-width: 0;
}

/* ---- Section headings -------------------------------------------------- */

.m50-search-section__title {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--m50-search-muted);
	margin: 0 0 12px;
}

.m50-search-products {
	margin-top: 26px;
}

/* ---- Term links (categories / tags / brands) --------------------------- */

.m50-search-terms__list {
	list-style: none;
	margin: 0 0 4px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.m50-search-term {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	padding: 8px 14px;
	border: 1px solid var(--m50-search-line);
	border-radius: 999px;
	background: rgba(255, 255, 255, .5);
	transition: border-color .2s ease, background-color .2s ease;
}

.m50-search-term:hover {
	border-color: var(--m50-search-text);
	background: #fff;
}

.m50-search-term__label {
	font-size: 15px;
	font-weight: 500;
}

.m50-search-term__meta {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	font-size: 11px;
	color: var(--m50-search-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
}

.m50-search-term__count {
	opacity: .7;
}

/* ---- Product rows ------------------------------------------------------ */

.m50-search-products__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.m50-search-result {
	display: flex;
	align-items: center;
	gap: 8px;
	border-bottom: 1px solid var(--m50-search-line);
	transition: background-color .2s ease;
}

.m50-search-result:hover {
	background: rgba(255, 255, 255, .6);
}

/* The clickable part (everything except the add-to-cart button). */
.m50-search-result__link {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 12px;
	color: inherit;
}

.m50-search-result__media {
	flex: 0 0 auto;
	width: 60px;
	height: 76px;
	overflow: hidden;
	background: #fff;
	border-radius: 2px;
}

.m50-search-result__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ---- Sale badge (right side) — matches the M50 Product Card badge ------- */

.m50-search-result__badge {
	flex: 0 0 auto;
	display: inline-block;
	padding: 7px 10px;
	border-radius: 30px;
	background: var(--m50pc-ink, #1A1C18);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.01em;
	white-space: nowrap;
}

.m50-search-result__body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.m50-search-result__title {
	font-size: 16px;
	font-weight: 400;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Short description — clamped to two lines. */
.m50-search-result__desc {
	font-size: 13px;
	line-height: 1.4;
	color: var(--m50-search-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Available variations summary. */
.m50-search-result__variations {
	font-size: 12px;
	line-height: 1.35;
	color: var(--m50-search-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.m50-search-result__price {
	font-size: 14px;
	color: var(--m50-search-muted);
}

/* ---- Add-to-cart (right end, simple products) -------------------------- */

.m50-search-result__actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 12px;
}

.m50-search-result__actions .button,
.m50-search-result__cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	background: var(--m50-search-accent);
	color: #fff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	padding: 10px 16px;
	border: 0;
	border-radius: 2px;
	cursor: pointer;
	transition: opacity .2s ease;
}

.m50-search-result__actions .button:hover,
.m50-search-result__cart:hover {
	opacity: .85;
	color: #fff;
}

.m50-search-result__cart.loading {
	opacity: .7;
}

.m50-search-result__actions .added_to_cart {
	font-size: 12px;
	text-decoration: underline;
	color: var(--m50-search-text);
}

.m50-search-result__price del {
	opacity: .55;
	margin-right: 6px;
}

.m50-search-result__price ins {
	text-decoration: none;
	font-weight: 600;
	color: var(--m50-search-text);
}

/* ---- Highlight --------------------------------------------------------- */

.m50-search__mark {
	background: #ffe8a3;
	color: inherit;
	padding: 0 .1em;
	border-radius: 2px;
}

/* ---- Empty state ------------------------------------------------------- */

.m50-search-empty {
	font-size: 16px;
	color: var(--m50-search-muted);
	padding: 20px 0;
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 600px) {
	.m50-search-overlay__inner {
		padding-top: 64px;
	}

	.m50-search-overlay__close {
		top: 12px;
		right: 14px;
		width: 44px;
		height: 44px;
	}

	.m50-search-overlay__close .m50-icon-close {
		width: 34px;
		height: 34px;
	}

	.m50-search-bar__field {
		font-size: 20px;
	}

	.m50-search-result__media {
		width: 52px;
		height: 66px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.m50-search-bar__spinner {
		animation-duration: 1.6s;
	}
}
