/*!
 * TSQ Tag Display – Giao diện hiển thị thẻ & danh mục
 * Tác giả: TonySQuang
 */
.tsq-tags {
	--tsq-cols: 6;
	--tsq-cols-t: 4;
	--tsq-cols-m: 2;
	--tsq-gap: 8px;
	--tsq-h: 34px;
	--tsq-radius: 4px;
	--tsq-fs: 13px;
	--tsq-fw: 500;
	--tsq-text: #9aa7a0;
	--tsq-bg: #0d1311;
	--tsq-border: #2c3833;
	--tsq-hover: #fff;
	--tsq-hover-bg: #c40000;
	--tsq-accent: #ff2a2a;
	--tsq-title: #b9c2be;
	width: 100%;
	box-sizing: border-box;
}

.tsq-tags *,
.tsq-tags *::before,
.tsq-tags *::after { box-sizing: border-box; }

/* Tiêu đề */
.tsq-tags .tsq-tags__title {
	margin: 0 0 14px;
	padding: 0 0 10px;
	color: var(--tsq-title);
	font-size: calc(var(--tsq-fs) + 5px);
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
	position: relative;
	line-height: 1.3;
}
.tsq-tags .tsq-tags__title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 42px;
	height: 3px;
	border-radius: 3px;
	background: var(--tsq-accent);
}

/* Danh sách – reset style của theme (Flatsome…) */
.tsq-tags .tsq-tags__list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	gap: var(--tsq-gap);
}
.tsq-tags .tsq-tags__item {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0;
}
.tsq-tags .tsq-tags__item::before { display: none !important; }

/* Bố cục lưới: mọi ô bằng nhau */
.tsq-layout-grid .tsq-tags__list {
	display: grid;
	grid-template-columns: repeat(var(--tsq-cols), minmax(0, 1fr));
}

/* Bố cục co giãn theo chữ */
.tsq-layout-flex .tsq-tags__list {
	display: flex;
	flex-wrap: wrap;
}
.tsq-layout-flex .tsq-tags__item { flex: 0 0 auto; }
.tsq-layout-flex .tsq-tag { padding: 0 14px; }

/* Ô thẻ */
.tsq-tags a.tsq-tag {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	height: var(--tsq-h);
	padding: 0 6px;
	margin: 0;
	overflow: hidden;
	color: var(--tsq-text);
	background: var(--tsq-bg);
	border: 1px solid var(--tsq-border);
	border-radius: var(--tsq-radius);
	font-size: var(--tsq-fs);
	font-weight: var(--tsq-fw);
	line-height: 1;
	letter-spacing: 0;
	text-align: center;
	text-decoration: none !important;
	white-space: nowrap;
	box-shadow: none;
	transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .25s ease, transform .2s ease;
	-webkit-tap-highlight-color: transparent;
}
.tsq-uppercase a.tsq-tag { text-transform: uppercase; }

.tsq-tags .tsq-tag__name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	min-width: 0;
	overflow: hidden;
	white-space: normal;
	line-height: 1.15;
	word-break: normal;
	overflow-wrap: normal;
}
.tsq-layout-flex .tsq-tag__name { white-space: nowrap; -webkit-line-clamp: 1; }

.tsq-tags .tsq-tag__count {
	flex: 0 0 auto;
	min-width: 20px;
	height: 18px;
	padding: 0 5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	color: var(--tsq-text);
	background: rgba(255, 255, 255, .08);
	transition: inherit;
}

/* Hover & trạng thái đang xem */
.tsq-tags a.tsq-tag:hover,
.tsq-tags a.tsq-tag:focus-visible,
.tsq-tags a.tsq-tag.is-active {
	color: var(--tsq-hover);
	background: var(--tsq-hover-bg);
	border-color: var(--tsq-accent);
	transform: translateY(-2px);
	box-shadow: 0 6px 14px -6px var(--tsq-accent);
	outline: none;
}
.tsq-tags a.tsq-tag:hover .tsq-tag__count,
.tsq-tags a.tsq-tag.is-active .tsq-tag__count {
	color: var(--tsq-hover);
	background: rgba(0, 0, 0, .25);
}
.tsq-tags a.tsq-tag:active { transform: translateY(0); }

/* --- Kiểu: Outline --- */
.tsq-style-outline a.tsq-tag { background: transparent; }

/* --- Kiểu: Solid --- */
.tsq-style-solid a.tsq-tag { border-color: transparent; }

/* --- Kiểu: Neon --- */
.tsq-style-neon a.tsq-tag { background: transparent; }
.tsq-style-neon a.tsq-tag:hover,
.tsq-style-neon a.tsq-tag:focus-visible,
.tsq-style-neon a.tsq-tag.is-active {
	background: transparent;
	color: var(--tsq-hover);
	border-color: var(--tsq-accent);
	text-shadow: 0 0 6px var(--tsq-accent);
	box-shadow: 0 0 6px var(--tsq-accent), inset 0 0 8px -2px var(--tsq-accent);
}

/* --- Kiểu: Gradient --- */
.tsq-style-gradient a.tsq-tag::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: 0;
	background: linear-gradient(135deg, var(--tsq-accent), var(--tsq-hover-bg));
	transition: opacity .25s ease;
}
.tsq-style-gradient a.tsq-tag { z-index: 0; isolation: isolate; }
.tsq-style-gradient a.tsq-tag:hover,
.tsq-style-gradient a.tsq-tag.is-active { background: transparent; border-color: transparent; }
.tsq-style-gradient a.tsq-tag:hover::before,
.tsq-style-gradient a.tsq-tag.is-active::before { opacity: 1; }

/* --- Kiểu: Minimal --- */
.tsq-style-minimal a.tsq-tag {
	background: transparent;
	border-color: transparent;
	border-bottom-color: var(--tsq-border);
	border-radius: 0;
}
.tsq-style-minimal a.tsq-tag:hover,
.tsq-style-minimal a.tsq-tag.is-active {
	background: transparent;
	color: var(--tsq-accent);
	border-color: transparent;
	border-bottom-color: var(--tsq-accent);
	box-shadow: none;
}

/* Responsive – theo breakpoint Flatsome */
@media (max-width: 849px) {
	.tsq-layout-grid .tsq-tags__list { grid-template-columns: repeat(var(--tsq-cols-t), minmax(0, 1fr)); }
}
@media (max-width: 549px) {
	.tsq-layout-grid .tsq-tags__list { grid-template-columns: repeat(var(--tsq-cols-m), minmax(0, 1fr)); }
	.tsq-tags a.tsq-tag { padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.tsq-tags a.tsq-tag { transition: none; }
	.tsq-tags a.tsq-tag:hover { transform: none; }
}

.tsq-tags-notice {
	padding: 10px 14px;
	border-left: 4px solid #d63638;
	background: #fff4f4;
	color: #8a1f1f;
	font-size: 13px;
}
