/* ==========================================================================
   TMT Bộ lọc sản phẩm — thanh lọc nhanh + thanh "Sắp xếp / Hiển thị / Lưới"
   ========================================================================== */
.tmt-sf,
.shop-loop-before {
	--sf-navy: #022335;
	--sf-text: #1d2733;
	--sf-muted: #6b7686;
	--sf-line: #e3e8ee;
	--sf-bg: #f5f7fa;
	--sf-orange: #f7941d;
	--sf-orange-2: #fcb342;
	--sf-red: #e8473f;
	--sf-green: #12a150;
	--sf-ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Khung ---------- */
.tmt-sf {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0 0 14px;
	padding: 14px 16px 12px;
	background: #fff;
	border: 1px solid var(--sf-line);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(2, 35, 53, .04), 0 6px 18px rgba(2, 35, 53, .05);
	font-size: 13.5px;
}
.tmt-sf__row {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

/* ---------- Chip ---------- */
.tmt-chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 13px;
	border: 1px solid var(--sf-line);
	border-radius: 999px;
	background: #fff;
	color: var(--sf-text) !important;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none !important;
	transition: background-color .25s var(--sf-ease), border-color .25s var(--sf-ease), color .25s var(--sf-ease), box-shadow .25s var(--sf-ease), transform .2s var(--sf-ease);
}
.tmt-chip svg { width: 15px; height: 15px; flex: none; }
.tmt-chip__n {
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--sf-bg);
	color: var(--sf-muted);
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	transition: inherit;
}
.tmt-chip:hover {
	border-color: var(--sf-orange);
	color: var(--sf-navy) !important;
	box-shadow: 0 4px 12px rgba(247, 148, 29, .16);
	transform: translateY(-1px);
}
.tmt-chip:active { transform: scale(.96); }
.tmt-chip:focus-visible { outline: 2px solid var(--sf-orange); outline-offset: 2px; }

/* đang chọn */
.tmt-chip.is-active {
	border-color: var(--sf-navy);
	background: var(--sf-navy);
	color: #fff !important;
	box-shadow: 0 4px 12px rgba(2, 35, 53, .22);
}
.tmt-chip.is-active .tmt-chip__n { background: rgba(255, 255, 255, .16); color: var(--sf-orange-2); }
.tmt-chip.is-active:not(.tmt-chip--cat)::after {
	content: "×";
	margin-left: 2px;
	font-size: 16px;
	font-weight: 400;
	opacity: .7;
}

/* chip danh mục: to hơn một chút */
.tmt-chip--cat { height: 36px; padding: 0 15px; font-size: 13.5px; font-weight: 700; }
.tmt-chip--cat.is-active { background: linear-gradient(135deg, var(--sf-navy), #0a4a6b); }

/* chip "Đang giảm giá" / "Còn hàng" */
.tmt-chip--hot svg { color: var(--sf-red); }
.tmt-chip--hot.is-active { background: var(--sf-red); border-color: var(--sf-red); box-shadow: 0 4px 12px rgba(232, 71, 63, .28); }
.tmt-chip--hot.is-active svg { color: #fff; }
.tmt-chip--ok svg { color: var(--sf-green); }
.tmt-chip--ok.is-active { background: var(--sf-green); border-color: var(--sf-green); box-shadow: 0 4px 12px rgba(18, 161, 80, .28); }
.tmt-chip--ok.is-active svg { color: #fff; }

/* nhãn "Mức giá" + vạch ngăn */
.tmt-sf__label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-right: 2px;
	color: var(--sf-muted);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	white-space: nowrap;
}
.tmt-sf__label svg { width: 14px; height: 14px; color: var(--sf-orange); }
.tmt-sf__sep { width: 1px; height: 22px; margin: 0 4px; background: var(--sf-line); flex: none; }

/* hàng danh mục: gạch dưới mảnh tách với phần lọc */
.tmt-sf__cats { padding-bottom: 10px; border-bottom: 1px dashed var(--sf-line); }

/* ---------- Kết quả + thẻ đang lọc ---------- */
.tmt-sf__status { min-height: 26px; gap: 6px; }
.tmt-sf__found { margin-right: 4px; color: var(--sf-muted); font-size: 13px; }
.tmt-sf__found b { color: var(--sf-navy); font-size: 14px; font-weight: 800; }
.tmt-tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 26px;
	padding: 0 6px 0 10px;
	border-radius: 999px;
	background: #fff4e5;
	color: #a35a00 !important;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none !important;
	animation: tmt-sf-pop .35s var(--sf-ease);
	transition: background-color .2s ease;
}
.tmt-tag i {
	display: grid;
	place-items: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: rgba(163, 90, 0, .14);
	font-style: normal;
	font-size: 13px;
	line-height: 1;
}
.tmt-tag:hover { background: #ffe6c4; }
.tmt-sf__clear {
	margin-left: 2px;
	color: var(--sf-red) !important;
	font-size: 12.5px;
	font-weight: 700;
	text-decoration: underline !important;
	text-underline-offset: 3px;
}
@keyframes tmt-sf-pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

/* ---------- Đang tải: chip nhấp nháy, lưới sản phẩm mờ ---------- */
.tmt-chip.is-loading { pointer-events: none; }
.tmt-chip.is-loading::before {
	content: "";
	width: 12px;
	height: 12px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: tmt-sf-spin .7s linear infinite;
}
.tmt-sf-loading .archive-products,
.tmt-sf-loading .products-container { opacity: .45; transition: opacity .2s ease; pointer-events: none; }
@keyframes tmt-sf-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Thanh "Sắp xếp theo · Hiển thị · Lưới/Danh sách" có sẵn của Porto
   ========================================================================== */
.shop-loop-before > .elementor-widget-wrap {
	align-items: center;
	gap: 10px;
	padding: 8px 10px 8px 14px !important;
	background: var(--sf-bg);
	border-radius: 14px;
}
.shop-loop-before .elementor-widget { margin-bottom: 0 !important; }
.shop-loop-before .woocommerce-ordering,
.shop-loop-before .woocommerce-viewing {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 !important;
}
.shop-loop-before .woocommerce-pagination { margin: 0 !important; padding: 0 !important; border: 0 !important; }
.shop-loop-before label {
	margin: 0 !important;
	color: var(--sf-muted);
	font-size: 12.5px;
	font-weight: 600;
	white-space: nowrap;
}
.shop-loop-before select {
	height: 36px !important;
	padding: 0 34px 0 14px !important;
	border: 1px solid var(--sf-line) !important;
	border-radius: 999px !important;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23022335' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 14px !important;
	color: var(--sf-navy) !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	box-shadow: 0 1px 2px rgba(2, 35, 53, .05);
	text-transform: none !important;
	letter-spacing: 0 !important;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.shop-loop-before select.count { padding-right: 30px !important; }
.shop-loop-before select:hover,
.shop-loop-before select:focus {
	border-color: var(--sf-orange) !important;
	box-shadow: 0 0 0 3px rgba(247, 148, 29, .15) !important;
	outline: 0;
}
/* nút Lưới / Danh sách: nhóm viên thuốc */
.shop-loop-before .gridlist-toggle {
	display: flex;
	gap: 2px;
	padding: 3px;
	border: 1px solid var(--sf-line);
	border-radius: 999px;
	background: #fff;
}
.shop-loop-before .gridlist-toggle a {
	display: grid !important;
	place-items: center;
	width: 34px !important;
	height: 30px !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: transparent !important;
	color: var(--sf-muted) !important;
	font-size: 15px !important;
	line-height: 1 !important;
	transition: background-color .2s ease, color .2s ease;
}
.shop-loop-before .gridlist-toggle a:hover { color: var(--sf-navy) !important; background: var(--sf-bg) !important; }
.shop-loop-before .gridlist-toggle a.active { background: var(--sf-navy) !important; color: #fff !important; }

/* ==========================================================================
   Máy tính bảng / Điện thoại: mỗi hàng chip cuộn ngang 1 dòng, tiết kiệm chỗ
   ========================================================================== */
@media (max-width: 991px) {
	.tmt-sf { padding: 12px 0 10px; gap: 8px; border-radius: 14px; }
	.tmt-sf__row { padding-left: 12px; padding-right: 12px; }
	.tmt-sf__cats,
	.tmt-sf__opts {
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-behavior: smooth;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.tmt-sf__cats::-webkit-scrollbar,
	.tmt-sf__opts::-webkit-scrollbar { display: none; }
	/* mờ dần 2 mép khi còn chip ẩn (JS bật class has-l / has-r) */
	.tmt-sf__row.has-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
	.tmt-sf__row.has-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
	.tmt-sf__row.has-l.has-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
	.tmt-sf__cats { padding-bottom: 8px; }
	.tmt-chip, .tmt-chip--cat { flex: none; }
}
@media (max-width: 575px) {
	.tmt-sf { font-size: 13px; margin-bottom: 10px; }
	.tmt-chip { height: 32px; padding: 0 11px; }
	.tmt-chip--cat { height: 34px; padding: 0 13px; font-size: 13px; }
	.tmt-chip:hover { transform: none; box-shadow: none; }
	.tmt-chip.is-active { box-shadow: 0 3px 8px rgba(2, 35, 53, .2); }

	/* thanh sắp xếp: gọn 1 hàng, ẩn chữ nhãn */
	.shop-loop-before > .elementor-widget-wrap { flex-wrap: nowrap; gap: 6px; padding: 6px !important; border-radius: 12px; }
	.shop-loop-before label { display: none !important; }
	.shop-loop-before .elementor-widget-porto_sb_sort { flex: 1 1 auto !important; min-width: 0; }
	.shop-loop-before .elementor-widget-porto_sb_sort .woocommerce-ordering { width: 100%; }
	.shop-loop-before .woocommerce-ordering select { width: 100% !important; max-width: none !important; }
	.shop-loop-before select { height: 34px !important; font-size: 12.5px !important; }
	.shop-loop-before .gridlist-toggle a { width: 30px !important; height: 28px !important; }
}
@media (prefers-reduced-motion: reduce) {
	.tmt-chip, .tmt-tag { transition: none; animation: none; }
}
