/**
 * Live product search dropdown (inc/product-search.php, assets/js/product-search.js).
 * Font and text colour come from the theme; the accent is the theme's primary colour.
 */
.mkc-search-form {
	position: relative;
}

.mkc-search-panel {
	position: absolute;
	z-index: 50;
	top: 100%;
	right: 0;
	left: 0;
	margin-top: 8px;
	max-height: 70vh;
	padding: 6px 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, .08);
	border-radius: 8px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, .12);
	color: #000;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: normal;
	text-align: start;
	text-transform: none;
}

.mkc-search-panel[hidden] {
	display: none;
}

.mkc-search-heading {
	padding: 10px 18px 6px;
	color: #8a8a8a;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.mkc-search-option {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 8px 18px;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.mkc-search-option:hover,
.mkc-search-option:focus,
.mkc-search-option.is-active {
	background: rgba(var(--makeaholic-color-primary-rgb, 194, 100, 49), .08);
	color: inherit;
	text-decoration: none;
	outline: 0;
}

.mkc-search-option.is-active {
	box-shadow: inset 3px 0 0 rgb(var(--makeaholic-color-primary-rgb, 194, 100, 49));
}

[dir="rtl"] .mkc-search-option.is-active {
	box-shadow: inset -3px 0 0 rgb(var(--makeaholic-color-primary-rgb, 194, 100, 49));
}

.mkc-search-panel img.mkc-search-thumb {
	flex: 0 0 48px;
	width: 48px;
	max-width: none;
	height: 48px;
	border-radius: 6px;
	background: #f5f5f5;
	object-fit: cover;
}

.mkc-search-info,
.mkc-search-suggestion-text {
	flex: 1 1 auto;
	min-width: 0;
}

.mkc-search-name,
.mkc-search-suggestion-text {
	display: block;
	overflow: hidden;
	color: #000;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mkc-search-name {
	font-weight: 500;
}

.mkc-search-name strong,
.mkc-search-suggestion-text strong {
	font-weight: 700;
}

.mkc-search-meta {
	display: block;
	overflow: hidden;
	color: #777;
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mkc-search-stock {
	color: #b42318;
}

.mkc-search-cat + .mkc-search-stock::before {
	content: "·";
	margin: 0 6px;
	color: #999;
}

.mkc-search-price {
	flex: 0 0 auto;
	max-width: 45%;
	color: #000;
	font-size: 13px;
	font-weight: 600;
	text-align: end;
	white-space: nowrap;
}

.mkc-search-price .price,
.mkc-search-price .amount {
	margin: 0;
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
}

/* The parent wraps prices in a block <div class="price">: keep the sale badge on the same line. */
.mkc-search-price .price {
	display: inline;
}

.mkc-search-price del {
	margin-inline-end: 4px;
	color: #999;
	font-weight: 400;
}

.mkc-search-price ins {
	text-decoration: none;
}

.mkc-search-badge {
	display: inline-block;
	margin-inline-start: 6px;
	padding: 1px 6px;
	border-radius: 3px;
	background: rgb(var(--makeaholic-color-primary-rgb, 194, 100, 49));
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	vertical-align: middle;
}

.mkc-search-price-loading {
	display: inline-block;
	width: 56px;
	height: 12px;
	border-radius: 3px;
	background: #eee;
	vertical-align: middle;
}

.mkc-search-icon {
	flex: 0 0 20px;
	color: #999;
	font-size: 18px;
	text-align: center;
}

.mkc-search-suggestion .mkc-search-meta {
	flex: 0 0 auto;
}

.mkc-search-all {
	justify-content: center;
	margin-top: 4px;
	border-top: 1px solid rgba(0, 0, 0, .06);
	color: rgb(var(--makeaholic-color-primary-rgb, 194, 100, 49));
	font-weight: 600;
	text-align: center;
}

.mkc-search-all:hover,
.mkc-search-all:focus,
.mkc-search-all.is-active {
	color: rgb(var(--makeaholic-color-primary-rgb, 194, 100, 49));
}

.mkc-search-empty,
.mkc-search-loading {
	padding: 14px 18px;
	color: #555;
}

.mkc-search-loading {
	display: flex;
	align-items: center;
	gap: 10px;
}

.mkc-search-spinner {
	width: 14px;
	height: 14px;
	border: 2px solid rgba(0, 0, 0, .12);
	border-top-color: rgb(var(--makeaholic-color-primary-rgb, 194, 100, 49));
	border-radius: 50%;
	animation: mkc-search-spin .7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.mkc-search-spinner {
		animation: none;
	}
}

/* Wide screens: suggestions beside the products. */
@media (min-width: 1025px) {
	.mkc-search-panel.has-suggestions.has-products .mkc-search-list {
		display: grid;
		grid-template-columns: minmax(220px, 32%) 1fr;
		grid-template-areas: "suggestions products" "all all";
	}

	.mkc-search-panel.has-suggestions.has-products .mkc-search-group-suggestions {
		grid-area: suggestions;
		border-inline-end: 1px solid rgba(0, 0, 0, .06);
	}

	.mkc-search-panel.has-suggestions.has-products .mkc-search-group-products {
		grid-area: products;
	}

	.mkc-search-panel.has-suggestions.has-products .mkc-search-all {
		grid-area: all;
	}
}

/* Header search popup: once results show, the field moves up so they have room below it. */
.page-search-popup.mkc-search-active .page-search-popup-content {
	align-items: flex-start;
	padding-top: 12vh;
}

.page-search-popup .mkc-search-panel {
	font-size: 15px;
}

@media (max-width: 767px) {
	/* Below the popup's close button (fixed at 40px to 80px). */
	.page-search-popup.mkc-search-active .page-search-popup-content {
		padding-top: 96px;
	}

	.mkc-search-option {
		min-height: 48px;
		padding: 8px 14px;
	}

	.mkc-search-heading {
		padding: 10px 14px 4px;
	}

	/* Phones: the price goes under the name, which keeps the full width. */
	.mkc-search-product {
		display: grid;
		grid-template-columns: 48px minmax(0, 1fr);
		grid-template-areas: "thumb info" "thumb price";
		column-gap: 12px;
		row-gap: 2px;
	}

	.mkc-search-panel .mkc-search-product img.mkc-search-thumb {
		grid-area: thumb;
		align-self: center;
	}

	.mkc-search-product .mkc-search-info {
		grid-area: info;
	}

	.mkc-search-product .mkc-search-price {
		grid-area: price;
		max-width: none;
		text-align: start;
	}
}
