/* Leon Search — overlay-style live product search.
 * Inherits theme tokens from :root (--text-font-family, --text-color, --heading-letter-spacing).
 */

/* ----- Trigger button (matches .header-icon pattern) ----- */
.leon-search-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: auto;
	min-width: 28px;
	min-height: 28px;
	padding: 3px;
	margin: 0;
	box-sizing: border-box;
	background: transparent;
	border: 0;
	color: rgb(var(--text-color, 48 48 48));
	cursor: pointer;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	transition: color 200ms ease;
}

.leon-search-trigger:hover,
.leon-search-trigger:focus-visible {
	color: #191970;
	outline: none;
}

.leon-search-trigger .icon-search-svg {
	width: 22px;
	height: 22px;
	display: block;
	flex: 0 0 auto;
	margin-right: 0;
}

.header-interactive-elements .leon-search-trigger {
	width: auto;
	height: auto;
	min-width: 28px;
	min-height: 28px;
	padding: 3px;
}

.header-interactive-elements .leon-search-trigger .icon-search-svg {
	width: 22px;
	height: 22px;
	margin-right: 0;
}

@media screen and (max-width: 767px) {
	.header-interactive-elements .leon-search-trigger {
		min-width: 32px;
		min-height: 32px;
		padding: 4px;
	}

	.header-interactive-elements .leon-search-trigger .icon-search-svg {
		width: 22px;
		height: 22px;
	}
}

@media screen and (min-width: 1301px) {
	.header-interactive-elements .leon-search-trigger {
		min-width: 30px;
		min-height: 30px;
	}

	.header-interactive-elements .leon-search-trigger .icon-search-svg {
		width: 24px;
		height: 24px;
	}
}

/* ----- Body scroll lock ----- */
body.leon-search-locked {
	overflow: hidden;
}

/* ----- Overlay shell ----- */
.leon-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: none;
}

.leon-search-overlay[hidden] {
	display: none !important;
}

.leon-search-overlay.is-open {
	pointer-events: auto;
}

/* ----- Backdrop ----- */
.leon-search-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0);
	transition: background 200ms ease;
	z-index: 1;
}

.leon-search-overlay.is-open .leon-search-backdrop {
	background: rgba(0, 0, 0, 0.4);
}

/* ----- Panel (slides down from top) ----- */
.leon-search-panel {
	position: relative;
	z-index: 2;
	background: rgba(255, 255, 255, 0.98);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
	transform: translateY(-100%);
	transition: transform 220ms ease;
	max-height: 100vh;
	overflow-y: auto;
}

.leon-search-overlay.is-open .leon-search-panel {
	transform: translateY(0);
}

.leon-search-panel-inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 28px 24px 32px;
	font-family: var(--text-font-family, 'Jost', sans-serif);
	color: rgb(var(--text-color, 48 48 48));
}

/* ----- Form ----- */
.leon-search-form {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	border-bottom: 1px solid rgba(var(--text-color, 48 48 48), 0.12);
	padding: 0 0 12px;
}

.leon-search-input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	font-family: inherit;
	font-size: 24px;
	line-height: 1.3;
	letter-spacing: 0;
	color: inherit;
	background: transparent;
	border: 0;
	outline: none;
	padding: 10px 18px;
	min-height: 62px;
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
}

.leon-search-input::-webkit-search-cancel-button {
	display: none;
}

.leon-search-input::placeholder {
	color: rgba(var(--text-color, 48 48 48), 0.4);
}

.leon-search-close {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: inherit;
	cursor: pointer;
	transition: color 200ms ease;
	padding: 0;
}

.leon-search-close:hover,
.leon-search-close:focus-visible {
	color: #191970;
	outline: none;
}

/* ----- Suggestions panel (idle state, before user types) ----- */
.leon-search-suggestions {
	margin-top: 24px;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 32px 48px;
	align-items: start;
}

.leon-search-suggestions[hidden] {
	display: none !important;
}

.leon-search-suggest-section {
	min-width: 0;
}

.leon-search-suggest-heading {
	font-family: var(--heading-font-family, var(--text-font-family, 'Jost', sans-serif));
	font-size: 14px;
	font-weight: 600;
	letter-spacing: var(--heading-letter-spacing, 0.18em);
	text-transform: uppercase;
	margin: 0 0 14px;
	color: rgb(var(--text-color, 48 48 48));
}

.leon-search-suggest-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.leon-search-suggest-item {
	margin: 0;
	padding: 0;
}

.leon-search-suggest-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: transparent;
	border: 0;
	padding: 6px 0;
	margin: 0;
	font-family: var(--text-font-family, 'Jost', sans-serif);
	font-size: 15px;
	line-height: 1.4;
	color: rgb(var(--text-color, 48 48 48));
	cursor: pointer;
	text-align: left;
	transition: color 150ms ease;
}

.leon-search-suggest-btn:hover,
.leon-search-suggest-btn:focus-visible {
	color: #191970;
	outline: none;
}

.leon-search-suggest-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: rgba(var(--text-color, 48 48 48), 0.6);
	transition: color 150ms ease;
}

.leon-search-suggest-btn:hover .leon-search-suggest-icon,
.leon-search-suggest-btn:focus-visible .leon-search-suggest-icon {
	color: #191970;
}

.leon-search-suggest-label {
	flex: 1 1 auto;
	min-width: 0;
}

/* ----- Results ----- */
.leon-search-results[hidden] {
	display: none !important;
}

.leon-search-results {
	margin-top: 20px;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.leon-search-results:empty {
	margin-top: 0;
}

.leon-search-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px;
	text-decoration: none;
	color: inherit;
	border-radius: 4px;
	transition: background 150ms ease;
}

.leon-search-item:hover,
.leon-search-item:focus-visible {
	background: rgba(0, 0, 0, 0.04);
	outline: none;
	color: inherit;
}

.leon-search-item-image {
	flex: 0 0 60px;
	width: 60px;
	height: 60px;
	background: #f6f6f6;
	border-radius: 4px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.leon-search-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.leon-search-item-body {
	flex: 1 1 auto;
	min-width: 0;
}

.leon-search-item-title {
	font-size: 14px;
	line-height: 1.4;
	font-weight: 500;
	margin: 0 0 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.leon-search-item-price {
	font-size: 13px;
	line-height: 1.3;
	color: rgba(var(--text-color, 48 48 48), 0.75);
}

.leon-search-item-price .woocommerce-Price-amount,
.leon-search-item-price bdi {
	font-weight: 500;
	color: rgb(var(--text-color, 48 48 48));
}

.leon-search-item-arrow {
	flex: 0 0 auto;
	font-size: 18px;
	color: rgba(var(--text-color, 48 48 48), 0.5);
	transition: transform 150ms ease, color 150ms ease;
}

.leon-search-item:hover .leon-search-item-arrow {
	transform: translateX(4px);
	color: #191970;
}

/* ----- States: loading, empty ----- */
.leon-search-state {
	grid-column: 1 / -1;
	padding: 24px 8px;
	font-size: 14px;
	color: rgba(var(--text-color, 48 48 48), 0.7);
	text-align: center;
}

.leon-search-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(var(--text-color, 48 48 48), 0.2);
	border-top-color: rgb(var(--text-color, 48 48 48));
	border-radius: 50%;
	animation: leon-search-spin 700ms linear infinite;
	vertical-align: -2px;
	margin-right: 8px;
}

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

/* ----- Mobile (matches theme breakpoint at themes/leon/style.css:542) ----- */
@media (max-width: 767px) {
	.leon-search-panel-inner {
		padding: 20px 16px 24px;
	}

	.leon-search-input {
		font-size: 20px;
		min-height: 56px;
	}

	.leon-search-results {
		grid-template-columns: 1fr;
		gap: 4px;
	}

	.leon-search-item-image {
		flex-basis: 56px;
		width: 56px;
		height: 56px;
	}

	.leon-search-suggestions {
		grid-template-columns: 1fr;
		gap: 24px;
		margin-top: 18px;
	}

	.leon-search-suggest-btn {
		font-size: 14px;
		padding: 8px 0;
	}
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
	.leon-search-panel,
	.leon-search-backdrop,
	.leon-search-item,
	.leon-search-item-arrow,
	.leon-search-spinner {
		transition: none !important;
		animation: none !important;
	}
}
