/* Aff Search Hub – giao diện tìm kiếm sản phẩm Shopee & TikTok Shop */
.affs {
	--affs-accent: #ff5722;
	--affs-shopee: #ee4d2d;
	--affs-tiktok: #111111;
	--affs-tiktok-2: #fe2c55;
	--affs-tiktok-3: #25f4ee;
	--affs-ink: #1a1a1a;
	--affs-muted: #6b6b6b;
	--affs-line: #ececec;
	--affs-bg: #ffffff;
	--affs-soft: #faf7f5;
	--affs-radius: 14px;
	--affs-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);

	max-width: 1200px;
	margin: 0 auto;
	padding: 0 16px 48px;
	color: var(--affs-ink);
	font-family: inherit;
	line-height: 1.45;
	box-sizing: border-box;
}
.affs *, .affs *::before, .affs *::after { box-sizing: border-box; }
.affs button { font-family: inherit; }
.affs-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hero ---------- */
.affs-hero {
	text-align: center;
	padding: 40px 8px 8px;
}
.affs-eyebrow {
	display: inline-flex; align-items: center; gap: 6px;
	margin: 0 0 14px; padding: 6px 14px;
	font-size: 13px; font-weight: 600; letter-spacing: .02em;
	color: var(--affs-muted);
	background: var(--affs-soft);
	border: 1px solid var(--affs-line);
	border-radius: 999px;
}
.affs-sep { margin: 0 4px; opacity: .5; }
.affs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; flex: none; }
.affs-dot--shopee { background: var(--affs-shopee); }
.affs-dot--tiktok { background: var(--affs-tiktok); box-shadow: 2px 0 0 var(--affs-tiktok-2), -2px 0 0 var(--affs-tiktok-3); }

.affs-title {
	margin: 0 auto 10px;
	max-width: 760px;
	font-size: clamp(28px, 5vw, 46px);
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -.02em;
	color: var(--affs-ink);
}
.affs-subtitle {
	margin: 0 auto;
	max-width: 560px;
	font-size: clamp(15px, 2.2vw, 18px);
	color: var(--affs-muted);
}

.affs-eyebrow--mall { color: #0a7a3d; background: #eafaf0; border-color: #bfe9cf; }
.affs-eyebrow--mall svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Search ---------- */
.affs-searchwrap {
	position: sticky; top: 0; z-index: 20;
	margin: 24px -16px 0; padding: 12px 16px;
	background: linear-gradient(var(--affs-bg) 80%, rgba(255,255,255,0));
}
.admin-bar .affs-searchwrap { top: 32px; }
@media (max-width: 782px) { .admin-bar .affs-searchwrap { top: 0; } }

.affs-search {
	position: relative;
	display: flex; align-items: center;
	max-width: 760px; margin: 0 auto;
	background: var(--affs-bg);
	border: 2px solid var(--affs-ink);
	border-radius: 999px;
	box-shadow: 0 4px 0 var(--affs-ink);
	transition: box-shadow .15s, transform .15s;
}
.affs-search:focus-within { transform: translateY(-1px); box-shadow: 0 5px 0 var(--affs-accent); border-color: var(--affs-accent); }
.affs-search__icon {
	flex: none; width: 22px; height: 22px; margin-left: 18px;
	fill: none; stroke: var(--affs-muted); stroke-width: 2.2; stroke-linecap: round;
}
.affs .affs-search__input {
	flex: 1; min-width: 0;
	height: 56px; margin: 0; padding: 0 10px;
	border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important;
	font-size: 17px; color: var(--affs-ink);
}
.affs-search__input::-webkit-search-cancel-button { display: none; }
.affs-search__input::placeholder { color: #a3a3a3; }
.affs .affs-search__clear {
	flex: none; display: grid; place-items: center;
	width: 34px; height: 34px; margin: 0 4px; padding: 0;
	background: #f2f2f2; border: 0; border-radius: 50%; cursor: pointer;
}
.affs-search__clear svg { width: 16px; height: 16px; stroke: #555; stroke-width: 2.4; stroke-linecap: round; }
.affs .affs-search__btn {
	flex: none; height: 46px; margin: 0 5px 0 0; padding: 0 26px;
	background: var(--affs-accent); color: #fff;
	border: 0; border-radius: 999px;
	font-size: 16px; font-weight: 700; cursor: pointer;
	transition: filter .15s;
}
.affs-search__btn:hover { filter: brightness(1.08); }

.affs-chips {
	display: flex; gap: 8px; align-items: center;
	max-width: 760px; margin: 12px auto 0;
	overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
	padding-bottom: 2px;
}
.affs-chips::-webkit-scrollbar { display: none; }
.affs-chips__label { flex: none; font-size: 13px; font-weight: 700; color: var(--affs-accent); }
.affs .affs-chip {
	flex: none; padding: 6px 12px; margin: 0;
	font-size: 13px; color: var(--affs-ink); line-height: 1.3;
	background: var(--affs-bg); border: 1px solid var(--affs-line); border-radius: 999px;
	cursor: pointer; transition: border-color .15s, background .15s;
}
.affs-chip:hover { border-color: var(--affs-accent); background: var(--affs-soft); }

/* ---------- Toolbar ---------- */
.affs-toolbar {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	margin: 22px 0 8px;
}
.affs-tabs {
	display: inline-flex; padding: 4px; gap: 2px;
	background: #f3f3f3; border-radius: 12px;
}
.affs .affs-tab {
	display: inline-flex; align-items: center;
	padding: 8px 14px; margin: 0;
	font-size: 14px; font-weight: 600; color: var(--affs-muted);
	background: transparent; border: 0; border-radius: 9px; cursor: pointer;
}
.affs .affs-tab[aria-selected="true"] { background: var(--affs-bg); color: var(--affs-ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.affs .affs-sort__select {
	height: 40px; padding: 0 34px 0 12px; margin: 0;
	font-size: 14px; color: var(--affs-ink);
	border: 1px solid var(--affs-line); border-radius: 10px;
	background: var(--affs-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
	appearance: none; -webkit-appearance: none; cursor: pointer;
}

.affs-status { min-height: 22px; margin: 6px 0 14px; font-size: 14px; color: var(--affs-muted); }
.affs-status strong { color: var(--affs-ink); }

/* ---------- Grid & cards ---------- */
.affs-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}
@media (min-width: 640px)  { .affs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px)  { .affs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1140px) { .affs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.affs-card {
	position: relative;
	display: flex; flex-direction: column;
	background: var(--affs-bg);
	border: 1px solid var(--affs-line);
	border-radius: var(--affs-radius);
	overflow: hidden;
	transition: transform .18s, box-shadow .18s, border-color .18s;
	animation: affs-in .35s ease both;
}
.affs-card:hover { transform: translateY(-3px); box-shadow: var(--affs-shadow); border-color: transparent; }
@keyframes affs-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.affs-card__media {
	position: relative; display: block;
	aspect-ratio: 1 / 1; background: #f5f5f5; overflow: hidden;
}
.affs-card__media img {
	width: 100%; height: 100%; object-fit: cover; display: block;
	transition: transform .4s;
}
.affs-card:hover .affs-card__media img { transform: scale(1.04); }

.affs-badge {
	position: absolute; top: 8px;
	padding: 3px 8px;
	font-size: 11.5px; font-weight: 800; line-height: 1.4;
	border-radius: 6px;
}
.affs-badge--off { left: 8px; background: #ffe600; color: #111; }
.affs-badge--src { right: 8px; display: inline-flex; align-items: center; gap: 4px; color: #fff; font-weight: 700; }
.affs-badge--shopee { background: var(--affs-shopee); }
.affs-badge--tiktok { background: var(--affs-tiktok); }

.affs-badge--mall {
	left: 8px; top: auto; bottom: 8px;
	display: inline-flex; align-items: center; gap: 3px;
	background: #0a7a3d; color: #fff; font-weight: 700;
}
.affs-badge--mall svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

.affs-card__body { display: flex; flex-direction: column; flex: 1; padding: 10px 12px 12px; gap: 6px; }
.affs-card__name {
	margin: 0; font-size: 14px; font-weight: 500; line-height: 1.38; color: var(--affs-ink);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	min-height: 2.76em;
}
.affs-card__name a { color: inherit; text-decoration: none; }
.affs-card__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-top: auto; }
.affs-price { font-size: 17px; font-weight: 800; color: var(--affs-shopee); letter-spacing: -.01em; }
.affs-card--tiktok .affs-price { color: var(--affs-tiktok-2); }
.affs-price-old { font-size: 12.5px; color: #9a9a9a; text-decoration: line-through; }
.affs-card__meta { font-size: 12px; color: var(--affs-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 17px; }

.affs .affs-buy {
	display: flex; align-items: center; justify-content: center; gap: 6px;
	height: 40px; margin-top: 4px;
	font-size: 14px; font-weight: 700; color: #fff !important; text-decoration: none !important;
	border-radius: 10px;
	transition: filter .15s, transform .1s;
}
.affs-buy:active { transform: scale(.98); }
.affs-buy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.affs-buy--shopee { background: var(--affs-shopee); }
.affs-buy--tiktok { background: var(--affs-tiktok); box-shadow: inset 0 -3px 0 var(--affs-tiktok-2); }
.affs-buy:hover { filter: brightness(1.1); }

/* ---------- Skeleton ---------- */
.affs-skel { pointer-events: none; animation: none; }
.affs-skel .affs-card__media,
.affs-skel .affs-skel-line {
	background: linear-gradient(90deg, #f1f1f1 25%, #e6e6e6 37%, #f1f1f1 63%);
	background-size: 400% 100%;
	animation: affs-shimmer 1.3s ease infinite;
}
.affs-skel-line { height: 12px; border-radius: 6px; }
.affs-skel-line + .affs-skel-line { margin-top: 6px; }
@keyframes affs-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Empty / footer ---------- */
.affs-empty {
	grid-column: 1 / -1;
	text-align: center; padding: 48px 16px;
	border: 1px dashed var(--affs-line); border-radius: var(--affs-radius);
	color: var(--affs-muted);
}
.affs-empty b { display: block; font-size: 18px; color: var(--affs-ink); margin-bottom: 6px; }

.affs-footer { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 24px; }
.affs .affs-loadmore {
	padding: 12px 28px; margin: 0;
	font-size: 15px; font-weight: 700; color: var(--affs-ink);
	background: var(--affs-bg); border: 2px solid var(--affs-ink); border-radius: 999px; cursor: pointer;
}
.affs-loadmore:hover { background: var(--affs-ink); color: #fff; }
.affs .affs-more-shopee {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 12px 22px;
	font-size: 15px; font-weight: 700; color: var(--affs-shopee) !important; text-decoration: none !important;
	background: #fff4f1; border: 1px solid #ffd3c7; border-radius: 999px;
}
.affs-more-shopee[hidden], .affs-loadmore[hidden], .affs-search__clear[hidden] { display: none !important; }
.affs-sentinel { height: 1px; width: 100%; }

.affs-disclosure { margin: 32px auto 0; max-width: 640px; text-align: center; font-size: 12.5px; color: #9a9a9a; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
	.affs-hero { padding-top: 24px; }
	.affs .affs-search__input { height: 50px; font-size: 16px; }
	.affs .affs-search__btn { height: 40px; padding: 0 16px; font-size: 15px; }
	.affs-search__icon { margin-left: 14px; width: 20px; height: 20px; }
	.affs-toolbar { flex-wrap: wrap; }
	.affs .affs-tab { padding: 7px 10px; font-size: 13px; }
	.affs .affs-sort__select { height: 36px; font-size: 13px; }
	.affs-card__body { padding: 8px 10px 10px; }
	.affs-price { font-size: 15.5px; }
	.affs .affs-buy { height: 36px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
	.affs-card, .affs-card__media img, .affs-search { animation: none !important; transition: none !important; }
}

/* ---------- Lưới gọn (search="0") ---------- */
.affs--compact { padding: 0; max-width: none; }
.affs--compact .affs-status { display: none; }
.affs--compact .affs-footer { margin-top: 0; }

/* ---------- Dải hoàn tiền ---------- */
.affs-cbstrip { max-width: 760px; margin: 16px auto 0; padding: 10px 16px; text-align: center; font-size: 14px; line-height: 1.5; background: #fff8ef; border: 1px dashed #f0b27a; border-radius: 12px; }
.affs-cbstrip a { color: var(--affs-accent); font-weight: 700; }
.affs-cbstrip--on { background: #e6f6ec; border-color: #9fd8b4; color: #0a5c2e; }

/* ---------- So sánh giá giữa các sàn ---------- */
.affs { --affs-tiki: #1a94ff; --affs-lazada: #0f146d; --affs-good: #0ca30c; }
.affs-compare { margin: 6px 0 22px; padding: 16px 18px 12px; background: #fff; border: 2px solid var(--affs-ink); border-radius: 18px; box-shadow: 0 4px 0 var(--affs-ink); }
.affs-compare[hidden] { display: none !important; }
.affs-cmp__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 10px; }
.affs-cmp__head h2 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.3; }
.affs-cmp__save { margin: 0; font-size: 14px; color: var(--affs-muted); }
.affs-cmp__save b:last-child { color: var(--affs-good); }
.affs-cmp__list { list-style: none; margin: 0; padding: 0; }
.affs-cmp__row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 150px 160px; align-items: center; gap: 14px; margin: 0; padding: 10px 8px; border-top: 1px solid var(--affs-line); }
.affs-cmp__row:first-child { border-top: 0; }
.affs-cmp__row.is-best { background: #effaef; border-radius: 12px; border-top-color: transparent; }
.affs-cmp__row.is-best + .affs-cmp__row { border-top-color: transparent; }
.affs-cmp__plat { justify-self: start; padding: 5px 10px; font-size: 13px; font-weight: 800; color: #fff; border-radius: 8px; background: var(--affs-accent); white-space: nowrap; }
.affs-cmp__plat--shopee { background: var(--affs-shopee); }
.affs-cmp__plat--tiktok { background: var(--affs-tiktok); box-shadow: 2px 0 0 var(--affs-tiktok-2), -2px 0 0 var(--affs-tiktok-3); }
.affs-cmp__plat--tiki { background: var(--affs-tiki); }
.affs-cmp__plat--lazada { background: var(--affs-lazada); }
.affs-cmp__item { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit !important; text-decoration: none !important; }
.affs-cmp__item img, .affs-cmp__item i { flex: none; width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--affs-soft); }
.affs-cmp__name { min-width: 0; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.affs-cmp__name em { font-style: normal; font-size: 11px; font-weight: 800; color: #fff; background: #d0011b; padding: 1px 5px; border-radius: 4px; vertical-align: 1px; }
.affs-cmp__price { display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.25; }
.affs-cmp__price b { font-size: 18px; font-weight: 900; letter-spacing: -.02em; }
.affs-cmp__price s { font-size: 12.5px; color: #9a9a9a; }
.affs-cmp__tag { margin-top: 3px; font-size: 12px; font-weight: 700; color: var(--affs-muted); }
.affs-cmp__tag.is-best { padding: 2px 8px; color: #fff; background: var(--affs-good); border-radius: 999px; }
.affs-cmp__buy { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; font-size: 14px; font-weight: 800; color: #fff !important; text-decoration: none !important; text-align: center; border-radius: 10px; background: var(--affs-accent); transition: transform .12s, filter .12s; }
.affs-cmp__buy:hover { transform: translateY(-1px); filter: brightness(1.06); }
.affs-cmp__buy--shopee { background: var(--affs-shopee); }
.affs-cmp__buy--tiktok { background: var(--affs-tiktok); }
.affs-cmp__buy--tiki { background: var(--affs-tiki); }
.affs-cmp__buy--lazada { background: var(--affs-lazada); }
.affs-cmp__note { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: #8a8a8a; }
@media (max-width: 760px) {
	.affs-compare { padding: 14px 12px 10px; }
	.affs-cmp__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "plat price" "item item" "buy buy"; gap: 8px 12px; padding: 12px 8px; }
	.affs-cmp__plat { grid-area: plat; }
	.affs-cmp__item { grid-area: item; }
	.affs-cmp__price { grid-area: price; align-self: start; grid-row: 1 / span 1; }
	.affs-cmp__buy { grid-area: buy; }
	.affs-cmp__item img, .affs-cmp__item i { width: 40px; height: 40px; }
	.affs-cmp__name { font-size: 13px; }
	.affs-cmp__price b { font-size: 17px; }
}

.affs-compare:has(.affs-cmp__admin) { padding: 0; border: 0; box-shadow: none; background: none; }
.affs-cmp__admin { margin: 0; padding: 10px 14px; font-size: 13px; line-height: 1.5; color: #6b4e00; background: #fff6dc; border: 1px dashed #e7c25a; border-radius: 10px; }

.affs-cmp__row.is-link .affs-cmp__name { color: var(--affs-muted); }
.affs-cmp__q { display: flex !important; align-items: center; justify-content: center; font-style: normal; font-weight: 800; font-size: 18px; color: #b5b5b5; border: 1px dashed #d5d5d5; }
.affs-cmp__buy.is-ghost { background: #fff !important; color: var(--affs-ink) !important; border: 2px solid currentColor; }
.affs-cmp__buy.is-ghost.affs-cmp__buy--shopee { color: var(--affs-shopee) !important; }
.affs-cmp__buy.is-ghost.affs-cmp__buy--tiki { color: var(--affs-tiki) !important; }
.affs-cmp__buy.is-ghost.affs-cmp__buy--lazada { color: var(--affs-lazada) !important; }

/* Thẻ sản phẩm Tiki / Lazada */
.affs-badge--tiki { background: var(--affs-tiki) !important; color: #fff !important; }
.affs-badge--lazada { background: var(--affs-lazada) !important; color: #fff !important; }
.affs-buy--tiki { background: var(--affs-tiki) !important; color: #fff !important; }
.affs-buy--lazada { background: var(--affs-lazada) !important; color: #fff !important; }
