/**
 * Yoosh Live Search styles.
 * Everything is driven by custom properties so each client site can be
 * re-themed from one block without touching this file.
 */

.yls-form {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 0;
	width: 100%;
	max-width: 100%;
}

.yls-form .yls-search-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

.yls-form .yls-submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 0.9em;
	border: 0;
	cursor: pointer;
	background: var(--yls-accent, #1f6feb);
	color: #fff;
	line-height: 1;
}

.yls-form .yls-submit .yls-icon {
	fill: none;
	stroke: currentColor;
}

.yls-panel {
	--yls-bg: #fff;
	--yls-fg: #1a1a1a;
	--yls-muted: #6b7280;
	--yls-border: #e2e4e9;
	--yls-hover: #f4f6f8;
	--yls-accent: #1f6feb;
	--yls-in: #137333;
	--yls-out: #a8071a;

	position: absolute;
	z-index: 99999;
	box-sizing: border-box;
	max-height: min(70vh, 520px);
	overflow-y: auto;
	padding: 4px;
	background: var(--yls-bg);
	color: var(--yls-fg);
	border: 1px solid var(--yls-border);
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14);
	font-size: 14px;
	line-height: 1.35;
	-webkit-overflow-scrolling: touch;
}

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

.yls-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
}

.yls-item:hover,
.yls-item:focus,
.yls-item.is-active {
	background: var(--yls-hover);
	text-decoration: none;
	outline: none;
}

.yls-thumb {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 4px;
	background: var(--yls-hover);
}

.yls-body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
	flex: 1 1 auto;
}

.yls-title {
	display: block;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.yls-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px;
	font-size: 12px;
	color: var(--yls-muted);
}

.yls-meta .yls-price,
.yls-meta .yls-price * {
	font-size: 12px;
	color: var(--yls-fg);
}

.yls-meta .yls-price del {
	color: var(--yls-muted);
	margin-right: 3px;
}

.yls-sku {
	font-variant-numeric: tabular-nums;
}

.yls-stock {
	font-weight: 600;
}

.yls-stock--in {
	color: var(--yls-in);
}

.yls-stock--out {
	color: var(--yls-out);
}

.yls-mark {
	background: transparent;
	color: var(--yls-accent);
	font-weight: 700;
	padding: 0;
}

.yls-heading {
	padding: 10px 8px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--yls-muted);
	border-top: 1px solid var(--yls-border);
	margin-top: 4px;
}

.yls-item--term {
	justify-content: space-between;
}

.yls-item--term .yls-title {
	font-weight: 500;
}

.yls-note {
	padding: 14px 10px;
	color: var(--yls-muted);
	text-align: center;
}

.yls-note--error {
	color: var(--yls-out);
}

.yls-more {
	display: block;
	margin-top: 4px;
	padding: 10px;
	border-top: 1px solid var(--yls-border);
	border-radius: 0 0 6px 6px;
	text-align: center;
	font-weight: 600;
	color: var(--yls-accent);
	text-decoration: none;
}

.yls-more:hover,
.yls-more:focus,
.yls-more.is-active {
	background: var(--yls-hover);
	text-decoration: none;
	outline: none;
}

.yls-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-color-scheme: dark) {
	.yls-panel.yls-panel--auto-dark {
		--yls-bg: #15181d;
		--yls-fg: #e8eaed;
		--yls-muted: #9aa0a6;
		--yls-border: #2b2f36;
		--yls-hover: #1f242b;
		--yls-in: #5bb974;
		--yls-out: #f28b82;
	}
}

.yls-desc {
	display: block;
	font-size: 12px;
	color: var(--yls-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ------------------------------------------------------- menu integration */

.yls-menu-item {
	position: relative;
	display: flex;
	align-items: center;
}

.yls-menu-item--form .yls-form {
	min-width: 220px;
}

.yls-toggle-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

/* Themes commonly style bare <button> elements (borders, pills, brand
   colours). These toggles are icons, not buttons, so the theme's button
   skin is reset off them explicitly. Specificity plus !important is
   deliberate: a header button rule will otherwise always win. */
.yls-toggle-wrap button.yls-menu-toggle,
.yls-toggle-wrap button.yls-menu-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	padding: 6px;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	background-image: none !important;
	box-shadow: none !important;
	text-shadow: none;
	color: white;
	font: inherit;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
	opacity: 1;
	transition: opacity .15s ease;
}

.yls-toggle-wrap button.yls-menu-toggle:hover,
.yls-toggle-wrap button.yls-menu-close:hover {
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	opacity: .7;
}

/* Keyboard focus must stay visible even though the skin is reset. */
.yls-toggle-wrap button.yls-menu-toggle:focus-visible,
.yls-toggle-wrap button.yls-menu-close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Stroked icons: they take their colour and weight from the menu around
   them, so no per-theme colour rule is needed. */
.yls-toggle-wrap .yls-icon {
	fill: none;
	stroke: currentColor;
	display: block;
}

.yls-toggle-panel {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 99998;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
	padding: 8px;
	min-width: 320px;
	background: var(--yls-bg, #fff);
	border: 1px solid var(--yls-border, #e2e4e9);
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14);
}

.yls-toggle-panel[hidden] {
	display: none;
}

.yls-toggle-panel .yls-form {
	flex: 1 1 auto;
}

.yls-toggle-panel .yls-search-input {
	width: 100%;
	color: var(--yls-fg, #1a1a1a);
}

.yls-toggle-panel .yls-menu-close {
	color: var(--yls-muted, #6b7280);
}

@media (max-width: 600px) {
	.yls-toggle-panel {
		position: fixed;
		top: auto;
		left: 8px;
		right: 8px;
		min-width: 0;
	}
}
