/**
 * DS Elements — Tìm kiếm sản phẩm (header)
 * Thanh tìm kiếm position:fixed bám đáy header (JS đặt `top`), rộng hết màn,
 * nội dung chặn 720px ở giữa.
 */

.ds-ps {
	--ds-ps-icon-color: var(--ds-color-brand);
	--ds-ps-icon-size: 22px;
}

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

/* Icon nét viền tự vẽ: thoát rule svg { fill: currentColor } */
.ds-ps .ds-ps__icon {
	width: var(--ds-ps-icon-size);
	height: var(--ds-ps-icon-size);
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
}

.ds-ps .ds-ps__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--ds-space-2);
	border: 0;
	border-radius: var(--ds-radius-pill);
	background: transparent;
	color: var(--ds-ps-icon-color);
	cursor: pointer;
	transition: color var(--ds-transition);
}

.ds-ps .ds-ps__toggle:hover,
.ds-ps.is-open .ds-ps__toggle {
	color: var(--ds-color-brand-light);
}

.ds-ps__panel {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 9999;
	padding: var(--ds-space-6) var(--ds-space-4);
	background: var(--ds-color-white);
	border-top: 1px solid var(--ds-color-border);
	box-shadow: var(--ds-shadow-raised);
}

.ds-ps__panel[hidden] {
	display: none;
}

.ds-ps__inner {
	max-width: 720px;
	margin: 0 auto;
}

.ds-ps__form {
	display: flex;
	align-items: center;
	gap: var(--ds-space-2);
	padding: var(--ds-space-1) var(--ds-space-1) var(--ds-space-1) var(--ds-space-4);
	border: 1px solid var(--ds-color-border);
	border-radius: var(--ds-radius-pill);
	background: var(--ds-color-white);
	transition: border-color var(--ds-transition);
}

.ds-ps__form:focus-within {
	border-color: var(--ds-color-brand-light);
}

.ds-ps .ds-ps__icon--field {
	--ds-ps-icon-size: 18px;
	flex: none;
	color: var(--ds-color-muted);
}

.ds-ps .ds-ps__input {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ds-color-heading);
	font-size: var(--ds-fs-body);
	outline: none;
	box-shadow: none;
}

.ds-ps .ds-ps__input::-webkit-search-cancel-button {
	display: none;
}

/* Bộ chọn 2 lớp để thắng button[class*="ds-"]:hover { transparent } ở tokens.css */
.ds-ps .ds-ps__submit,
.ds-ps .ds-ps__submit:hover,
.ds-ps .ds-ps__submit:focus {
	flex: none;
	height: 44px;
	padding: 0 var(--ds-space-6);
	border: 0;
	border-radius: var(--ds-radius-pill);
	background-color: var(--ds-color-brand);
	color: var(--ds-color-white);
	font-size: var(--ds-fs-button);
	font-weight: var(--ds-fw-semibold);
	letter-spacing: var(--ds-ls-button);
	text-transform: uppercase;
	cursor: pointer;
}

.ds-ps .ds-ps__submit:hover {
	background-color: var(--ds-color-brand-light);
}

.ds-ps .ds-ps__close {
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: var(--ds-radius-pill);
	background: transparent;
	color: var(--ds-color-muted);
	font-size: var(--ds-fs-h3);
	line-height: 1;
	cursor: pointer;
}

.ds-ps .ds-ps__close:hover {
	color: var(--ds-color-heading);
}

.ds-ps__results:empty {
	display: none;
}

.ds-ps__results {
	margin-top: var(--ds-space-4);
	transition: opacity var(--ds-transition);
}

.ds-ps.is-loading .ds-ps__results {
	opacity: .5;
}

.ds-ps__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--ds-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ds-ps__item {
	display: flex;
	align-items: center;
	gap: var(--ds-space-3);
	padding: var(--ds-space-2);
	border-radius: var(--ds-radius-md);
	color: var(--ds-color-heading);
	text-decoration: none;
	transition: background-color var(--ds-transition);
}

.ds-ps__item:hover,
.ds-ps__item:focus-visible {
	background: var(--ds-color-surface);
}

.ds-ps__thumb {
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: var(--ds-radius-sm);
	background: var(--ds-color-surface);
	object-fit: cover;
}

.ds-ps__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ds-ps__name {
	overflow: hidden;
	font-size: var(--ds-fs-small);
	font-weight: var(--ds-fw-semibold);
	line-height: var(--ds-lh-tight);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ds-ps__cat {
	color: var(--ds-color-muted);
	font-size: var(--ds-fs-small);
	line-height: var(--ds-lh-small);
}

.ds-ps__all {
	display: inline-block;
	margin-top: var(--ds-space-3);
	color: var(--ds-color-brand-light);
	font-size: var(--ds-fs-small);
	font-weight: var(--ds-fw-semibold);
	text-decoration: none;
}

.ds-ps__all:hover {
	text-decoration: underline;
}

.ds-ps__empty {
	margin: 0;
	color: var(--ds-color-body);
	font-size: var(--ds-fs-small);
}

@media (max-width: 767px) {
	.ds-ps__list {
		grid-template-columns: minmax(0, 1fr);
	}

	.ds-ps .ds-ps__submit {
		padding: 0 var(--ds-space-4);
	}
}
