/* MS Live Search – khung tìm kiếm sản phẩm (theo trang mẫu MacStore 24h) */

/* Ẩn dropdown tìm kiếm mặc định của Flatsome, dùng khung của plugin thay thế */
.header-search .nav-dropdown { display: none !important; }

html.msls-open { overflow: hidden; }

.msls {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 96px 16px 16px;
	font-family: inherit;
	letter-spacing: normal;
}
.msls[hidden] { display: none; }
.msls-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.18s ease;
}
.msls-dialog {
	position: relative;
	width: 100%;
	max-width: 672px;
	max-height: calc(100vh - 112px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #e5e5e5;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
	color: var(--ms-ink, #171717);
	opacity: 0;
	transform: translateY(-8px) scale(0.98);
	transition: opacity 0.18s ease, transform 0.18s ease;
}
.msls.is-visible .msls-backdrop,
.msls.is-visible .msls-dialog { opacity: 1; }
.msls.is-visible .msls-dialog { transform: none; }

/* Ô nhập */
.msls-form {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 12px 16px;
	border-bottom: 1px solid #f5f5f5;
}
.msls-icon { flex-shrink: 0; color: #a1a1a1; }
.msls .msls-input {
	flex: 1;
	min-width: 0;
	height: 32px;
	margin: 0;
	padding: 0 4px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--ms-ink, #171717);
	font-size: 14px;
	line-height: 32px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}
.msls .msls-input::placeholder { color: #a1a1a1; opacity: 1; }
.msls .msls-input::-webkit-search-cancel-button { display: none; }
.msls button { min-width: 0; min-height: 0; margin: 0; font-family: inherit; letter-spacing: normal; text-transform: none; }
.msls-clear {
	display: inline-flex;
	padding: 4px;
	border: 0;
	background: none;
	color: #a1a1a1;
	line-height: 1;
	cursor: pointer;
}
.msls-clear:hover { color: var(--ms-ink, #171717); }
.msls-clear[hidden] { display: none; }
.msls-close {
	padding: 4px 8px;
	border: 0;
	border-radius: 4px;
	background: none;
	color: #737373;
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
	cursor: pointer;
}
.msls-close:hover { background: #f5f5f5; color: var(--ms-ink, #171717); }

/* Từ khóa hot */
.msls-hot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid #f5f5f5;
}
.msls-hot > span { flex-shrink: 0; color: #a1a1a1; font-size: 11px; font-weight: 500; white-space: nowrap; }
.msls-chip {
	padding: 4px 8px;
	border: 0;
	border-radius: 4px;
	background: #f5f5f5;
	color: #404040;
	font-size: 12px;
	line-height: 16px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}
.msls-chip:hover { background: var(--ms-ink, #171717); color: #fff; }

/* Kết quả */
.msls-body { position: relative; min-height: 0; overflow-y: auto; overscroll-behavior: contain; max-height: 384px; }
.msls-empty { padding: 40px 24px; color: #a1a1a1; text-align: center; }
.msls-empty svg { display: block; margin: 0 auto 8px; color: #d4d4d4; }
.msls-empty p,
.msls-status { margin: 0; color: #737373; font-size: 12px; line-height: 1.5; }
.msls-empty[hidden] { display: none; }
.msls-status:empty { display: none; }
.msls-status { padding: 32px 24px; text-align: center; }

.msls-results { margin: 0; padding: 4px 0; list-style: none; }
.msls-results[hidden] { display: none; }
.msls-results li { margin: 0; padding: 0; list-style: none; }
.msls-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 16px 12px 28px;
	border-bottom: 1px solid #fafafa;
	color: inherit;
	text-decoration: none;
	transition: background 0.12s;
}
.msls-item:hover,
.msls-item.is-active { background: #fafafa; color: inherit; }
.msls-item img {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	border: 1px solid #f5f5f5;
	border-radius: 8px;
	background: #f5f5f5;
	object-fit: cover;
}
.msls-info { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.msls-cat { color: #737373; font-size: 10px; font-weight: 700; line-height: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.msls-name {
	overflow: hidden;
	color: #262626;
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.msls-name mark { padding: 0; background: var(--ms-accent-50b, #fff1e6); color: var(--ms-accent, #f54a00); }
.msls-rating { display: inline-flex; align-items: center; gap: 4px; color: var(--ms-accent-bright-2, #ff6900); font-size: 11px; line-height: 16px; }

.msls-price {
	display: flex;
	flex-shrink: 0;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	color: var(--ms-accent, #f54a00);
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	text-align: right;
}
.msls-price del { order: 2; color: #a1a1a1; font-size: 10px; font-weight: 400; line-height: 13px; opacity: 1; }
.msls-price del .amount { color: inherit; }
.msls-price ins { order: 1; color: var(--ms-accent, #f54a00); text-decoration: none; }
.msls-price .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.msls-out { order: 3; color: #dc2626; font-size: 10px; font-weight: 600; }

.msls-all {
	position: sticky;
	bottom: 0;
	display: block;
	padding: 12px 16px;
	border-top: 1px solid #f5f5f5;
	background: #fff;
	color: var(--ms-ink, #171717);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.msls-all:hover { background: var(--ms-ink, #171717); color: #fff; }
.msls-all[hidden] { display: none; }

/* Đang tải: thanh chạy mảnh dưới ô nhập */
.msls-dialog:after {
	content: "";
	position: absolute;
	top: 56px;
	left: 0;
	width: 30%;
	height: 2px;
	background: var(--ms-accent, #f54a00);
	opacity: 0;
	pointer-events: none;
}
.msls.is-loading .msls-dialog:after { opacity: 1; animation: msls-loading 0.9s ease-in-out infinite; }
@keyframes msls-loading { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

@media (max-width: 639px) {
	.msls { padding: 64px 12px 12px; }
	.msls-dialog { max-height: calc(100vh - 76px); }
	.msls-body { max-height: none; }
	.msls-hot { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.msls-hot::-webkit-scrollbar { display: none; }
	.msls-chip { flex-shrink: 0; }
	.msls-item { padding: 12px 14px; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.msls-backdrop,
	.msls-dialog { transition: none; }
	.msls.is-loading .msls-dialog:after { animation: none; }
}
