/**
 * Algolia Search Overlay — Full-screen redesign
 */

/* ------------------------------------------------------------------ */
/*  Full-screen overlay                                               */
/* ------------------------------------------------------------------ */
.abi-algolia-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: #f2f2f2;
	overflow-y: auto;
	pointer-events: none;
	visibility: hidden;
	opacity: 0;
	/* Chrome on Android keeps a position:fixed; inset:0 layer "live" for
	   hit-testing even when it's invisible/opacity:0/pointer-events:none —
	   until a scroll forces a reflow. Translate it off-screen so the
	   compositor can't keep it under the cursor. */
	transform: translateY(-100%);
	transition: opacity 0.22s ease, transform 0s 0.22s, visibility 0s 0.22s;
}

.abi-algolia-search-overlay.is-open {
	pointer-events: auto;
	visibility: visible;
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.22s ease, transform 0s 0s, visibility 0s 0s;
}

/* ------------------------------------------------------------------ */
/*  Top bar                                                           */
/* ------------------------------------------------------------------ */
.abi-search-topbar {
	padding: 28px 0 22px;
}

.abi-search-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 32px;
}

/* Search input */
.abi-search-topbar__input-wrap {
	position: relative;
	width: 480px;
	max-width: 60vw;
}

.abi-search-topbar__input {
	width: 100%;
	color: #333;
	border: 1.5px solid #ccc;
	border-radius: 8px!important;
	padding: 16px!important;
	background: #fff;
	outline: none;
	box-sizing: border-box;
	-webkit-appearance: none;
	appearance: none;
}

.abi-search-topbar__input::-webkit-search-cancel-button,
.abi-search-topbar__input::-webkit-search-decoration {
	-webkit-appearance: none;
}

.abi-search-topbar__input:focus {
	border-color: #888;
}

.abi-search-topbar__input::placeholder {
	color: #aaa;
}

.abi-search-topbar__icon {
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	color: #888;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	padding: 4px;
	margin: 0;
	cursor: pointer;
	border-radius: 4px;
	transition: color 0.15s ease, background 0.15s ease;
}

.abi-search-topbar__icon:hover,
.abi-search-topbar__icon:focus-visible {
	color: #222;
	background: rgba(0, 0, 0, 0.05);
	outline: none;
}

/* View all results link */
.abi-search-topbar__view-all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	font-weight: 400;
	color: #434243;
	text-decoration: none;
	border-bottom: 1px solid #C7C6C7;
	padding-bottom: 1px;
	transition: color 0.15s, border-color 0.15s;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease, color 0.15s, border-color 0.15s;
}

.abi-search-topbar__view-all[aria-hidden="false"] {
	opacity: 1;
	pointer-events: auto;
}

.abi-search-topbar__view-all:hover {
	color: #000;
	border-color: #434243;
}

/* Close button */
.abi-search-topbar__close {
	display: flex;
	align-items: center;
	gap: 12px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	font-weight: 400;
	color: #333;
	transition: color 0.15s;
	white-space: nowrap;
}

.abi-search-topbar__close:hover {
	color: #000;
}

.abi-search-topbar__close-label {
	letter-spacing: 0.02em;
}

.abi-search-topbar__close-divider {
	display: inline-block;
	width: 1px;
	height: 16px;
	background: #bbb;
	flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/*  Body layout: sidebar + results                                    */
/* ------------------------------------------------------------------ */
.abi-search-body {
	padding-bottom: 60px;
}

.abi-search-body__inner {
	display: flex;
	gap: 60px;
	align-items: flex-start;
}

/* ------------------------------------------------------------------ */
/*  Sidebar                                                           */
/* ------------------------------------------------------------------ */
.abi-search-overlay-sidebar {
	width: 260px;
	flex-shrink: 0;
}

.abi-search-overlay-sidebar__section {
	padding: 20px 0;
	border-bottom: 1px solid #d8d8d8;
}

.abi-search-overlay-sidebar__section:last-child {
	border-bottom: none;
}

/* Align first visible sidebar heading with Products heading in results pane */
.abi-search-overlay-sidebar > .abi-search-overlay-sidebar__section:first-child,
.abi-search-overlay-sidebar > [style*="display:none"] + .abi-search-overlay-sidebar__section {
	padding-top: 0;
}

/* Suggestions */
.abi-search-suggestions__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abi-search-suggestions__item {
	margin: 0;
}

.abi-search-suggestions__link {
	display: block;
	font-weight: 400;
	color: #434243;
	text-decoration: none;
	padding: 5px 0;
	transition: color 0.15s;
}

.abi-search-suggestions__link:hover {
	color: #000;
}

.abi-search-suggestions__link strong {
	font-weight: 700;
}

/* Quick links */
.abi-search-quicklinks__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abi-search-quicklinks__item {
	margin: 0;
}

.abi-search-quicklinks__link {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	color: #434243;
	text-decoration: none;
	padding: 5px 0;
	transition: color 0.15s;
}

.abi-search-quicklinks__link:hover {
	color: #000;
}

/* ------------------------------------------------------------------ */
/*  Results pane                                                      */
/* ------------------------------------------------------------------ */
.abi-search-results-pane {
	flex: 1;
	min-width: 0;
}

.abi-search-results-pane__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.abi-search-results-pane__header .abi-search-overlay-sidebar__heading {
	margin: 0;
}

.abi-search-results-pane__header .abi-search-topbar__view-all {
	margin: 0;
}

.abi-search-status {
	color: #888;
	margin: 0 0 16px;
}

.abi-search-noresults {
	color: #666;
	padding: 24px 0;
	margin: 0;
}

/* ------------------------------------------------------------------ */
/*  Product grid                                                      */
/* ------------------------------------------------------------------ */
.abi-search-product-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	list-style: none;
	padding: 0;
	margin: 0;
}

/* ------------------------------------------------------------------ */
/*  Product card                                                      */
/* ------------------------------------------------------------------ */
.abi-search-product-card {
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.07);
	display: flex;
	flex-direction: column;
}

/* Shimmer skeleton — shown while popular products are loading */
.abi-search-product-card--skeleton {
	pointer-events: none;
}

.abi-search-product-card--skeleton .abi-search-skeleton-block {
	background: linear-gradient(90deg, #ececec 0%, #f5f5f5 50%, #ececec 100%);
	background-size: 200% 100%;
	animation: abi-search-shimmer 1.2s ease-in-out infinite;
	border-radius: 4px;
}

.abi-search-product-card--skeleton .abi-search-skeleton-image {
	aspect-ratio: 1;
	width: 100%;
	border-radius: 0;
}

.abi-search-product-card--skeleton .abi-search-skeleton-line {
	height: 12px;
	margin: 8px 12px;
}

.abi-search-product-card--skeleton .abi-search-skeleton-line--short {
	width: 40%;
}

.abi-search-product-card--skeleton .abi-search-skeleton-line--long {
	width: 80%;
	margin-bottom: 14px;
}

@keyframes abi-search-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.abi-search-product-card__image-wrap {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	text-decoration: none;
}

.abi-search-product-card__image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: transform 0.3s ease;
}

.abi-search-product-card__image-wrap:hover img {
	transform: scale(1.04);
}

.abi-search-product-card__body {
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.abi-search-product-card__price-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 6px;
}

.abi-search-product-card__wishlist {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	line-height: 0;
	color: #888;
	transition: color 0.15s;
	flex-shrink: 0;
}

.abi-search-product-card__wishlist:hover {
	color: #111;
}

.abi-search-product-card__name {
	color: #434243;
	line-height: 22px;
	text-decoration: none;
	display: block;
	margin: 0 0 14px;
	flex: 1;
}

.abi-search-product-card__name:hover {
	color: #000;
}

.abi-search-product-card__atc {
	display: block;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #434243;
	background: none;
	color: #434243;
	font-weight: 500;
	letter-spacing: 0.01em;
	text-align: center;
	cursor: pointer;
	text-decoration: none;
	box-sizing: border-box;
	transition: background 0.15s ease, color 0.15s ease;
	border-radius: 2px;
}

.abi-search-product-card__atc:hover {
	background: #434243;
	color: #fff;
}

.abi-search-product-card__atc--oos {
	cursor: default;
	border-color: #C7C6C7;
	color: #A1A0A1;
}

.abi-search-product-card__atc--oos:hover {
	background: none;
	color: #A1A0A1;
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                        */
/* ------------------------------------------------------------------ */
@media (max-width: 1199px) {
	.abi-search-product-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 959px) {
	.abi-search-body__inner {
		flex-direction: column;
		gap: 0;
	}

	/* On mobile, products come first — pages/quick links go below the
	   product grid. flex `order` keeps the DOM order intact for a11y /
	   keyboard nav while flipping the visual stack. */
	.abi-search-results-pane {
		order: 0;
	}

	.abi-search-overlay-sidebar {
		order: 1;
		width: 100%;
		display: flex;
		flex-wrap: wrap;
		gap: 0 48px;
		/* Border + spacing now sit ABOVE the sidebar (between products
		   and quick links) instead of below. */
		padding-top: 20px;
		padding-bottom: 0;
		border-top: 1px solid #d8d8d8;
		border-bottom: none;
		margin-top: 24px;
		margin-bottom: 0;
	}

	.abi-search-overlay-sidebar__section {
		flex: 1;
		min-width: 160px;
		border-bottom: none;
		/* Sections that were `padding-top: 0` (first child rule from
		   desktop) now need normal top padding since the sidebar's own
		   padding-top above already separates it from the products. */
		padding-top: 0;
	}

	.abi-search-topbar__input-wrap {
		width: auto;
		flex: 1;
		max-width: none;
	}

	.abi-search-product-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 479px) {
	.abi-search-topbar__close-label {
		display: none;
	}

	.abi-search-topbar__close-divider {
		display: none;
	}

	.abi-search-topbar__view-all {
		display: none;
	}
}

/* ------------------------------------------------------------------ */
/*  Trigger button (used on test page)                                */
/* ------------------------------------------------------------------ */
.abi-algolia-search-trigger {
	padding: 12px 24px;
	background: #000;
	color: #fff;
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
}

.abi-algolia-search-trigger:hover {
	background: #333;
}
