/* ACS AJAX Product Search
   Colours are driven by CSS vars so you can restyle from Elementor
   Site Settings > Custom CSS without touching this file. */

:root {
	--acs-aps-accent: #0f4c82;
	--acs-aps-text: #1a1a1a;
	--acs-aps-muted: #6b7280;
	--acs-aps-border: #e5e7eb;
	--acs-aps-bg: #ffffff;
	--acs-aps-radius: 10px;
}

.acs-aps-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(2px);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 8vh 16px 16px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.acs-aps-overlay.is-visible {
	opacity: 1;
}

body.acs-aps-open {
	overflow: hidden;
}

.acs-aps-panel {
	width: 100%;
	max-width: 640px;
	background: var(--acs-aps-bg);
	border-radius: var(--acs-aps-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
	overflow: hidden;
	transform: translateY(-12px);
	transition: transform 0.2s ease;
	display: flex;
	flex-direction: column;
	max-height: 80vh;
}

.acs-aps-overlay.is-visible .acs-aps-panel {
	transform: translateY(0);
}

/* Search bar */
.acs-aps-form {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--acs-aps-border);
	margin: 0;
}

.acs-aps-icon {
	color: var(--acs-aps-muted);
	display: flex;
}

.acs-aps-input,
.acs-aps-input:focus {
	flex: 1;
	border: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	font-size: 17px;
	color: var(--acs-aps-text);
	padding: 4px 0;
	line-height: 1.4;
}

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

.acs-aps-close {
	border: 0;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	color: var(--acs-aps-muted);
	cursor: pointer;
	padding: 0 4px;
}

.acs-aps-close:hover {
	color: var(--acs-aps-text);
}

/* Results
   flex: 1 with min-height: 0 is what lets this scroll inside the panel
   instead of stretching it. Without min-height: 0 a flex child refuses to
   shrink below its content and the panel grows past its max-height. */
.acs-aps-results {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 6px 0 10px;
	scrollbar-width: thin;
	scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

.acs-aps-results::-webkit-scrollbar {
	width: 10px;
}

.acs-aps-results::-webkit-scrollbar-track {
	background: transparent;
}

.acs-aps-results::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 999px;
	border: 3px solid var(--acs-aps-bg);
}

.acs-aps-results::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.35);
}

/* Keeps the panel a steady height once there are results, so it does not
   jump about as you type. */
.acs-aps-results.has-results {
	height: 60vh;
}

@media (max-width: 600px) {
	.acs-aps-results.has-results {
		height: auto;
	}
}

/* The group headings stay put while the list scrolls under them. */
.acs-aps-group h4 {
	position: sticky;
	top: 0;
	background: var(--acs-aps-bg);
	z-index: 1;
	padding-top: 6px;
	padding-bottom: 6px;
}

/* Sits below the scrolling list rather than at the end of it. */
.acs-aps-footer {
	flex: 0 0 auto;
	border-top: 1px solid var(--acs-aps-border);
	padding: 10px 16px;
}

.acs-aps-count {
	margin: 0 0 8px;
	font-size: 12px;
	color: var(--acs-aps-muted);
	text-align: center;
}

.acs-aps-hint {
	margin: 0;
	padding: 22px 18px;
	color: var(--acs-aps-muted);
	font-size: 14px;
	text-align: center;
}

.acs-aps-group h4 {
	margin: 10px 0 4px;
	padding: 0 16px;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--acs-aps-muted);
	font-weight: 600;
}

.acs-aps-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 16px;
	text-decoration: none !important;
	color: var(--acs-aps-text);
}

.acs-aps-item:hover,
.acs-aps-item.is-active {
	background: rgba(15, 76, 130, 0.07);
}

.acs-aps-item img,
.acs-aps-thumbph {
	width: 46px;
	height: 46px;
	object-fit: cover;
	border-radius: 6px;
	flex: 0 0 46px;
	background: #f3f4f6;
}

.acs-aps-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.acs-aps-title {
	font-size: 14.5px;
	font-weight: 500;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.acs-aps-title mark {
	background: rgba(255, 214, 0, 0.45);
	color: inherit;
	padding: 0;
}

.acs-aps-meta {
	font-size: 12px;
	color: var(--acs-aps-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.acs-aps-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 3px;
	flex: 0 0 auto;
}

.acs-aps-price {
	font-size: 14px;
	font-weight: 600;
	color: var(--acs-aps-accent);
	white-space: nowrap;
}

.acs-aps-stock {
	font-size: 11px;
	line-height: 1;
	padding: 3px 6px;
	border-radius: 999px;
}

.acs-aps-stock.is-in {
	background: #e7f6ec;
	color: #1a7f43;
}

.acs-aps-stock.is-out {
	background: #fdecec;
	color: #b42318;
}

.acs-aps-footer .acs-aps-viewall {
	margin: 0;
}

.acs-aps-viewall {
	display: block;
	text-align: center;
	margin: 8px 16px 4px;
	padding: 10px;
	border-radius: 8px;
	background: var( --e-global-color-3a14390 );
	color: #fff !important;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none !important;
}

/* Shortcode trigger button */
.acs-aps-inline-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: transparent;
	border: 0;
	cursor: pointer;
	color: inherit;
	padding: 0;
}

.acs-search-trigger {
	cursor: pointer;
}

@media (max-width: 600px) {
	.acs-aps-overlay {
		padding: 0;
	}

	.acs-aps-panel {
		max-width: none;
		border-radius: 0;
		max-height: 100vh;
		height: 100%;
	}
}

/* -------------------------------------------------------------------------
   Elementor loop item product images

   Elementor's image widget leaves the <img> at its natural width with no
   auto margins, so a thumbnail narrower than its container sits hard left.
   Most visible on the search results page, where the cards are wider than
   the images.

   The "body" prefix is deliberate. This file is enqueued at priority 99 so
   it lands after Elementor's stylesheets, and the extra element in the
   selector keeps it ahead of Elementor's own rules on specificity too.

   Not scoped to .search-results: on a card whose image already fills its
   container, auto margins do nothing, so this is safe everywhere the loop
   is used.
   ---------------------------------------------------------------------- */

body .e-loop-item .elementor-widget-image img,
body .e-loop-item .elementor-widget-theme-post-featured-image img,
body .e-loop-item .elementor-widget-woocommerce-product-image img,
body .e-loop-item .e-con-inner > .elementor-widget:first-child img {
	display: block;
	margin-left: auto;
	margin-right: auto;
}
