/* Woo AI Semantic Search — frontend styles */

.aiws-wrap,
.aiws-form {
	position: relative;
	max-width: 560px;
	width: 100%;
	font-size: 15px;
}

.aiws-field {
	position: relative;
	display: flex;
	align-items: center;
}

.aiws-input {
	width: 100%;
	padding: 11px 44px 11px 16px;
	border: 1px solid #cfd4dc;
	border-radius: 8px;
	background: #fff;
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.aiws-input:focus {
	outline: none;
	border-color: #6b7280;
	box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.15);
}

.aiws-submit {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #4b5563;
	cursor: pointer;
}

.aiws-submit:hover {
	background: #f3f4f6;
}

/* Loading spinner inside the input */
.aiws-spinner {
	position: absolute;
	right: 14px;
	top: 50%;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	border: 2px solid #d1d5db;
	border-top-color: #374151;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.1s ease;
}

.aiws-loading .aiws-spinner {
	opacity: 1;
	animation: aiws-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.aiws-loading .aiws-spinner {
		animation-duration: 1.6s;
	}
}

/* Dropdown */
.aiws-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 9999;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(17, 24, 39, 0.12);
	overflow: hidden;
}

.aiws-results {
	list-style: none;
	margin: 0;
	padding: 6px;
	max-height: 420px;
	overflow-y: auto;
}

.aiws-item {
	margin: 0;
	padding: 0;
}

.aiws-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
	transition: background 0.1s ease;
}

.aiws-link:hover,
.aiws-link:focus-visible,
.aiws-item.is-active .aiws-link {
	background: #f3f4f6;
}

/* "View all results" footer row */
.aiws-item--all .aiws-link {
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	color: #4b5563;
	border-top: 1px solid #e5e7eb;
	border-radius: 0;
	margin-top: 6px;
	padding-top: 10px;
	padding-bottom: 6px;
}

.aiws-thumb {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	border-radius: 6px;
	overflow: hidden;
	background: #f3f4f6;
}

.aiws-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.aiws-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.aiws-title {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aiws-price {
	font-size: 13px;
	color: #6b7280;
}

.aiws-price ins {
	text-decoration: none;
}

/* Content-type badge (taxonomy terms, posts, pages) */
.aiws-badge {
	font-size: 12px;
	color: #6b7280;
}

.aiws-item--term .aiws-link {
	padding: 7px 10px;
}

.aiws-item--term .aiws-title::before {
	content: '#';
	opacity: 0.45;
	margin-right: 2px;
}

.aiws-empty {
	padding: 16px;
	text-align: center;
	color: #6b7280;
	font-size: 14px;
}

/* ---------- Accent colour (set per instance via --aiws-accent) ---------- */
.aiws-wrap,
.aiws-form {
	--aiws-accent: #111827;
}

.aiws-input:focus {
	border-color: var(--aiws-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--aiws-accent) 18%, transparent);
}

.aiws-loading .aiws-spinner {
	border-top-color: var(--aiws-accent);
}

.aiws-link:hover .aiws-title,
.aiws-link:focus-visible .aiws-title,
.aiws-item.is-active .aiws-title {
	color: var(--aiws-accent);
}

/* ---------- Layout: input + inline icon (default) ---------- */
.aiws-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	display: inline-flex;
	color: var(--aiws-accent);
	pointer-events: none;
}

.aiws-wrap--input_icon .aiws-input {
	padding-left: 42px;
}

/* ---------- Layout: solid accent button ---------- */
.aiws-submit--solid {
	right: 6px;
	background: var(--aiws-accent);
	color: #fff;
	width: 38px;
	height: 36px;
}

.aiws-submit--solid:hover {
	filter: brightness(1.08);
	background: var(--aiws-accent);
}

.aiws-wrap--input_button .aiws-input {
	padding-right: 52px;
}

/* ---------- Layout: input + bordered magnifier button ---------- */
.aiws-submit--icon {
	right: 5px;
	width: 38px;
	height: 36px;
	border: 1px solid #cfd4dc;
	border-radius: 6px;
	background: #fff;
	color: var(--aiws-accent);
	transition: background 0.15s ease, border-color 0.15s ease;
}

.aiws-submit--icon:hover {
	background: #f3f4f6;
	border-color: var(--aiws-accent);
}

.aiws-wrap--input_icon_button .aiws-input {
	padding-right: 52px;
}

/* ---------- Layout: icon-only toggle ---------- */
.aiws-wrap--icon_toggle {
	max-width: none;
	display: inline-block;
	width: auto;
}

.aiws-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid #cfd4dc;
	border-radius: 8px;
	background: #fff;
	color: var(--aiws-accent);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.aiws-icon-btn:hover {
	background: #f3f4f6;
	border-color: var(--aiws-accent);
}

.aiws-field--collapsed {
	display: inline-flex;
	align-items: center;
}

.aiws-field--collapsed .aiws-reveal {
	position: relative;
	width: 0;
	overflow: hidden;
	opacity: 0;
	transition: width 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
}

.aiws-wrap--icon_toggle.aiws-open {
	width: 100%;
	max-width: 560px;
	display: block;
}

.aiws-wrap--icon_toggle.aiws-open .aiws-field--collapsed {
	display: flex;
	gap: 8px;
}

.aiws-wrap--icon_toggle.aiws-open .aiws-reveal {
	width: 100%;
	opacity: 1;
}

.aiws-wrap--icon_toggle .aiws-reveal .aiws-input {
	width: 100%;
}

@media (prefers-reduced-motion: reduce) {
	.aiws-field--collapsed .aiws-reveal {
		transition: none;
	}
}
