/* [wc_api_sync_product_search] — the search bar and its suggestions.
   Width and accent come from the shortcode via CSS variables on the form. */

.wcaps-search {
	--wcaps-search-width: 100%;
	--wcaps-search-accent: #0071dc;
	--wcaps-search-height: 58px;
	--wcaps-search-radius: 6px;
	--wcaps-search-border: 2px;
	position: relative;
	display: flex;
	align-items: stretch;
	box-sizing: border-box;
	width: var(--wcaps-search-width);
	max-width: 100%;
	height: var(--wcaps-search-height);
	margin: 0;
	padding: 0;
	background: #fff;
	border: var(--wcaps-search-border) solid var(--wcaps-search-accent);
	border-radius: var(--wcaps-search-radius);
	font-family: inherit;
	text-align: left;
}
.wcaps-search--center { margin-left: auto; margin-right: auto; }
.wcaps-search--right { margin-left: auto; }
.wcaps-search:focus-within { box-shadow: 0 0 0 4px rgba(68, 133, 202, 0.15); }

/* The input: fights the theme's own input styling on purpose. */
.wcaps-search__input,
.wcaps-search__input:focus,
.wcaps-search input[type="search"].wcaps-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 18px !important;
	border: 0 !important;
	border-radius: var(--wcaps-search-radius) 0 0 var(--wcaps-search-radius) !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	font-size: 17px;
	line-height: normal;
	color: #111827;
	-webkit-appearance: none;
	appearance: none;
}
.wcaps-search__input::placeholder { color: #9ca3af; opacity: 1; }
.wcaps-search__input::-webkit-search-decoration,
.wcaps-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* The button sits flush over the border, rounded on its outer corners. */
.wcaps-search__button,
.wcaps-search__button:hover,
.wcaps-search__button:focus {
	flex: 0 0 auto;
	position: relative;
	width: 76px;
	margin: calc(-1 * var(--wcaps-search-border)) calc(-1 * var(--wcaps-search-border)) calc(-1 * var(--wcaps-search-border)) 0;
	padding: 0;
	border: 0;
	border-radius: 0 var(--wcaps-search-radius) var(--wcaps-search-radius) 0;
	background: var(--wcaps-search-accent);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: none;
	transition: filter 0.15s ease;
}
.wcaps-search__button:hover { filter: brightness(1.08); }
.wcaps-search__button:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.wcaps-search__icon { display: block; }
.wcaps-search__spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2.5px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wcaps-search-spin 0.7s linear infinite;
}
.wcaps-search.is-busy .wcaps-search__icon { display: none; }
.wcaps-search.is-busy .wcaps-search__spinner { display: block; }
@keyframes wcaps-search-spin { to { transform: rotate(360deg); } }

/* Suggestions */
.wcaps-search__results {
	position: absolute;
	top: calc(100% + 8px);
	left: calc(-1 * var(--wcaps-search-border));
	right: calc(-1 * var(--wcaps-search-border));
	z-index: 9999;
	max-height: 70vh;
	overflow-y: auto;
	padding: 6px 0;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
	text-align: left;
}
.wcaps-search__list { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.wcaps-search__item { margin: 0 !important; padding: 0 !important; }
.wcaps-search__link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 16px;
	color: #111827 !important;
	text-decoration: none !important;
}
.wcaps-search__link:hover,
.wcaps-search__link.is-active { background: #f3f7fc; }
.wcaps-search__thumb {
	flex: 0 0 46px;
	width: 46px;
	height: 46px;
	object-fit: contain;
	border-radius: 4px;
	background: #f9fafb;
}
.wcaps-search__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wcaps-search__name {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.wcaps-search__mark { background: transparent; color: var(--wcaps-search-accent); font-weight: 700; padding: 0; }
.wcaps-search__meta { display: flex; gap: 12px; font-size: 12px; color: #6b7280; }
.wcaps-search__stock { color: #b91c1c; font-weight: 600; }
.wcaps-search__price { flex: 0 0 auto; font-size: 15px; font-weight: 700; color: #111827; white-space: nowrap; }
.wcaps-search__price del { margin-right: 6px; color: #9ca3af; font-weight: 400; }
.wcaps-search__price ins { text-decoration: none; }
.wcaps-search__more {
	display: block;
	margin-top: 4px;
	padding: 12px 16px;
	border-top: 1px solid #e5e7eb;
	text-align: center;
	font-weight: 600;
	color: var(--wcaps-search-accent) !important;
	text-decoration: none !important;
}
.wcaps-search__more:hover,
.wcaps-search__more.is-active { background: #f3f7fc; }
.wcaps-search__empty { padding: 18px 16px; color: #6b7280; text-align: center; }

@media (max-width: 640px) {
	.wcaps-search { --wcaps-search-height: 50px; }
	.wcaps-search__input { font-size: 16px; padding: 0 14px !important; }
	.wcaps-search__button { width: 60px; }
	.wcaps-search__name { white-space: normal; }
	.wcaps-search__price { font-size: 14px; }
}
