/*!
 * Tonys Quick Search v1.0.0 — tác giả tonysquang
 */
.tqs, .tqs *, .tqs-overlay, .tqs-open { box-sizing: border-box; }

/* ---------- Biến màu ---------- */
.tqs-theme-dark, .tqs-overlay {
	--tqs-bg: #1f1f22;
	--tqs-bg2: #2a2a2e;
	--tqs-card: #303035;
	--tqs-line: rgba(255,255,255,.09);
	--tqs-text: #f2f2f2;
	--tqs-muted: #a3a3ab;
	--tqs-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.tqs-theme-light {
	--tqs-bg: #ffffff;
	--tqs-bg2: #f4f4f6;
	--tqs-card: #ffffff;
	--tqs-line: rgba(0,0,0,.09);
	--tqs-text: #1b1b1f;
	--tqs-muted: #6b6b74;
	--tqs-shadow: 0 18px 50px rgba(0,0,0,.16);
}
:root { --tqs-accent: #e53935; }
.tqs { --tqs-r: 14px; }

/* ---------- Khung ---------- */
.tqs {
	position: relative;
	width: 100%;
	max-width: var(--tqs-width, 100%);
	margin: 0 auto;
	font-size: 15px;
	line-height: 1.45;
	color: var(--tqs-text);
	text-align: left;
	z-index: 50;
	transition: max-width .35s cubic-bezier(.2,.8,.2,1);
}
.tqs--inline.is-focus { max-width: max(var(--tqs-width, 100%), min(100%, 1100px)); }

/* ---------- Thanh tìm kiếm ---------- */
.tqs-bar {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 6px 6px 16px;
	background: var(--tqs-bg);
	border: 2px solid var(--tqs-line);
	border-radius: 999px;
	box-shadow: 0 4px 16px rgba(0,0,0,.18);
	transition: border-color .2s, box-shadow .2s;
}
.tqs.is-focus .tqs-bar {
	border-color: var(--tqs-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--tqs-accent) 22%, transparent), 0 8px 26px rgba(0,0,0,.25);
}
.tqs-bar__icon { display: flex; color: var(--tqs-muted); flex: none; }
.tqs.is-focus .tqs-bar__icon { color: var(--tqs-accent); }

.tqs .tqs-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	margin: 0;
	padding: 0 4px;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	color: var(--tqs-text) !important;
	font: inherit;
	font-size: 16px; /* chống zoom trên iOS */
	-webkit-appearance: none;
	appearance: none;
}
.tqs .tqs-input::placeholder { color: var(--tqs-muted); opacity: 1; }
.tqs .tqs-input::-webkit-search-cancel-button { display: none; }

.tqs-bar button {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	border: 0;
	cursor: pointer;
	font: inherit;
	line-height: 1;
	background: transparent;
	color: var(--tqs-muted);
	border-radius: 999px;
	transition: background .2s, color .2s, transform .15s;
}
.tqs-bar button:hover { color: var(--tqs-text); background: var(--tqs-bg2); }
.tqs-clear { width: 34px; height: 34px; font-size: 24px !important; visibility: hidden; }
.tqs.has-value .tqs-clear { visibility: visible; }
.tqs-size { width: 38px; height: 38px; }
.tqs-size .tqs-i-min, .tqs.is-max .tqs-size .tqs-i-max { display: none; }
.tqs.is-max .tqs-size .tqs-i-min { display: block; }
.tqs-close { gap: 6px; height: 34px; padding: 0 10px; }
.tqs-close kbd { font: 600 11px/1 system-ui, sans-serif; padding: 4px 6px; border: 1px solid var(--tqs-line); border-radius: 6px; }
.tqs-close span { font-size: 14px; font-weight: 600; display: none; }
.tqs-bar .tqs-go {
	height: 42px;
	padding: 0 22px;
	background: var(--tqs-accent);
	color: #fff;
	font-weight: 700;
	letter-spacing: .3px;
}
.tqs-bar .tqs-go:hover { background: var(--tqs-accent); color: #fff; filter: brightness(1.1); transform: translateY(-1px); }

.tqs-spinner {
	width: 18px; height: 18px; flex: none;
	border: 2px solid var(--tqs-line);
	border-top-color: var(--tqs-accent);
	border-radius: 50%;
	opacity: 0;
	animation: tqs-spin .7s linear infinite;
	transition: opacity .15s;
}
.tqs.is-loading .tqs-spinner { opacity: 1; }
@keyframes tqs-spin { to { transform: rotate(360deg); } }

/* ---------- Bảng kết quả ---------- */
.tqs-panel {
	margin-top: 10px;
	background: var(--tqs-bg);
	border: 1px solid var(--tqs-line);
	border-radius: var(--tqs-r);
	box-shadow: var(--tqs-shadow);
	overflow: hidden;
	animation: tqs-drop .22s cubic-bezier(.2,.8,.2,1);
}
.tqs-panel[hidden] { display: none !important; }
.tqs--inline .tqs-panel {
	position: absolute;
	left: 0; right: 0;
	top: 100%;
	max-height: min(72vh, 820px);
	overflow-y: auto;
	overscroll-behavior: contain;
}
@keyframes tqs-drop { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }

/* Phóng to (inline -> toàn màn hình) */
.tqs--inline.is-max {
	position: fixed;
	inset: 0;
	max-width: none;
	z-index: 999999;
	padding: 18px max(18px, calc((100vw - 1240px) / 2));
	background: color-mix(in srgb, var(--tqs-bg) 96%, transparent);
	backdrop-filter: blur(6px);
	display: flex;
	flex-direction: column;
	animation: tqs-zoom .25s cubic-bezier(.2,.8,.2,1);
}
.tqs--inline.is-max .tqs-panel {
	position: static;
	flex: 1 1 auto;
	max-height: none;
	min-height: 0;
}
@keyframes tqs-zoom { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.tqs-filters {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--tqs-line);
	background: var(--tqs-bg2);
	position: sticky;
	top: 0;
	z-index: 2;
}
.tqs-filters[hidden] { display: none; }
.tqs-tabs {
	display: flex;
	gap: 6px;
	flex: 1 1 auto;
	overflow-x: auto;
	scrollbar-width: none;
}
.tqs-tabs::-webkit-scrollbar { display: none; }
.tqs-tab {
	flex: none;
	padding: 7px 14px;
	border: 1px solid var(--tqs-line);
	border-radius: 999px;
	background: transparent;
	color: var(--tqs-muted);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	white-space: nowrap;
	transition: all .18s;
}
.tqs-tab:hover { color: var(--tqs-text); border-color: var(--tqs-accent); }
.tqs-tab.is-active { background: var(--tqs-accent); border-color: var(--tqs-accent); color: #fff; }
.tqs-tab em { font-style: normal; opacity: .75; margin-left: 4px; font-weight: 500; }
.tqs .tqs-cat {
	flex: none;
	max-width: 220px;
	height: 34px;
	margin: 0;
	padding: 0 30px 0 12px;
	border: 1px solid var(--tqs-line);
	border-radius: 999px;
	background-color: var(--tqs-bg);
	color: var(--tqs-text);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.tqs .tqs-cat[hidden] { display: none; }

.tqs-meta {
	padding: 10px 16px 0;
	font-size: 13px;
	color: var(--tqs-muted);
	min-height: 10px;
}
.tqs-meta b { color: var(--tqs-text); }

/* ---------- Lưới đều nhau ---------- */
.tqs-grid {
	display: grid;
	grid-template-columns: repeat(var(--tqs-cols, 4), minmax(0, 1fr));
	gap: 14px;
	padding: 12px 16px 16px;
	align-items: stretch;
}
.tqs-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--tqs-card);
	border: 1px solid var(--tqs-line);
	border-radius: 12px;
	overflow: hidden;
	text-decoration: none !important;
	color: var(--tqs-text) !important;
	opacity: 0;
	transform: translateY(8px);
	animation: tqs-in .32s cubic-bezier(.2,.8,.2,1) forwards;
	animation-delay: calc(var(--i, 0) * 28ms);
	transition: transform .2s, border-color .2s, box-shadow .2s;
}
@keyframes tqs-in { to { opacity: 1; transform: none; } }
.tqs-card:hover, .tqs-card.is-active {
	border-color: var(--tqs-accent);
	box-shadow: 0 10px 26px rgba(0,0,0,.35), 0 0 0 1px var(--tqs-accent);
	transform: translateY(-3px);
}
.tqs-card__img {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--tqs-bg2);
	overflow: hidden;
}
.tqs-card__img img {
	width: 100%; height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .4s;
}
.tqs-card:hover .tqs-card__img img { transform: scale(1.06); }
.tqs-card__img.is-empty::after {
	content: "";
	position: absolute; inset: 0;
	background: linear-gradient(135deg, var(--tqs-bg2), var(--tqs-card));
}
.tqs-badge {
	position: absolute;
	top: 8px; left: 8px;
	z-index: 1;
	padding: 4px 9px;
	border-radius: 999px;
	background: var(--tqs-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
}
.tqs-badge--type { left: auto; right: 8px; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); font-weight: 600; }
.tqs-badge--out { top: auto; bottom: 8px; background: #555; }
.tqs-card__img.is-empty .tqs-badge { z-index: 2; }

.tqs-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	gap: 6px;
	padding: 10px 12px 12px;
}
.tqs-card__cat {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--tqs-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tqs-card__title {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.7em;
}
.tqs-card__ex {
	margin: 0;
	font-size: 12.5px;
	color: var(--tqs-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.tqs-card mark {
	background: color-mix(in srgb, var(--tqs-accent) 30%, transparent);
	color: inherit;
	padding: 0 1px;
	border-radius: 3px;
}
.tqs-card__foot {
	margin-top: auto;
	padding-top: 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	font-size: 12px;
	color: var(--tqs-muted);
}
.tqs-card__price { font-weight: 800; font-size: 14px; color: var(--tqs-text); }
.tqs-card__price del { opacity: .55; font-weight: 500; font-size: 12px; margin-right: 4px; }
.tqs-card__price ins { text-decoration: none; }
.tqs-card__price .screen-reader-text { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }
.tqs-card__rate { color: #f5b301; white-space: nowrap; }

/* Khung xương khi đang tải */
.tqs-skel { pointer-events: none; animation: none; opacity: 1; transform: none; }
.tqs-skel .tqs-card__img, .tqs-skel i {
	background: linear-gradient(90deg, var(--tqs-bg2) 25%, var(--tqs-line) 50%, var(--tqs-bg2) 75%);
	background-size: 200% 100%;
	animation: tqs-shine 1.1s infinite linear;
}
.tqs-skel i { display: block; height: 12px; border-radius: 6px; }
.tqs-skel i + i { width: 60%; }
@keyframes tqs-shine { to { background-position: -200% 0; } }

/* Trống / gợi ý */
.tqs-empty {
	grid-column: 1 / -1;
	padding: 26px 10px;
	text-align: center;
	color: var(--tqs-muted);
}
.tqs-empty strong { color: var(--tqs-text); }
.tqs-sugg { grid-column: 1 / -1; }
.tqs-sugg h4 {
	margin: 4px 0 10px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .6px;
	color: var(--tqs-muted);
	display: flex; justify-content: space-between; align-items: center;
}
.tqs-sugg h4 button { background: none; border: 0; color: var(--tqs-accent); cursor: pointer; font: inherit; text-transform: none; }
.tqs-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tqs-chip {
	padding: 7px 14px;
	border-radius: 999px;
	border: 1px solid var(--tqs-line);
	background: var(--tqs-bg2);
	color: var(--tqs-text);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	transition: border-color .2s, color .2s;
}
.tqs-chip:hover { border-color: var(--tqs-accent); color: var(--tqs-accent); }

.tqs-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	padding: 0 16px 16px;
}
.tqs-foot:empty { display: none; }
.tqs-more, .tqs-all {
	padding: 10px 20px;
	border-radius: 999px;
	border: 1px solid var(--tqs-accent);
	background: transparent;
	color: var(--tqs-text) !important;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none !important;
	transition: background .2s;
}
.tqs-more:hover, .tqs-all:hover { background: var(--tqs-accent); color: #fff !important; }

/* ---------- Nút mở popup ---------- */
.tqs-open { cursor: pointer; font: inherit; }
.tqs-open--bar {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: var(--tqs-width, 100%);
	margin: 0 auto;
	height: 46px;
	padding: 0 8px 0 16px;
	border: 2px solid var(--tqs-line);
	border-radius: 999px;
	background: var(--tqs-bg);
	color: var(--tqs-muted);
	text-align: left;
	transition: border-color .2s;
}
.tqs-open--bar:hover { border-color: var(--tqs-accent); }
.tqs-open--bar span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.tqs-kbd { font: 600 11px/1 system-ui, sans-serif; padding: 5px 7px; border: 1px solid var(--tqs-line); border-radius: 6px; color: var(--tqs-muted); }
.tqs-open--icon {
	display: inline-flex; align-items: center; justify-content: center;
	width: 42px; height: 42px;
	border: 0; border-radius: 50%;
	background: var(--tqs-accent, #e53935); color: #fff;
	transition: transform .2s;
}
.tqs-open--icon:hover { transform: scale(1.08); }

.tqs-fab {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 99990;
	width: 54px; height: 54px;
	display: flex; align-items: center; justify-content: center;
	border: 0; border-radius: 50%;
	background: var(--tqs-accent, #e53935);
	color: #fff;
	box-shadow: 0 8px 24px rgba(0,0,0,.4);
	transition: transform .2s;
}
.tqs-fab:hover { transform: scale(1.08) rotate(-8deg); }

/* ---------- Popup toàn màn hình ---------- */
.tqs-overlay { position: fixed; inset: 0; z-index: 999999; }
.tqs-overlay[hidden] { display: none; }
.tqs-overlay__backdrop {
	position: absolute; inset: 0;
	background: rgba(0,0,0,.72);
	backdrop-filter: blur(6px);
	animation: tqs-fade .2s;
}
@keyframes tqs-fade { from { opacity: 0; } }
.tqs-overlay__inner {
	position: relative;
	max-width: 1180px;
	height: 100%;
	margin: 0 auto;
	padding: 6vh 18px 18px;
	display: flex;
	flex-direction: column;
	pointer-events: none;
}
.tqs-overlay .tqs {
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	max-height: 100%;
	animation: tqs-zoom .25s cubic-bezier(.2,.8,.2,1);
}
.tqs--popup .tqs-panel {
	flex: 0 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
}
html.tqs-lock, html.tqs-lock body { overflow: hidden !important; }

/* Thanh cuộn đẹp */
.tqs-panel::-webkit-scrollbar { width: 8px; }
.tqs-panel::-webkit-scrollbar-thumb { background: var(--tqs-line); border-radius: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.tqs-grid { grid-template-columns: repeat(min(var(--tqs-cols, 4), 3), minmax(0, 1fr)); }
}
@media (max-width: 680px) {
	.tqs-grid {
		grid-template-columns: repeat(var(--tqs-cols-m, 2), minmax(0, 1fr));
		gap: 10px;
		padding: 10px;
	}
	.tqs-bar { padding-left: 12px; }
	.tqs-bar .tqs-go { padding: 0 14px; }
	.tqs-close kbd { display: none; }
	.tqs-close span { display: block; }
	.tqs--popup .tqs-go { display: none; }
	.tqs-filters { flex-wrap: wrap; padding: 10px; }
	.tqs-tabs { width: 100%; }
	.tqs .tqs-cat { max-width: none; width: 100%; }
	.tqs-card__body { padding: 8px 9px 10px; }
	.tqs-card__title { font-size: 13px; }
	.tqs-card__ex { display: none; }
	.tqs-kbd { display: none; }

	.tqs--inline .tqs-panel { max-height: 70vh; }

	.tqs-overlay__inner { padding: 0; }
	.tqs-overlay .tqs { height: 100%; max-height: 100%; background: var(--tqs-bg); padding: 10px; }
	.tqs-overlay .tqs-panel { flex: 1 1 auto; border: 0; box-shadow: none; }
	.tqs-fab { width: 50px; height: 50px; right: 14px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.tqs *, .tqs-overlay * { animation: none !important; transition: none !important; }
	.tqs-card { opacity: 1; transform: none; }
}
