/**
 * WA FiboSearch Rail — standalone autocomplete box.
 *
 * Self-contained styling for our own box (FiboSearch CSS is dequeued). All
 * colors via CSS variables so you can theme to the shop palette.
 */

.wa-ac-box {
	/* "Na mieru" look modelled on the bozpo search panel, recoloured to the
	   mobilky palette: brand = --primary (purple), neutral soft/line greys. */
	--wa-ac-brand: var( --primary, #623385 );
	--wa-ac-brand-hover: var( --primary-hover, #6f3a98 );
	--wa-ac-ink: #1f2024;
	--wa-ac-muted: #6b7280;
	--wa-ac-line: #e7e7e9;
	--wa-ac-soft: #f6f6f7;
	--wa-ac-accent: var( --primary, #623385 ); /* progress bar / clear hover */
	--wa-ac-fg: #1f2024;
	--wa-ac-radius: var( --radius-m, 14px );

	position: absolute;
	z-index: 999999;
	display: none;
	grid-template-columns: 210px minmax( 0, 1fr ) 230px;
	gap: 0;
	background: #fff;
	border: 1px solid var(--wa-ac-line);
	border-radius: var(--wa-ac-radius);
	box-shadow: 0 24px 48px rgba( 0, 0, 0, .14 );
	overflow: hidden;
	box-sizing: border-box;
	font-size: 14px;
	color: var(--wa-ac-ink);
}
.wa-ac-box.wa-ac-open {
	display: grid;
}
/* Recent-searches-only state (empty/short query): single compact column. */
.wa-ac-box.wa-ac-recent-only.wa-ac-open {
	display: block;
}
.wa-ac-box.wa-ac-recent-only .wa-ac-left {
	border-right: 0;
	background: #fff;
}

/* Indeterminate top progress bar — shown only while a fetch is in flight
   (class wa-ac-busy). The box keeps its results, so nothing below flickers. */
.wa-ac-box::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	z-index: 3;
	opacity: 0;
	transition: opacity .15s ease;
	background: linear-gradient( 90deg, transparent, var(--wa-ac-accent), transparent );
	background-size: 40% 100%;
	background-repeat: no-repeat;
	pointer-events: none;
}
.wa-ac-box.wa-ac-busy::before {
	opacity: 1;
	animation: wa-ac-bar 1.1s linear infinite;
}
@keyframes wa-ac-bar {
	0%   { background-position: -40% 0; }
	100% { background-position: 140% 0; }
}

/* Columns — independent scroll so the box height stays stable as results
   change (it never grows past the viewport or jumps between query sizes). */
.wa-ac-left,
.wa-ac-right,
.wa-ac-middle {
	padding: 16px 18px;
	box-sizing: border-box;
	background: #fff;
	max-height: 66vh;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.wa-ac-middle {
	min-width: 0;
}
.wa-ac-left::-webkit-scrollbar,
.wa-ac-right::-webkit-scrollbar,
.wa-ac-middle::-webkit-scrollbar {
	width: 8px;
}
.wa-ac-left::-webkit-scrollbar-thumb,
.wa-ac-right::-webkit-scrollbar-thumb,
.wa-ac-middle::-webkit-scrollbar-thumb {
	background: #d4d4d8;
	border-radius: 8px;
}

/* States (loading / no results / error) */
.wa-ac-state {
	grid-column: 1 / -1;
	padding: 28px 24px;
	color: var(--wa-ac-muted);
	text-align: center;
}

/* Block titles */
.wa-ac-block {
	margin-bottom: 16px;
}
.wa-ac-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--wa-ac-muted);
	margin: 0 0 9px;
}
.wa-ac-clear {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: none;
	color: var(--wa-ac-muted);
}
.wa-ac-clear:hover {
	color: var(--wa-ac-accent);
	text-decoration: underline;
}
/* "Produkty (N)" middle header — label + count stay together, left-aligned. */
.wa-ac-title--mid {
	justify-content: flex-start;
	gap: 5px;
}
.wa-ac-pcount {
	color: var(--wa-ac-muted);
	font-weight: 600;
}
/* Close (×) button in the categories header. */
.wa-ac-cats-head {
	align-items: flex-start;
}
.wa-ac-close {
	flex: none;
	width: 30px;
	height: 30px;
	margin: -6px -4px 0 0;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--wa-ac-soft);
	color: var(--wa-ac-ink);
	cursor: pointer;
	transition: background .15s ease;
}
.wa-ac-close svg {
	width: 16px;
	height: 16px;
}
.wa-ac-close:hover {
	background: var(--wa-ac-line);
}
/* Small brand icon in the brands list. */
.wa-ac-list.wa-ac-brands a {
	justify-content: flex-start;
}
.wa-ac-brand-ic {
	flex: none;
	display: inline-flex;
	width: 14px;
	height: 14px;
	color: var(--wa-ac-brand);
}
.wa-ac-brand-ic svg {
	width: 14px;
	height: 14px;
}

/* Pills (popular / promoted) */
.wa-ac-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.wa-ac-pill {
	display: inline-block;
	padding: 5px 11px;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	background: var(--wa-ac-soft);
	border: 1px solid var(--wa-ac-line);
	color: var(--wa-ac-ink);
	transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.wa-ac-pill:hover {
	border-color: var(--wa-ac-brand);
	color: var(--wa-ac-brand);
}
.wa-ac-pill--promoted {
	background: #fff;
	border-color: var(--wa-ac-brand);
	color: var(--wa-ac-brand);
	font-weight: 700;
}
.wa-ac-pill--recent {
	background: var(--wa-ac-soft);
	color: var(--wa-ac-ink);
}

/* Lists (brands / categories) */
.wa-ac-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.wa-ac-list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 0;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	color: var(--wa-ac-ink);
}
.wa-ac-list a:hover {
	color: var(--wa-ac-brand);
}
/* Categories get divider rows + a muted count (brands stay a plain list). */
.wa-ac-cats a {
	padding: 8px 0;
	border-bottom: 1px solid var(--wa-ac-line);
}
.wa-ac-count {
	font-size: 12.5px;
	font-weight: 500;
	color: var(--wa-ac-muted);
}

/* Products (middle) */
.wa-ac-products {
	display: flex;
	flex-direction: column;
}
.wa-ac-product {
	display: flex;
	align-items: center;
	gap: 8px;
	border-top: 1px solid var(--wa-ac-line);
}
.wa-ac-product:first-child {
	border-top: 0;
}
.wa-ac-product-link {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 6px;
	text-decoration: none;
	color: var(--wa-ac-ink);
	border-radius: 8px;
}
.wa-ac-product-link:hover,
.wa-ac-product-link.wa-ac-active {
	background: var(--wa-ac-soft);
}
/* Add-to-cart button — matches the product cards (lime --accent, "Do košíka"). */
.wa-ac-miniadd {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 13px;
	border: 0;
	border-radius: 8px;
	background: var( --accent, #a0c801 );
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.1;
	white-space: nowrap;
	cursor: pointer;
	transition: background .15s ease, opacity .15s ease;
}
.wa-ac-miniadd svg {
	width: 16px;
	height: 16px;
	flex: none;
}
.wa-ac-miniadd:hover {
	background: var( --accent-hover, #b7e401 );
}
.wa-ac-miniadd.is-done {
	background: var( --accent-hover, #b7e401 );
}
.wa-ac-miniadd.is-loading {
	opacity: .55;
	pointer-events: none;
}
@media ( max-width: 1100px ) {
	/* Tight middle column: drop the label, keep the icon as a compact button. */
	.wa-ac-miniadd-t {
		display: none;
	}
	.wa-ac-miniadd {
		padding: 8px 10px;
	}
}
.wa-ac-thumb {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	padding: 4px;
	background: var(--wa-ac-soft);
	border: 1px solid var(--wa-ac-line);
	border-radius: 9px;
	box-sizing: border-box;
}
.wa-ac-thumb img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}
.wa-ac-pinfo {
	flex: 1 1 auto;
	min-width: 0;
}
.wa-ac-pname {
	display: block;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.25;
}
.wa-ac-sku {
	display: block;
	font-size: 12px;
	color: var(--wa-ac-muted);
	margin-top: 1px;
}
.wa-ac-price {
	flex: 0 0 auto;
	font-weight: 700;
	font-size: 14px;
	color: var(--wa-ac-brand);
	white-space: nowrap;
	padding-left: 10px;
}
/* WooCommerce wraps the sale price in <ins> (underlined by default) and the old
   price in <del>. Force the current price to brand, the old one to muted. */
.wa-ac-price ins,
.wa-ac-price ins *,
.wa-ac-price .woocommerce-Price-amount {
	color: var(--wa-ac-brand);
	text-decoration: none;
	background: none;
}
.wa-ac-price del,
.wa-ac-price del * {
	font-weight: 400;
	font-size: 12.5px;
	color: var(--wa-ac-muted);
	margin-right: 6px;
}

/* Show all footer */
.wa-ac-showall {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	padding: 0;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	color: var(--wa-ac-brand);
	background: none;
	border: 0;
}
.wa-ac-showall svg {
	width: 15px;
	height: 15px;
}
.wa-ac-showall:hover,
.wa-ac-showall.wa-ac-active {
	color: var(--wa-ac-brand-hover);
	text-decoration: underline;
	background: none;
}

/* ---------------------------------------------------------------------------
   Header search structural shim.

   We dequeue FiboSearch's native CSS entirely. The theme's compiled header
   design (uploads/scorg/css/*-header-compiled.css) owns all the LOOK (colors,
   radius, border via box-shadow, icon fill, submit position) but assumes the
   base provides a few STRUCTURAL rules. We supply only those — nothing visual,
   so there's no conflict with the theme. Reference values match the layout
   FiboSearch's base produced.
--------------------------------------------------------------------------- */
/* !important: these structural rules must beat the theme's GLOBAL button/input
   styling (which otherwise leaves the submit a teal 50x34 box etc.). They set
   only layout/box props — orthogonal to the compiled header CSS, which owns
   position, radius, colors and the box-shadow ring — so there is no conflict. */
.wa-header-search .dgwt-wcas-search-wrapp,
.wa-header-search .dgwt-wcas-search-form,
.wa-header-search .dgwt-wcas-sf-wrapp {
	width: 100% !important;
}
.wa-header-search .dgwt-wcas-sf-wrapp {
	position: relative !important; /* anchor for the absolutely-positioned submit */
	box-sizing: border-box !important;
}
.wa-header-search .dgwt-wcas-search-input {
	width: 100% !important;
	box-sizing: border-box !important;
	border: 2px solid transparent !important; /* theme draws the ring via box-shadow */
	background: #fff !important;
	padding-block: 10px !important;           /* vertical only; theme sets padding-inline */
}
.wa-header-search .dgwt-wcas-search-submit {
	position: absolute !important;
	width: 33px !important;
	height: 33px !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 100% !important;
	background: transparent !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
}
.wa-header-search .dgwt-wcas-search-submit svg {
	max-width: 20px !important;
}
.wa-header-search .dgwt-wcas-voice-search,
.wa-header-search .dgwt-wcas-preloader {
	display: none !important;
}

/* Responsive: collapse columns on narrow viewports */
@media ( max-width: 880px ) {
	.wa-ac-box.wa-ac-open {
		grid-template-columns: 1fr;
		max-height: 80vh;
		overflow-y: auto;
	}
	.wa-ac-left,
	.wa-ac-right {
		border: 0;
		border-top: 1px solid var(--wa-ac-border);
	}
}
