/**
 * Smart search dropdown (inc/search.php, assets/js/search.js). Tokens come from .tp-hdr (header.css).
 * Compact on purpose: chips for categories/tags, 36px product rows.
 * Chip colours (TPTrue palette): category = brand blue, tag = emerald, recent = neutral.
 */

.tp-suggest {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 30;
	max-height: min(75vh, 460px);
	padding: 8px;
	overflow-y: auto;
	text-align: left;
	background: #fff;
	border-radius: 16px;
	box-shadow: inset 0 0 0 1px var(--tp-border), 0 12px 32px rgba(31, 49, 71, 0.14);
}

.tp-suggest[hidden] {
	display: none;
}

.tp-suggest__group {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 4px 4px 6px;
}

.tp-suggest__label {
	flex: none;
	min-width: 64px;
	padding-top: 5px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--tp-muted);
}

.tp-suggest__label--pad {
	padding: 4px 8px 2px;
}

.tp-suggest__chips {
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	gap: 6px;
}

/* ---------- chips ---------- */

.tp-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	max-width: 100%;
	padding: 4px 10px;
	font-size: 13px;
	font-weight: 500;
	line-height: 20px;
	color: var(--tp-ink);
	text-decoration: none;
	cursor: pointer;
	background: var(--tp-surface);
	border-radius: var(--tp-r-pill);
	transition: background-color 0.15s var(--tp-ease), box-shadow 0.15s var(--tp-ease);
}

.tp-chip .tp-icon {
	flex: none;
	width: 14px;
	height: 14px;
}

.tp-chip > span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tp-chip b {
	font-size: 11px;
	font-weight: 600;
	opacity: 0.7;
}

.tp-chip mark,
.tp-suggest__name mark {
	font-weight: 700;
	color: inherit;
	background: none;
}

.tp-chip--cat {
	color: #0e4ae0;
	background: #e8efff;
}

.tp-chip--cat:hover,
.tp-chip--cat.is-active {
	background: #d3e0ff;
}

.tp-chip--tag {
	color: #0f6b3e;
	background: #def5e8;
}

.tp-chip--tag:hover,
.tp-chip--tag.is-active {
	background: #c5ecd5;
}

.tp-chip--recent:hover,
.tp-chip--recent.is-active {
	background: #e6ebf5;
}

.tp-chip__rm {
	display: grid;
	place-items: center;
	width: 16px;
	height: 16px;
	margin-right: -4px;
	padding: 0;
	color: var(--tp-muted);
	cursor: pointer;
	background: none;
	border: 0;
	border-radius: 50%;
}

.tp-chip__rm:hover {
	color: var(--tp-ink);
	background: #fff;
}

.tp-chip.is-active,
.tp-suggest__all.is-active {
	box-shadow: 0 0 0 2px var(--tp-primary);
}

.tp-suggest__row.is-active {
	background: var(--tp-surface);
	box-shadow: inset 2px 0 0 var(--tp-primary);
}

/* ---------- misc text ---------- */

.tp-suggest__clear,
.tp-suggest__fix {
	padding: 0;
	font: inherit;
	color: var(--tp-primary);
	cursor: pointer;
	background: none;
	border: 0;
}

.tp-suggest__clear {
	margin-left: 6px;
	font-size: 11px;
	letter-spacing: 0;
	text-transform: none;
}

.tp-suggest__fix {
	font-weight: 600;
	text-decoration: underline;
}

.tp-suggest__note,
.tp-suggest__empty {
	padding: 8px 10px;
	font-size: 13px;
	color: var(--tp-muted);
}

.tp-suggest__empty strong {
	color: var(--tp-ink);
}

/* ---------- product rows ---------- */

.tp-suggest__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2px 6px;
}

.tp-suggest__row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 3px 8px;
	color: var(--tp-ink);
	text-decoration: none;
	border-radius: 8px;
}

.tp-suggest__row:hover {
	background: var(--tp-surface);
}

.tp-suggest__thumb {
	flex: none;
	width: 40px;
	height: 40px;
	overflow: hidden;
	background: var(--tp-surface);
	border-radius: 8px;
}

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

.tp-suggest__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.tp-suggest__name {
	min-width: 0;
	overflow: hidden;
	font-size: 13.5px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tp-suggest__price {
	font-size: 12.5px;
	font-weight: 400;
	color: var(--tp-muted);
}

.tp-suggest__price del {
	margin-right: 4px;
	color: var(--tp-muted);
}

.tp-suggest__price ins {
	text-decoration: none;
}

.tp-suggest__all {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
	padding: 8px 10px;
	font-size: 13px;
	color: var(--tp-ink);
	cursor: pointer;
	border-top: 1px solid var(--tp-hairline);
	border-radius: 0 0 10px 10px;
}

.tp-suggest__all:hover {
	background: var(--tp-surface);
}

.tp-suggest__all .tp-icon {
	width: 16px;
	height: 16px;
	color: var(--tp-muted);
}

@media (max-width: 640px) {
	.tp-suggest__list {
		grid-template-columns: minmax(0, 1fr);
	}

	.tp-suggest__group {
		flex-direction: column;
		gap: 2px;
	}

	.tp-suggest__label {
		min-width: 0;
		padding-top: 0;
	}
}
