/**
 * WooCommerce Search & Categories
 * Front-end styles.
 *
 * All colours/spacing are driven by CSS variables on :root so you can
 * override them in your theme's stylesheet without editing this file.
 */

:root {
	--woosearch-accent: #2563eb;
	--woosearch-accent-hover: #1d4ed8;
	--woosearch-bg: #ffffff;
	--woosearch-bg-muted: #f5f7fa;
	--woosearch-border: #e2e8f0;
	--woosearch-text: #1e293b;
	--woosearch-text-muted: #64748b;
	--woosearch-radius: 12px;
	--woosearch-radius-sm: 8px;
	--woosearch-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
	--woosearch-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
	--woosearch-transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------------------------------------------------------------------
 * Search bar
 * ------------------------------------------------------------------------ */

.woosearch {
	position: relative;
	width: 100%;
	max-width: 100%;   /* fill whatever container it is placed in */
	height: 100%;      /* fill the container's height when one is set */
	font-family: inherit;
	box-sizing: border-box;
}

.woosearch *,
.woosearch *::before,
.woosearch *::after {
	box-sizing: border-box;
}

.woosearch__form {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	height: 100%;
	background: var(--woosearch-bg);
	border: 1px solid var(--woosearch-border);
	border-radius: var(--woosearch-radius);
	box-shadow: var(--woosearch-shadow-sm);
	transition: border-color var(--woosearch-transition), box-shadow var(--woosearch-transition);
	margin: 0;
}

.woosearch__form:focus-within {
	border-color: var(--woosearch-accent);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.woosearch__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	padding-left: 14px;
	color: var(--woosearch-text-muted);
	background: transparent; /* guard against theme backgrounds */
	pointer-events: none;
}

/*
 * Keep our icons as clean outlines. Some themes add a global
 * `svg { fill: currentColor }` rule which (being CSS) overrides the
 * inline fill="none" attribute and turns the icons into solid dark
 * blobs — the "black box" some themes produce. These rules win it back.
 */
.woosearch__icon svg,
.woosearch__clear svg {
	fill: none !important;
	stroke: currentColor;
	background: transparent;
}

/*
 * Scoped under .woosearch and marked !important so the black outline some
 * themes draw around inputs (e.g. `input[type="search"] { border: 1px solid }`,
 * which beats a single-class `border: none`) cannot show through. The border,
 * outline and any inset box-shadow are all suppressed in every state.
 */
.woosearch .woosearch__input,
.woosearch .woosearch__input:hover,
.woosearch .woosearch__input:focus,
.woosearch .woosearch__input:focus-visible,
.woosearch .woosearch__input:active {
	flex: 1 1 auto;
	width: 100%;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	padding: 13px 14px;
	font-size: 15px;
	color: var(--woosearch-text);
	line-height: 1.4;
	border-radius: 0;
	-webkit-appearance: none;
	appearance: none;
}

.woosearch__input::placeholder {
	color: var(--woosearch-text-muted);
	opacity: 1;
}

/*
 * Strip ALL native search-field decorations across browsers. Any of
 * these can render as a small dark square/button inside the field;
 * we supply our own clear button instead.
 */
.woosearch__input::-webkit-search-cancel-button,
.woosearch__input::-webkit-search-decoration,
.woosearch__input::-webkit-search-results-button,
.woosearch__input::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.woosearch__input::-ms-clear,
.woosearch__input::-ms-reveal {
	display: none;
	width: 0;
	height: 0;
}

/*
 * Scoped under .woosearch to raise specificity above common theme
 * rules like `.woocommerce button { background: #000 }`, which would
 * otherwise paint a dark box over our clear button.
 */
.woosearch .woosearch__clear {
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	box-shadow: none;
	color: var(--woosearch-text-muted);
	cursor: pointer;
	padding: 6px;
	margin-right: 8px;
	border-radius: 50%;
	transition: background var(--woosearch-transition), color var(--woosearch-transition);
}

.woosearch .woosearch__clear:hover {
	background: var(--woosearch-bg-muted);
	color: var(--woosearch-text);
}

.woosearch__clear[hidden] {
	display: none;
}

/* Results dropdown */
.woosearch__results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 999;
	background: var(--woosearch-bg);
	border: 1px solid var(--woosearch-border);
	border-radius: var(--woosearch-radius);
	box-shadow: var(--woosearch-shadow);
	overflow: hidden;
	max-height: 70vh;
	overflow-y: auto;
	animation: woosearch-fade-in var(--woosearch-transition);
}

.woosearch__results[hidden] {
	display: none;
}

@keyframes woosearch-fade-in {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.woosearch-result {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	text-decoration: none;
	color: var(--woosearch-text);
	transition: background var(--woosearch-transition);
	border-bottom: 1px solid var(--woosearch-border);
}

.woosearch-result:last-of-type {
	border-bottom: none;
}

.woosearch-result:hover,
.woosearch-result.is-active {
	background: var(--woosearch-bg-muted);
}

.woosearch-result__image {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: var(--woosearch-radius-sm);
	object-fit: cover;
	background: var(--woosearch-bg-muted);
	border: 1px solid var(--woosearch-border);
}

.woosearch-result__body {
	flex: 1 1 auto;
	min-width: 0;
}

.woosearch-result__title {
	display: block;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin: 0 0 2px;
	color: var(--woosearch-text);
}

.woosearch-result__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	color: var(--woosearch-text-muted);
}

.woosearch-result__price {
	font-weight: 600;
	color: var(--woosearch-accent);
}

.woosearch-result__price del {
	color: var(--woosearch-text-muted);
	font-weight: 400;
	margin-right: 4px;
}

.woosearch-result__category {
	position: relative;
	padding-left: 8px;
}

.woosearch-result__category::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: var(--woosearch-text-muted);
}

/* States: loading, empty, footer */
.woosearch__state {
	padding: 18px 14px;
	text-align: center;
	color: var(--woosearch-text-muted);
	font-size: 14px;
}

.woosearch__footer {
	display: block;
	padding: 12px 14px;
	text-align: center;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--woosearch-accent);
	text-decoration: none;
	background: var(--woosearch-bg-muted);
	transition: background var(--woosearch-transition), color var(--woosearch-transition);
}

.woosearch__footer:hover {
	background: var(--woosearch-accent);
	color: #fff;
}

.woosearch-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid var(--woosearch-border);
	border-top-color: var(--woosearch-accent);
	border-radius: 50%;
	animation: woosearch-spin 0.7s linear infinite;
	vertical-align: middle;
	margin-right: 8px;
}

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

/* ---------------------------------------------------------------------------
 * Category sidebar
 * ------------------------------------------------------------------------ */

.woosearch-categories {
	font-family: inherit;
	color: var(--woosearch-text);
	background: var(--woosearch-bg);
	border: 1px solid var(--woosearch-border);
	border-radius: var(--woosearch-radius);
	box-shadow: var(--woosearch-shadow-sm);
	padding: 8px;
	box-sizing: border-box;
}

.woosearch-categories *,
.woosearch-categories *::before,
.woosearch-categories *::after {
	box-sizing: border-box;
}

.woosearch-categories__title {
	font-size: 16px;
	font-weight: 700;
	margin: 8px 12px 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--woosearch-border);
	color: var(--woosearch-text);
}

.woosearch-categories__list,
.woosearch-categories__sublist {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woosearch-categories__row {
	display: flex;
	align-items: stretch;
	border-radius: var(--woosearch-radius-sm);
	transition: background var(--woosearch-transition);
}

.woosearch-categories__row:hover {
	background: var(--woosearch-bg-muted);
}

.woosearch-categories__link {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 12px;
	text-decoration: none;
	color: var(--woosearch-text);
	font-size: 14.5px;
	line-height: 1.35;
	border-radius: var(--woosearch-radius-sm);
	transition: color var(--woosearch-transition);
}

.woosearch-categories__link:hover .woosearch-categories__name {
	color: var(--woosearch-accent);
}

.woosearch-categories__name {
	transition: color var(--woosearch-transition);
}

.woosearch-categories__count {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 600;
	color: var(--woosearch-text-muted);
	background: var(--woosearch-bg-muted);
	border-radius: 999px;
	padding: 2px 9px;
	min-width: 26px;
	text-align: center;
}

/* Toggle button for expandable branches */
.woosearch-categories__toggle {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	border: none;
	background: transparent;
	color: var(--woosearch-text-muted);
	cursor: pointer;
	border-radius: var(--woosearch-radius-sm);
	transition: color var(--woosearch-transition), transform var(--woosearch-transition);
}

.woosearch-categories__toggle svg {
	transition: transform var(--woosearch-transition);
}

.woosearch-categories__toggle:hover {
	color: var(--woosearch-accent);
}

.woosearch-categories__item.is-open > .woosearch-categories__row .woosearch-categories__toggle svg {
	transform: rotate(180deg);
}

/* Nested list: hidden by default, revealed when parent is .is-open */
.woosearch-categories__sublist {
	display: none;
	margin-left: 12px;
	padding-left: 8px;
	border-left: 2px solid var(--woosearch-border);
}

.woosearch-categories__item.is-open > .woosearch-categories__sublist {
	display: block;
}

/* Current category highlight */
.woosearch-categories__item.is-current > .woosearch-categories__row {
	background: rgba(37, 99, 235, 0.1);
}

.woosearch-categories__item.is-current > .woosearch-categories__row .woosearch-categories__name {
	color: var(--woosearch-accent);
	font-weight: 700;
}

.woosearch-categories__item.is-current > .woosearch-categories__row .woosearch-categories__count {
	background: var(--woosearch-accent);
	color: #fff;
}

/* ---------------------------------------------------------------------------
 * Accessibility helper
 * ------------------------------------------------------------------------ */

.woosearch .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------------
 * Brands filter (multi-select checkboxes)
 * ------------------------------------------------------------------------ */

.woosearch-brands {
	font-family: inherit;
	color: var(--woosearch-text);
	background: var(--woosearch-bg);
	border: 1px solid var(--woosearch-border);
	border-radius: var(--woosearch-radius);
	box-shadow: var(--woosearch-shadow-sm);
	padding: 8px;
	box-sizing: border-box;
}

.woosearch-brands *,
.woosearch-brands *::before,
.woosearch-brands *::after {
	box-sizing: border-box;
}

.woosearch-brands__title {
	font-size: 16px;
	font-weight: 700;
	margin: 8px 12px 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--woosearch-border);
	color: var(--woosearch-text);
}

.woosearch-brands__form {
	margin: 0;
}

.woosearch-brands__search {
	padding: 0 4px 8px;
}

.woosearch-brands__filter {
	width: 100%;
	border: 1px solid var(--woosearch-border);
	border-radius: var(--woosearch-radius-sm);
	padding: 8px 10px;
	font-size: 14px;
	color: var(--woosearch-text);
	background: var(--woosearch-bg);
	outline: none;
	transition: border-color var(--woosearch-transition), box-shadow var(--woosearch-transition);
}

.woosearch-brands__filter:focus {
	border-color: var(--woosearch-accent);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.woosearch-brands__list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 320px;
	overflow-y: auto;
}

.woosearch-brands__item {
	margin: 0;
}

.woosearch-brands__item.is-hidden {
	display: none;
}

.woosearch-brands__label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-radius: var(--woosearch-radius-sm);
	cursor: pointer;
	font-size: 14.5px;
	line-height: 1.35;
	transition: background var(--woosearch-transition);
}

.woosearch-brands__label:hover {
	background: var(--woosearch-bg-muted);
}

.woosearch-brands__checkbox {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
	accent-color: var(--woosearch-accent);
}

.woosearch-brands__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.woosearch-brands__label:hover .woosearch-brands__name {
	color: var(--woosearch-accent);
}

.woosearch-brands__count {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 600;
	color: var(--woosearch-text-muted);
	background: var(--woosearch-bg-muted);
	border-radius: 999px;
	padding: 2px 9px;
	min-width: 26px;
	text-align: center;
}

.woosearch-brands__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 8px 6px;
	margin-top: 6px;
	border-top: 1px solid var(--woosearch-border);
}

.woosearch-brands .woosearch-brands__apply {
	flex: 0 0 auto;
	border: none;
	background: var(--woosearch-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	padding: 9px 18px;
	border-radius: var(--woosearch-radius-sm);
	cursor: pointer;
	box-shadow: none;
	transition: background var(--woosearch-transition);
}

.woosearch-brands .woosearch-brands__apply:hover {
	background: var(--woosearch-accent-hover);
}

.woosearch-brands__clear {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--woosearch-text-muted);
	text-decoration: none;
	transition: color var(--woosearch-transition);
}

.woosearch-brands__clear:hover {
	color: var(--woosearch-accent);
}

/* ---------------------------------------------------------------------------
 * Unified appearance: Categories + Brands share the SAME black text and font.
 * Uses the design-token variables (so the colour is easy to change here) plus
 * !important, so a theme's link colour / button background / link font cannot
 * make the two widgets look different from each other.
 * ------------------------------------------------------------------------ */
.woosearch-categories,
.woosearch-brands {
	--woosearch-text: #000000;
	--woosearch-accent: #000000;
	--woosearch-accent-hover: #000000;
}

/* Titles */
.woosearch-categories .woosearch-categories__title,
.woosearch-brands .woosearch-brands__title {
	color: var(--woosearch-text) !important;
	font-family: inherit !important;
}

/* All row text: links, names, counts, labels, filter box, clear link */
.woosearch-categories .woosearch-categories__link,
.woosearch-categories .woosearch-categories__name,
.woosearch-categories .woosearch-categories__count,
.woosearch-categories .woosearch-categories__toggle,
.woosearch-brands .woosearch-brands__label,
.woosearch-brands .woosearch-brands__name,
.woosearch-brands .woosearch-brands__count,
.woosearch-brands .woosearch-brands__filter,
.woosearch-brands .woosearch-brands__clear {
	color: var(--woosearch-text) !important;
	font-family: inherit !important;
	font-weight: 400 !important;
}

/* Keep hover and current-selection text black too (no accent colour) */
.woosearch-categories .woosearch-categories__link:hover .woosearch-categories__name,
.woosearch-categories .woosearch-categories__item.is-current > .woosearch-categories__row .woosearch-categories__name,
.woosearch-brands .woosearch-brands__label:hover .woosearch-brands__name {
	color: var(--woosearch-text) !important;
	font-weight: 400 !important;
}

/* Toggle chevron: transparent button + black icon (kills the theme's orange box) */
.woosearch-categories .woosearch-categories__toggle {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
}

/* Current category row: neutral grey highlight instead of blue */
.woosearch-categories .woosearch-categories__item.is-current > .woosearch-categories__row {
	background: var(--woosearch-bg-muted) !important;
}

/* Count badges: identical light pill + black text in both widgets */
.woosearch-categories .woosearch-categories__count,
.woosearch-brands .woosearch-brands__count {
	background: var(--woosearch-bg-muted) !important;
	color: var(--woosearch-text) !important;
}

/* Brands "Apply" button: solid black to match */
.woosearch-brands .woosearch-brands__apply {
	background: var(--woosearch-accent) !important;
	color: #ffffff !important;
}

/* ---------------------------------------------------------------------------
 * Hide the product-count numbers beside category and brand names.
 * ------------------------------------------------------------------------ */
.woosearch-categories__count,
.woosearch-brands__count {
	display: none !important;
}
