/* PharmSwift Smart Search — scoped with .pss- prefix to avoid theme/plugin clashes */

/* ---- Reusable search box (desktop dropdown look, matches site header design) ---- */
.pss-searchbox-wrap {
	/* IMPORTANT: this box lives inline in the header/menu, so it must NOT
	   float above sitewide UI like an open mobile menu. Only the dropdown
	   results panel (.pss-suggest, below) and the full-screen overlay need
	   a very high z-index — the box itself just needs to be a fresh
	   stacking context so its own children layer correctly. */
	position: relative;
	z-index: 1;
	isolation: isolate;
	width: 100%;
	max-width: 480px;
}

.pss-searchbox {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #fff;
	border: 1.5px solid #E2E2E2;
	border-radius: 999px;
	padding: 9px 16px;
	position: relative;
	z-index: 1;
	transition: border-color 0.15s;
}

.pss-searchbox:focus-within {
	border-color: var(--pss-accent, #0C831F);
}

.pss-searchbox svg {
	flex: 0 0 auto;
	color: #6B6B6B;
}

.pss-searchbox-input {
	border: none;
	background: transparent;
	outline: none;
	flex: 1;
	font-size: 14px;
	color: #1C1C1C;
	min-width: 0;
}

.pss-voice-btn {
	border: none;
	background: none;
	cursor: pointer;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	z-index: 1;
	flex: 0 0 auto;
	color: #6B6B6B;
}

.pss-voice-btn:hover {
	background: rgba(0,0,0,0.06);
}

.pss-voice-btn.pss-listening {
	background: #ff3b30;
	color: #fff;
	animation: pss-pulse 1s infinite;
}

@keyframes pss-pulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.1); }
	100% { transform: scale(1); }
}

.pss-suggest {
	display: none;
	position: fixed;
	background: #fff;
	border: 1px solid #ECECEC;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0,0,0,.18);
	max-height: 380px;
	overflow-y: auto;
	z-index: 9999999;
	min-width: 300px;
}

.pss-sg-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	cursor: pointer;
	text-decoration: none;
	color: #1C1C1C;
}

.pss-sg-item:hover {
	background: #F4F5F7;
}

.pss-sg-item img {
	width: 36px;
	height: 36px;
	object-fit: cover;
	border-radius: 8px;
	background: #F4F5F7;
	flex: 0 0 auto;
}

.pss-sg-name {
	font-size: 13px;
	line-height: 1.3;
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pss-sg-price {
	font-size: 13px;
	font-weight: 600;
	color: var(--pss-accent, #0C831F);
	white-space: nowrap;
	flex: 0 0 auto;
}

.pss-sg-loading {
	padding: 14px 12px;
	font-size: 13px;
	color: #6B6B6B;
}

.pss-sg-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 10px 12px 4px;
}

.pss-sg-cat-pill {
	background: #fff3ec;
	color: var(--pss-accent, #0C831F);
	border-radius: 20px;
	padding: 4px 10px;
	font-size: 12px;
	text-decoration: none;
	border: 1px solid rgba(0,0,0,0.05);
}

/* Not-found / request-availability message — shown both in dropdown and overlay */
.pss-notfound {
	padding: 16px 14px;
	cursor: pointer;
	transition: background 0.15s;
	border-radius: 12px;
}

.pss-notfound:hover {
	background: #F4F5F7;
}

.pss-notfound-title {
	font-size: 14px;
	font-weight: 600;
	color: #1C1C1C;
	margin: 0 0 4px;
}

.pss-notfound-body {
	font-size: 13px;
	color: #444;
	margin: 0 0 8px;
	line-height: 1.5;
}

.pss-notfound-timing {
	font-size: 12px;
	color: #6B6B6B;
	margin: 0 0 10px;
	line-height: 1.5;
}

.pss-notfound-cta {
	font-size: 13px;
	font-weight: 600;
	color: var(--pss-accent, #0C831F);
}

.pss-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: none;
	border: none;
	cursor: pointer;
	color: inherit;
	font: inherit;
	padding: 6px;
}

.pss-trigger-bar {
	background: transparent;
	border: 1.5px solid #E2E2E2;
	border-radius: 10px;
	padding: 10px 14px;
	width: 100%;
	max-width: 480px;
	color: #777;
}

.pss-trigger-bar-text {
	font-size: 14px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pss-floating-icon {
	position: fixed;
	right: 18px;
	bottom: 84px;
	z-index: 99998;
	background: var(--pss-accent, #ff5722);
	color: #fff;
	border-radius: 50%;
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

/* Overlay — full screen, Blinkit-style */
.pss-overlay {
	position: fixed;
	inset: 0;
	background: #fff;
	/* Must sit above absolutely everything — including an open mobile
	   menu/header — since it's a full-screen takeover. */
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	opacity: 0;
	transition: transform 0.28s ease, opacity 0.2s ease;
	pointer-events: none;
}

.pss-overlay.pss-open {
	transform: translateY(0);
	opacity: 1;
	pointer-events: auto;
}

body.pss-locked {
	overflow: hidden;
}

.pss-overlay-top {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid #eee;
	flex: 0 0 auto;
}

.pss-back {
	background: none;
	border: none;
	cursor: pointer;
	color: #333;
	display: flex;
	padding: 4px;
	flex: 0 0 auto;
}

.pss-input-wrap {
	flex: 1 1 auto;
	position: relative;
	background: #fff;
	border: 1.5px solid #E2E2E2;
	border-radius: 10px;
	display: flex;
	align-items: center;
}

/* Back arrow on mobile, an explicit "X" close icon on desktop — a back
   arrow doesn't make sense once the search opens as a modal instead of
   a full page navigation. */
.pss-icon-close {
	display: none;
}

.pss-input-wrap:focus-within {
	border-color: var(--pss-accent, #0C831F);
}

.pss-input {
	flex: 1 1 auto;
	border: none;
	background: transparent;
	padding: 12px 78px 12px 14px;
	font-size: 16px;
	outline: none;
	width: 100%;
}

.pss-clear {
	position: absolute;
	right: 44px;
	top: 50%;
	transform: translateY(-50%);
	background: #ccc;
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 22px;
	height: 22px;
	line-height: 20px;
	font-size: 16px;
	cursor: pointer;
}

.pss-overlay-voice-btn {
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
}

.pss-overlay-body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 14px;
}

.pss-section-title {
	font-size: 13px;
	font-weight: 600;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin: 4px 0 10px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.pss-recent-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 18px;
}

.pss-chip {
	background: #f2f2f2;
	border-radius: 20px;
	padding: 7px 14px;
	font-size: 13px;
	color: #444;
	cursor: pointer;
	border: none;
}

.pss-chip:hover {
	background: #e8e8e8;
}

.pss-clear-recent {
	font-size: 12px;
	color: var(--pss-accent, #ff5722);
	cursor: pointer;
	background: none;
	border: none;
	text-transform: none;
	letter-spacing: normal;
	font-weight: 500;
}

.pss-cat-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

.pss-cat-pill {
	background: #fff3ec;
	color: var(--pss-accent, #ff5722);
	border-radius: 20px;
	padding: 6px 12px;
	font-size: 13px;
	text-decoration: none;
	border: 1px solid rgba(0,0,0,0.05);
}

.pss-product-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid #f2f2f2;
	text-decoration: none;
	color: inherit;
}

.pss-product-row img {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 8px;
	background: #f4f4f4;
	flex: 0 0 auto;
}

.pss-product-info {
	flex: 1 1 auto;
	min-width: 0;
}

.pss-product-title {
	font-size: 14px;
	color: #222;
	margin: 0 0 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pss-product-price {
	font-size: 13px;
	color: #555;
}

.pss-product-price ins {
	text-decoration: none;
	color: var(--pss-accent, #ff5722);
	font-weight: 600;
}

.pss-out-of-stock {
	font-size: 11px;
	color: #c00;
	margin-left: 6px;
}

.pss-empty-state, .pss-loading-state {
	text-align: center;
	color: #999;
	font-size: 14px;
	padding: 40px 10px;
}

@media (min-width: 782px) {
	.pss-overlay {
		max-width: 640px;
		margin: 0 auto;
		box-shadow: 0 0 40px rgba(0,0,0,0.15);
		border-left: 1px solid #eee;
		border-right: 1px solid #eee;
	}

	.pss-icon-back {
		display: none;
	}

	.pss-icon-close {
		display: block;
	}
}

/* The native WooCommerce "Product Search" widget (the plain box shown in
   the shop-page sidebar/filters) is intentionally left untouched by this
   plugin's JS — so it has to be hidden with CSS instead, only on the
   shop / category / tag archive pages, everywhere else (including the
   header) is unaffected. */
body.woocommerce-shop .woocommerce-product-search,
body.woocommerce-shop .widget_product_search,
body.tax-product_cat .woocommerce-product-search,
body.tax-product_cat .widget_product_search,
body.tax-product_tag .woocommerce-product-search,
body.tax-product_tag .widget_product_search {
	display: none !important;
}
