/**
 * Product search (FEAT-07, UI-SPEC section 7). Replaces FiboSearch's stock stylesheet
 * (inc/search.php swaps the URL of `dgwt-wcas-style`). Tokens only, no colour or font literals (D-85).
 * Branding and Pro upsell are not part of free markup; anything the plugin might print is hidden.
 */

.dgwt-wcas-search-wrapp {
	position: relative;
	width: 100%;
	max-width: 720px;
	margin-inline: auto;
	color: var(--materli-color-text);
	font-family: var(--materli-font-body);
	font-size: var(--materli-text-body);
	line-height: var(--materli-leading-body);
}

.dgwt-wcas-search-wrapp *,
.dgwt-wcas-suggestions-wrapp * {
	box-sizing: border-box;
}

.dgwt-wcas-search-form,
.dgwt-wcas-sf-wrapp {
	position: relative;
	margin: 0;
}

.dgwt-wcas-search-wrapp .dgwt-wcas-search-input {
	display: block;
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 0 calc(var(--materli-hit) + var(--materli-space-sm)) 0 var(--materli-space-md);
	border: 1px solid var(--materli-color-control-border);
	border-radius: var(--materli-radius);
	background: var(--materli-color-surface);
	box-shadow: none;
	color: var(--materli-color-text);
	font: inherit;
	appearance: none;
}

.dgwt-wcas-search-wrapp .dgwt-wcas-search-input::placeholder {
	color: var(--materli-color-text-muted);
	opacity: 1;
}

.dgwt-wcas-search-wrapp .dgwt-wcas-search-input:focus {
	outline: 2px solid var(--materli-color-focus);
	outline-offset: 2px;
}

.dgwt-wcas-search-input::-webkit-search-cancel-button {
	appearance: none;
}

/* Without the submit button the magnifier is a decorative icon on the right edge. */
.dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier {
	position: absolute;
	top: 50%;
	inset-inline-end: var(--materli-space-md);
	width: 18px;
	height: 18px;
	max-width: none;
	transform: translateY(-50%);
	fill: var(--materli-color-text);
	pointer-events: none;
}

/* The real submit button (44px hit area) when the shortcode asks for it. */
.dgwt-wcas-search-wrapp .dgwt-wcas-search-submit {
	position: absolute;
	top: 2px;
	inset-inline-end: 2px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--materli-hit);
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--materli-color-text);
	cursor: pointer;
}

.dgwt-wcas-search-submit .dgwt-wcas-ico-magnifier {
	width: 18px;
	height: 18px;
	max-width: none;
	fill: currentcolor;
}

/* Loading: 14px spinner inside the field, static under reduced motion. */
.dgwt-wcas-preloader {
	position: absolute;
	top: 50%;
	inset-inline-end: calc(var(--materli-hit) + var(--materli-space-xs));
	display: none;
	width: 14px;
	height: 14px;
	margin-top: -7px;
	border: 2px solid var(--materli-color-border);
	border-top-color: var(--materli-color-text);
	border-radius: 50%;
}

.dgwt-wcas-search-wrapp.dgwt-wcas-processing .dgwt-wcas-preloader {
	display: block;
}

@media (prefers-reduced-motion: no-preference) {
	.dgwt-wcas-search-wrapp.dgwt-wcas-processing .dgwt-wcas-preloader {
		animation: materli-search-spin 0.8s linear infinite;
	}
}

@keyframes materli-search-spin {
	to {
		transform: rotate(360deg);
	}
}

.dgwt-wcas-voice-search,
.dgwt-wcas-search-icon,
.dgwt-wcas-search-icon-arrow,
.dgwt-wcas-icon-preloader,
.dgwt-wcas-close,
.dgwt-wcas-om-bar,
.dgwt-wcas-overlay-mobile,
.dgwt-wcas-premium-only,
.dgwt-wcas-powered-by {
	display: none !important;
}

/* Suggestions dropdown. */
.dgwt-wcas-suggestions-wrapp {
	z-index: 1000;
	margin-top: var(--materli-space-xs);
	border: 1px solid var(--materli-color-border);
	border-radius: var(--materli-radius);
	background: var(--materli-color-surface);
	box-shadow: var(--materli-shadow-raised);
	color: var(--materli-color-text);
	font-family: var(--materli-font-body);
	font-size: var(--materli-text-body);
	line-height: var(--materli-leading-body);
	overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
	.dgwt-wcas-suggestions-wrapp {
		animation: materli-search-fade var(--materli-motion);
	}
}

@keyframes materli-search-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion {
	display: flex;
	align-items: center;
	gap: var(--materli-space-md);
	min-height: 64px;
	padding: var(--materli-space-sm) var(--materli-space-md);
	border-bottom: 1px solid var(--materli-color-border);
	border-inline-start: 2px solid transparent;
	color: var(--materli-color-text);
	cursor: pointer;
	text-decoration: none;
}

.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion:hover,
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-selected {
	border-inline-start-color: var(--materli-color-text);
	background: var(--materli-color-surface-alt);
}

.dgwt-wcas-suggestion .dgwt-wcas-si {
	flex: none;
	width: 48px;
	height: 60px;
	background: var(--materli-color-surface-alt);
}

.dgwt-wcas-suggestion .dgwt-wcas-si img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dgwt-wcas-suggestion .dgwt-wcas-content-wrapp {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: space-between;
	gap: var(--materli-space-md);
	min-width: 0;
}

.dgwt-wcas-suggestion .dgwt-wcas-st {
	min-width: 0;
	font-size: var(--materli-text-body);
	font-weight: var(--materli-weight-regular);
}

.dgwt-wcas-suggestion .dgwt-wcas-st-title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.dgwt-wcas-suggestion .dgwt-wcas-st strong,
.dgwt-wcas-suggestion .dgwt-wcas-st b {
	font-weight: var(--materli-weight-strong);
}

.dgwt-wcas-suggestion .dgwt-wcas-st-breadcrumbs,
.dgwt-wcas-suggestion .dgwt-wcas-sku,
.dgwt-wcas-suggestion .dgwt-wcas-sd {
	display: block;
	color: var(--materli-color-text-muted);
	font-size: var(--materli-text-label);
	font-weight: var(--materli-weight-regular);
}

.dgwt-wcas-suggestion .dgwt-wcas-sp {
	flex: none;
	font-size: var(--materli-text-body);
	font-weight: var(--materli-weight-strong);
	text-align: end;
	white-space: nowrap;
}

.dgwt-wcas-suggestion .dgwt-wcas-sp del {
	color: var(--materli-color-text-muted);
	font-size: var(--materli-text-label);
	font-weight: var(--materli-weight-regular);
}

.dgwt-wcas-suggestion .dgwt-wcas-sp ins {
	background: transparent;
	text-decoration: none;
}

/* Sold out (D-163): a muted chip in place of the price, never danger colour. */
.materli-search-soldout {
	display: inline-block;
	padding: var(--materli-space-xs) var(--materli-space-sm);
	border-radius: var(--materli-radius);
	background: var(--materli-color-surface-alt);
	color: var(--materli-color-text-muted);
	font-size: var(--materli-text-label);
	font-weight: var(--materli-weight-strong);
}

.dgwt-wcas-suggestion:has(.materli-search-soldout) .dgwt-wcas-st-title {
	color: var(--materli-color-text-muted);
}

/* Category / headline rows. */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-headline,
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-headline-v2 {
	display: block;
	min-height: 0;
	padding: var(--materli-space-sm) var(--materli-space-md);
	background: var(--materli-color-surface-alt);
	color: var(--materli-color-text-muted);
	font-size: var(--materli-text-label);
	font-weight: var(--materli-weight-strong);
	cursor: default;
}

/* "Zobacz wszystkie wyniki" row. */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-more {
	justify-content: center;
	min-height: var(--materli-hit);
	border-bottom: 0;
	font-weight: var(--materli-weight-strong);
	text-align: center;
}

.dgwt-wcas-suggestion-more .dgwt-wcas-st-more {
	font-weight: var(--materli-weight-strong);
}

/* Empty and error rows are plain text, not links. */
.dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-nores {
	display: block;
	min-height: 0;
	padding: var(--materli-space-md);
	border-bottom: 0;
	cursor: default;
}

.dgwt-wcas-suggestion-nores:hover {
	border-inline-start-color: transparent;
	background: transparent;
}

.dgwt-wcas-suggestion-nores .dgwt-wcas-st {
	display: block;
	font-weight: var(--materli-weight-strong);
}

/* Header search panel (Blocksy modal, kept per the 06-02 spike): Blocksy's dark scrim stays, the field and list are on the shop surface. */
/* Top-aligned, so the suggestions list has the whole viewport below the field (Blocksy centres it). */
html body #search-modal .ct-panel-content {
	align-items: center;
	justify-content: flex-start;
	padding: 12vh var(--materli-space-md) 0;
}

html body #search-modal .dgwt-wcas-search-wrapp {
	margin-block: 0;
	max-width: 720px;
}

html body #search-modal .dgwt-wcas-search-input,
html body .materli-mobile-menu .dgwt-wcas-search-input {
	border: 1px solid var(--materli-color-control-border);
	background: var(--materli-color-surface);
	color: var(--materli-color-text);
}

html body #search-modal .dgwt-wcas-search-input:focus,
html body .materli-mobile-menu .dgwt-wcas-search-input:focus {
	border-color: var(--materli-color-control-border);
}

.materli-mobile-menu__search {
	padding: var(--materli-space-md);
	border-bottom: 1px solid var(--materli-color-border);
}

.materli-mobile-menu__search .dgwt-wcas-search-wrapp {
	max-width: none;
}

/* Inside the drawer suggestions render inline and scroll with it. */
.materli-mobile-menu .dgwt-wcas-suggestions-wrapp {
	position: static !important;
	width: 100% !important;
	margin-top: var(--materli-space-sm);
	box-shadow: none;
}

/* Empty / error copy added by assets/js/search.js. */
.dgwt-wcas-suggestion-nores .materli-search-hint {
	display: block;
	margin-top: var(--materli-space-xs);
	color: var(--materli-color-text-muted);
	font-size: var(--materli-text-label);
}

.dgwt-wcas-suggestion-nores .materli-search-shop {
	display: inline-flex;
	align-items: center;
	min-height: var(--materli-hit);
	color: var(--materli-color-text);
	text-decoration: underline;
}
