/**
 * KSH — dropdown panel only. No form/header width overrides.
 * form.ksh-ls-enhanced: positioning context for .ksh-ls-panel (theme layout unchanged).
 */
form.ksh-ls-enhanced {
	position: relative;
}

/**
 * Kadence mobile search drawer: parent overflow can clip the live panel.
 */
#search-drawer.popup-drawer.ksh-ls-has-live .drawer-inner,
#search-drawer.popup-drawer.ksh-ls-has-live .drawer-content {
	overflow: visible;
}

/**
 * Mobile/tablet: drawer search form pinned to top of content column (flex + align-self).
 * No transform/top/inset/z-index/pointer-events on drawer (keeps input + AJAX safe).
 */
@media (max-width: 1024px) {
	/**
	 * iOS Safari: computed font-size < 16px on focused inputs triggers page zoom.
	 */
	#search-drawer input.search-field,
	#search-drawer input[type='search'],
	#search-drawer input[name='s'] {
		font-size: 16px !important;
		line-height: 1.2 !important;
		-webkit-text-size-adjust: 100%;
	}

	#search-drawer .drawer-inner {
		justify-content: flex-start !important;
	}

	#search-drawer .drawer-content {
		display: flex !important;
		flex-direction: column !important;
		padding-top: 46px !important;
	}

	#search-drawer form.woocommerce-product-search,
	#search-drawer form.search-form {
		margin-top: 0 !important;
		margin-bottom: auto !important;
		align-self: flex-start !important;
		flex: 0 0 auto !important;
	}
}

.ksh-ls-panel {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 6px);
	z-index: 100050;
	max-height: min(70vh, 480px);
	overflow-y: auto;
	overflow-x: hidden;
	margin: 0;
	padding: 0;
	background: var(--global-palette9, #fff);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
	-webkit-overflow-scrolling: touch;
}

.ksh-ls-panel[hidden] {
	display: none !important;
}

.ksh-ls-results {
	display: flex;
	flex-direction: column;
}

.ksh-ls-section {
	padding: 0;
}

.ksh-ls-section + .ksh-ls-section {
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	margin-top: 0;
}

.ksh-ls-section-title {
	padding: 10px 14px 6px;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--global-palette6, #6b7280);
	margin: 0;
}

.ksh-ls-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ksh-ls-item {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.ksh-ls-list--products .ksh-ls-item:last-child {
	border-bottom: none;
}

.ksh-ls-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	text-decoration: none;
	color: inherit;
	min-height: 56px;
	box-sizing: border-box;
	transition: background 0.15s ease;
}

.ksh-ls-link:hover,
.ksh-ls-link:focus {
	background: rgba(0, 0, 0, 0.04);
	outline: none;
}

.ksh-ls-img {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.04);
}

.ksh-ls-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	overflow: hidden;
}

.ksh-ls-title {
	font-size: 0.9375rem;
	line-height: 1.35;
	font-weight: 600;
	word-break: break-word;
}

.ksh-ls-price {
	font-size: 0.875rem;
	opacity: 0.88;
}

.ksh-ls-cat-item {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.ksh-ls-list--categories .ksh-ls-cat-item:last-child {
	border-bottom: none;
}

.ksh-ls-cat-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	min-height: 44px;
	box-sizing: border-box;
	text-decoration: none;
	color: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	transition: background 0.15s ease;
}

.ksh-ls-cat-link:hover,
.ksh-ls-cat-link:focus {
	background: rgba(0, 0, 0, 0.04);
	outline: none;
}

.ksh-ls-cat-name {
	flex: 1;
	word-break: break-word;
}

.ksh-ls-cat-count {
	flex: 0 0 auto;
	font-size: 0.8125rem;
	font-weight: 600;
	opacity: 0.65;
}

.ksh-ls-view-all {
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	padding: 10px 14px;
	text-align: center;
}

.ksh-ls-view-all-link {
	display: inline-block;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--global-palette-highlight, #1159af);
	text-decoration: none;
}

.ksh-ls-view-all-link:hover,
.ksh-ls-view-all-link:focus {
	text-decoration: underline;
	outline: none;
}

.ksh-ls-empty,
.ksh-ls-loading,
.ksh-ls-error {
	padding: 14px 16px;
	font-size: 0.9375rem;
	margin: 0;
	line-height: 1.5;
}

.ksh-ls-loading {
	color: var(--global-palette5, #555);
}

.ksh-ls-empty {
	color: var(--global-palette5, #555);
}

.ksh-ls-error {
	color: #b91c1c;
}

/**
 * Stewe — single LUX header product search (Kadence toggle/drawer replaced via MU plugin).
 */
.stewe-header-search-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 520px;
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
}

.stewe-header-search {
	display: flex;
	align-items: center;
	width: 100%;
	max-width: 520px;
	height: 44px;
	margin: 0 auto;
	border-radius: 999px;
	background: #f4f6f8;
	border: 1px solid #e5e7eb;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	transition: all 0.2s ease;
	position: relative;
	overflow: visible;
}

.stewe-header-search:focus-within {
	border-color: #cbd5e1;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.stewe-header-search input {
	flex: 1;
	height: 100%;
	border: none;
	background: transparent;
	padding: 0 16px;
	font-size: 14px;
	color: #111827;
	outline: none;
	min-width: 0;
}

.stewe-header-search input::placeholder {
	color: #9ca3af;
}

.stewe-header-search button {
	width: 48px;
	height: 100%;
	border: none;
	background: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #6b7280;
	flex-shrink: 0;
	padding: 0;
}

.stewe-header-search button:hover {
	color: #111827;
}

.stewe-header-search svg {
	width: 20px;
	height: 20px;
	display: block;
}

@media (max-width: 768px) {
	.stewe-header-search-wrap {
		max-width: 100%;
	}

	.stewe-header-search {
		max-width: 100%;
		margin-top: 10px;
	}
}

/**
 * Kadence #search-drawer only — mobile search popup live panel polish.
 * Does not apply to header .stewe-header-search (outside #search-drawer).
 */
@media (max-width: 1024px) {
	#search-drawer .drawer-content form.ksh-ls-enhanced {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}

	#search-drawer .ksh-ls-panel {
		top: calc(100% + 2px);
		left: 0;
		right: 0;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		margin-left: 0;
		margin-right: 0;
		z-index: 100200;
		background: #ffffff;
		border: 1px solid rgba(15, 23, 42, 0.1);
		border-radius: 14px;
		box-shadow:
			0 4px 6px rgba(0, 0, 0, 0.04),
			0 12px 32px rgba(0, 0, 0, 0.12);
		padding: 6px 0;
	}

	#search-drawer .ksh-ls-results {
		padding: 0 4px;
	}

	#search-drawer .ksh-ls-section-title {
		color: #374151;
		font-size: 0.6875rem;
		font-weight: 800;
		letter-spacing: 0.1em;
		padding: 8px 12px 5px;
		margin: 0;
	}

	#search-drawer .ksh-ls-section + .ksh-ls-section {
		border-top: 1px solid rgba(15, 23, 42, 0.07);
	}

	#search-drawer .ksh-ls-item {
		border-bottom: 1px solid rgba(15, 23, 42, 0.06);
	}

	#search-drawer .ksh-ls-link {
		color: #111827;
	}

	#search-drawer .ksh-ls-title {
		color: #111827;
		font-weight: 600;
	}

	#search-drawer .ksh-ls-price {
		color: #4b5563;
		opacity: 1;
		font-weight: 500;
	}

	#search-drawer .ksh-ls-cat-link {
		color: #1f2937;
	}

	#search-drawer .ksh-ls-cat-name {
		color: #1f2937;
	}

	#search-drawer .ksh-ls-cat-count {
		color: #6b7280;
		opacity: 1;
	}

	#search-drawer .ksh-ls-view-all {
		border-top: 1px solid rgba(15, 23, 42, 0.08);
	}

	#search-drawer .ksh-ls-view-all-link {
		color: #1d4ed8;
	}

	#search-drawer .ksh-ls-empty,
	#search-drawer .ksh-ls-loading {
		color: #4b5563;
		padding: 12px 14px;
	}

	#search-drawer .ksh-ls-error {
		color: #b91c1c;
	}
}

/**
 * Mobile stability (emintest): prevent horizontal “breakout”, iOS input zoom, tap delays.
 */
@media (max-width: 1024px) {
	html {
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}

	#wrapper.site {
		overflow-x: clip;
		max-width: 100%;
	}

	.stewe-header-search input.search-field,
	.stewe-header-search input[type='search'],
	.stewe-header-search input[name='s'] {
		font-size: 16px !important;
		line-height: 1.25 !important;
	}

	.stewe-header-search button {
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	/* Keep panel aligned to the form (left:0; right:0); avoid 100vw overflow on narrow viewports. */
	form.ksh-ls-enhanced .ksh-ls-panel {
		box-sizing: border-box;
		max-width: 100%;
	}
}

@media (max-width: 1024px) {
	@supports (padding: max(0px)) {
		.site-header-row-container-inner {
			padding-left: max(12px, env(safe-area-inset-left));
			padding-right: max(12px, env(safe-area-inset-right));
		}
	}
}

/**
 * Global mobile: wide images/tables in content cannot break viewport (Woo + Gutenberg).
 */
@media (max-width: 1024px) {
	body.woocommerce-page .entry-content,
	body.woocommerce-page .woocommerce-Tabs-panel,
	body.woocommerce-page .product .summary {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	body.woocommerce-page .entry-content img,
	body.woocommerce-page .woocommerce-product-gallery,
	body.woocommerce-page .product .summary img {
		max-width: 100%;
		height: auto;
	}

	body.woocommerce-page .entry-content table {
		display: block;
		width: 100% !important;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

