/* Local search live input (search/localsearch.tpl + js/webshop/localsearch.js). Scoped .ls-*; colours through CSS variables with plain fallbacks so both themes can restyle without touching this file. */
.ls {
	position: relative;
	--ls-radius: .375rem;
	--ls-gutter: 1rem;
	/* Panel width, independent of the input's. A theme can narrow or widen it
	   by redefining this one variable. */
	--ls-results-width: 44rem;
}

/* The input and the submit button are one control: stretch rather than centre,
   or the button ends up a short block floating beside a taller input. */
.ls .ls-form {
	display: flex;
	align-items: stretch;
	flex-wrap: nowrap;
	position: relative;
}

/* Written as .ls .ls-* rather than .ls-*: the DesignPlus theme styles the same
   two elements through .newelement-navbar-input / -button at one-class
   specificity, so a bare .ls-button would win or lose depending on where the
   minifier happened to concatenate this file. Two classes settle it without
   !important, and the theme keeps its colours, borders and fonts. */
/* flex-basis 0 so the field shrinks to leave the button its width. An `auto`
   basis sizes from the input's own content width, which on the DesignPlus
   navbar (a Bootstrap .row, therefore wrapping) pushed the button onto its own
   line. The theme's max-width reserve is left alone for the same reason. */
/* max-width:none because the theme reserves a fixed 50px for the button
   (max-width: calc(100% - 50px)) while the button sizes from its own content -
   the difference showed as a gap between the two. Safe here only because the
   form above is flex-wrap:nowrap; without that the field would grow to 100%
   and push the button onto its own line, which is exactly what happened when
   this was first tried. */
.ls .ls-input {
	flex: 1 1 0%;
	min-width: 0;
	max-width: none;
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

/* align-self, not the row's align-items: the DesignPlus markup puts Bootstrap's
   .align-items-center on this form, and Bootstrap utilities carry !important,
   so stretching from the container could never win. Setting it on the item
   itself does, with no !important of our own - and that is what makes the
   button the same height as the field instead of a short centred pill.
   height:auto then lets that stretch take effect over the theme's fixed
   43.5px. */
.ls .ls-button {
	display: flex;
	flex: 0 0 auto;
	align-self: stretch;
	align-items: center;
	justify-content: center;
	height: auto;
	min-width: 3rem;
	padding: 0 .9rem;
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
	border-top-right-radius: var(--ls-radius);
	border-bottom-right-radius: var(--ls-radius);
	line-height: 1;
}

.ls .ls-button svg {
	width: 1.05rem;
	height: 1.05rem;
}

.ls-spinner {
	position: absolute;
	right: 3.6rem;
	top: 50%;
	width: 1rem;
	height: 1rem;
	margin-top: -.5rem;
	border: 2px solid var(--ls-border, #ccc);
	border-top-color: var(--ls-accent, #333);
	border-radius: 50%;
	animation: ls-spin .8s linear infinite;
}

@keyframes ls-spin { to { transform: rotate(360deg); } }

/* Wider than the field and centred on it: the rows carry a thumbnail, a long
   product name, an item number and a price, and at input width the names were
   the first thing to lose. min-width keeps it from ever being narrower than
   the field; the vw cap keeps it inside the viewport on a narrow screen, where
   it simply matches the field again. */
.ls-results {
	position: absolute;
	left: 50%;
	right: auto;
	transform: translateX(-50%);
	width: var(--ls-results-width);
	min-width: 100%;
	max-width: 96vw;
	top: calc(100% + .35rem);
	z-index: 1050;
	background: var(--ls-bg, #fff);
	color: var(--ls-fg, #222);
	border: 1px solid var(--ls-border, #ddd);
	border-radius: var(--ls-radius);
	box-shadow: 0 10px 28px rgba(16, 24, 40, .18);
	max-height: 76vh;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ls-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Sticky so the section a visitor is scrolling through stays named. */
.ls-heading {
	position: sticky;
	top: 0;
	z-index: 1;
	padding: .45rem var(--ls-gutter);
	font-size: .7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--ls-muted, #777);
	background: var(--ls-heading-bg, #f7f7f7);
	border-bottom: 1px solid var(--ls-border, #eee);
}

.ls-row {
	display: flex;
	gap: var(--ls-gutter);
	align-items: center;
	padding: .55rem var(--ls-gutter);
	cursor: pointer;
	border-top: 1px solid var(--ls-border, #eee);
}

.ls-heading + .ls-row {
	border-top: 0;
}

.ls-row.ls-active,
.ls-row:hover {
	background: var(--ls-highlight, #f0f4f8);
}

.ls-img {
	width: 56px;
	height: 56px;
	object-fit: contain;
	flex: 0 0 56px;
	background: #fff;
	border-radius: .2rem;
}

/* A model row carries a title and nothing else, so it needs neither the room
   nor the thumbnail weight of a product row - it was drawing twice as tall as
   the products underneath it for one line of text. */
.ls-row.ls-type-4,
.ls-row.ls-type-2 {
	padding-top: .4rem;
	padding-bottom: .4rem;
}

.ls-row.ls-type-4 .ls-img {
	width: 28px;
	height: 28px;
	flex-basis: 28px;
	opacity: .55;
}

/* Skeletons for a thumbnail or price still on its way: the colours and the sweep
   of skeleton.css, drawn in the background because an <img> has no ::after.
   After the model-row rule, which would otherwise fade the box to .55. */
.ls-row .ls-img.ls-img-pending,
.ls-price-pending {
	background: linear-gradient(90deg, #eceef1 30%, #f6f7f9 50%, #eceef1 70%) 0 0 / 300% 100%;
	opacity: 1;
	animation: ls-sheen 1.25s ease-in-out infinite;
}

@keyframes ls-sheen {
	from { background-position: 100% 0; }
	to { background-position: 0 0; }
}

/* A thumbnail that just arrived. Only a start frame, so a model thumbnail
   settles back on its own .55 rather than on 1. */
.ls-img.ls-img-in {
	animation: ls-zoom-in .25s ease-out;
}

@keyframes ls-zoom-in {
	from { opacity: 0; transform: scale(.85); }
}

@media (prefers-reduced-motion: reduce) {
	.ls-row .ls-img.ls-img-pending,
	.ls-price-pending,
	.ls-img.ls-img-in {
		animation: none;
	}
}

.ls-body {
	min-width: 0;
	flex: 1 1 auto;
}

/* Two lines rather than one hard truncation: these names run long ("NMI Norsk
   Motor Import KTM RC8 1190") and a single ellipsised line cut them exactly
   where they start to differ from each other. */
.ls-title {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
}

/* The matched part of a title or item number: weight only, not the browser's
   yellow <mark>, so it reads the same on any theme. */
.ls-hl {
	padding: 0;
	background: none;
	color: inherit;
	font-weight: 700;
}

.ls-code {
	margin-top: .1rem;
	font-size: .8rem;
	color: var(--ls-muted, #777);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The row's right-hand column. nowrap keeps an amount on one line, so the
   column stays as narrow as the longest price rather than wrapping mid-figure,
   and everything to its left belongs to the name. */
.ls-price {
	flex: 0 0 auto;
	margin-left: auto;
	text-align: right;
	white-space: nowrap;
	font-size: .95rem;
}

/* An offer stacks its two figures instead of running them side by side. */
.ls-price .ls-offer,
.ls-price .ls-before {
	display: block;
}

.ls-price .ls-before {
	font-size: .8rem;
}

.ls-price-pending {
	display: inline-block;
	width: 4.5em;
	height: 1em;
	border-radius: 2px;
}

.ls-offer {
	color: var(--ls-offer, #c0392b);
	font-weight: 600;
}

.ls-before {
	text-decoration: line-through;
	color: var(--ls-muted, #777);
}

.ls-empty {
	padding: 1rem var(--ls-gutter);
	color: var(--ls-muted, #777);
}

/* Stays reachable at the bottom of a long list without scrolling to find it. */
.ls-showall {
	position: sticky;
	bottom: 0;
	display: block;
	padding: .65rem var(--ls-gutter);
	text-align: center;
	font-weight: 600;
	background: var(--ls-bg, #fff);
	border-top: 1px solid var(--ls-border, #eee);
}

.ls-showall[hidden] {
	display: none;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
