/* ===== Ô tìm kiếm Typesense trong header ===== */
.nhabe-ts-form {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	background: #fff;
	border: 1px solid #e3e3e3;
	border-radius: 4px;
	overflow: visible;
}
.nhabe-ts-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	padding: 0 12px;
	border: 0 !important;
	outline: 0;
	background: transparent;
	font-size: 14px;
	box-shadow: none !important;
	margin: 0 !important;
}
.nhabe-ts-submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 40px;
	border: 0;
	background: transparent;
	color: #333;
	cursor: pointer;
	padding: 0;
}
.nhabe-ts-submit:hover { color: #000; }

/* ===== Dropdown kết quả ===== */
.nhabe-ts-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 9999;
	max-height: 70vh;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #e3e3e3;
	border-radius: 6px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
	padding: 6px 0;
	text-align: left;
}
.nhabe-ts-dropdown[hidden] { display: none; }

.nhabe-ts-loading,
.nhabe-ts-empty {
	padding: 16px;
	color: #888;
	font-size: 14px;
	text-align: center;
}

.nhabe-ts-group { padding: 4px 0; }
.nhabe-ts-group + .nhabe-ts-group { border-top: 1px solid #f0f0f0; }
.nhabe-ts-group-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 14px 4px;
}
.nhabe-ts-group-title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #7a7a7a;
}
.nhabe-ts-group-count {
	font-size: 11px;
	color: #aaa;
	background: #f4f4f4;
	border-radius: 10px;
	padding: 1px 8px;
}

.nhabe-ts-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 14px;
	color: #222 !important;
	text-decoration: none !important;
	line-height: 1.35;
}
.nhabe-ts-item:hover,
.nhabe-ts-item.is-active { background: #f6f8f4; }

.nhabe-ts-thumb {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	overflow: hidden;
	background: #f2f2f2;
	display: flex;
	align-items: center;
	justify-content: center;
}
.nhabe-ts-thumb img { width: 100%; height: 100%; object-fit: cover; }

.nhabe-ts-item-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
}
.nhabe-ts-item-title {
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.nhabe-ts-item-sub { font-size: 12px; margin-top: 1px; }
.nhabe-ts-price { color: #7ab51d; font-weight: 600; }
.nhabe-ts-meta { color: #999; }

.nhabe-ts-all {
	display: block;
	padding: 10px 14px;
	margin-top: 4px;
	border-top: 1px solid #f0f0f0;
	color: #7ab51d !important;
	font-weight: 600;
	font-size: 13px;
	text-decoration: none !important;
}
.nhabe-ts-all:hover { background: #f6f8f4; }

/* ===== Trang kết quả /tim-kiem ===== */
.nhabe-ts-results { max-width: 1200px; margin: 0 auto; }
.nhabe-ts-results-head { margin-bottom: 18px; }
.nhabe-ts-results-head h2 { margin: 0 0 6px; font-size: 22px; }
.nhabe-ts-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 14px 0 22px;
}
.nhabe-ts-tab {
	margin: 0;
	border: 1px solid #ddd;
	background: #fff;
	border-radius: 20px;
	padding: 6px 14px;
	font-size: 13px;
	cursor: pointer;
	color: #333;
}
.nhabe-ts-tab.is-active { background: #7ab51d; border-color: #7ab51d; color: #fff; }

.nhabe-ts-results .nhabe-ts-group { border: 0; padding: 0 0 26px; }
.nhabe-ts-results .nhabe-ts-group-head { padding: 0 0 10px; }
.nhabe-ts-results .nhabe-ts-group-title { font-size: 15px; color: #222; }
.nhabe-ts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 10px;
}
.nhabe-ts-results .nhabe-ts-item {
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 10px;
}
.nhabe-ts-results .nhabe-ts-thumb { width: 56px; height: 56px; }

@media (max-width: 600px) {
	.nhabe-ts-grid { grid-template-columns: 1fr; }
}

/* ===== Desktop: khung search header vừa phải, không kéo dài cả header ===== */
@media (min-width: 850px) {
	li.header-search-form.search-form {
		max-width: 440px;
	}
}

/* ===== Mobile: khung search header không tràn ra ngoài màn hình ===== */
@media (max-width: 849px) {
	/* Dropdown search của Flatsome mặc định neo lệch phải và rộng cố định 280px
	   -> tràn khỏi mép phải. Neo mép phải + giới hạn bề rộng theo viewport. */
	.header-search.header-search-dropdown > .nav-dropdown {
		left: auto !important;
		right: 0 !important;
		width: calc(100vw - 72px) !important;
		max-width: 360px !important;
		min-width: 0 !important;
	}
	.header-search.header-search-dropdown > .nav-dropdown:before,
	.header-search.header-search-dropdown > .nav-dropdown:after {
		left: auto !important;
		right: 14px !important;
	}
	.nhabe-ts-dropdown { max-height: 62vh; }
	.nhabe-ts-item-title { white-space: normal; }

	/* Trang kết quả /tim-kiem sát mép -> thêm lề hai bên */
	.nhabe-ts-results { padding-left: 15px; padding-right: 15px; }
}
