/* TPAT 1.3.11: Lựa chọn đang chọn trong bảng phân loại gốc của WCBoost. */
.wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch),
.wcboost-variation-swatches__item[aria-checked="true"]:not(.tpat-soldout-swatch) {
	position: relative !important;
	overflow: hidden !important;
	color: var(--tpat-selected-color, #a12e30) !important;
	background: #fffafa !important;
	border-color: var(--tpat-selected-color, #a12e30) !important;
	box-shadow: inset 0 0 0 1px var(--tpat-selected-color, #a12e30) !important;
}

.wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch):hover,
.wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch):focus,
.wcboost-variation-swatches__item[aria-checked="true"]:not(.tpat-soldout-swatch):hover,
.wcboost-variation-swatches__item[aria-checked="true"]:not(.tpat-soldout-swatch):focus {
	color: var(--tpat-selected-color, #a12e30) !important;
	background: #fffafa !important;
	border-color: var(--tpat-selected-color, #a12e30) !important;
	box-shadow: inset 0 0 0 1px var(--tpat-selected-color, #a12e30) !important;
}

.wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch) .wcboost-variation-swatches__name,
.wcboost-variation-swatches__item[aria-checked="true"]:not(.tpat-soldout-swatch) .wcboost-variation-swatches__name {
	color: var(--tpat-selected-color, #a12e30) !important;
}

/* Góc đỏ mận và dấu tích có thể điều chỉnh trong phần Cài đặt. */
.wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch)::before,
.wcboost-variation-swatches__item[aria-checked="true"]:not(.tpat-soldout-swatch)::before {
	content: "" !important;
	position: absolute !important;
	z-index: 8 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: var(--tpat-corner-size, 28px) !important;
	height: var(--tpat-corner-size, 28px) !important;
	background: var(--tpat-check-background, #a12e30) !important;
	clip-path: polygon(100% 0, 100% 100%, 0 100%) !important;
	pointer-events: none !important;
}

.wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch)::after,
.wcboost-variation-swatches__item[aria-checked="true"]:not(.tpat-soldout-swatch)::after {
	content: "\2713" !important;
	position: absolute !important;
	z-index: 9 !important;
	top: auto !important;
	right: 2px !important;
	bottom: 1px !important;
	left: auto !important;
	width: auto !important;
	height: auto !important;
	color: var(--tpat-check-color, #fff) !important;
	background: transparent !important;
	box-shadow: none !important;
	font-family: Arial, Helvetica, sans-serif !important;
	font-size: var(--tpat-check-size, 16px) !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	text-shadow: none !important;
	transform: none !important;
	pointer-events: none !important;
}

/* Hết hàng: làm mờ, dùng biểu tượng cấm nhỏ và khóa hoàn toàn thao tác. */
.wcboost-variation-swatches__item.tpat-soldout-swatch {
	position: relative !important;
	overflow: hidden !important;
	opacity: 1 !important;
	color: #aaa29d !important;
	background: #f3f3f3 !important;
	border-color: #ededed !important;
	box-shadow: none !important;
	cursor: not-allowed !important;
	filter: none !important;
	pointer-events: none !important;
	user-select: none;
}

.wcboost-variation-swatches__item.tpat-soldout-swatch:hover,
.wcboost-variation-swatches__item.tpat-soldout-swatch:focus,
.wcboost-variation-swatches__item.tpat-soldout-swatch.selected {
	color: #aaa29d !important;
	background: #f3f3f3 !important;
	border-color: #ededed !important;
	box-shadow: none !important;
}

.wcboost-variation-swatches__item.tpat-soldout-swatch::after {
	content: "" !important;
	position: absolute !important;
	z-index: 6 !important;
	top: 50% !important;
	left: 50% !important;
	width: 18px !important;
	height: 18px !important;
	background: rgba(255, 255, 255, 0.9) !important;
	border: 2px solid #d92f34 !important;
	border-radius: 50% !important;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7) !important;
	transform: translate(-50%, -50%) !important;
	transform-origin: center !important;
	pointer-events: none !important;
}

.wcboost-variation-swatches__item.tpat-soldout-swatch::before {
	content: "" !important;
	position: absolute !important;
	z-index: 7 !important;
	top: 50% !important;
	left: 50% !important;
	width: 13px !important;
	height: 2px !important;
	background: #d92f34 !important;
	border: 0 !important;
	box-shadow: none !important;
	transform: translate(-50%, -50%) rotate(45deg) !important;
	pointer-events: none !important;
}

.wcboost-variation-swatches__item.tpat-soldout-swatch .wcboost-variation-swatches__name {
	color: inherit !important;
	opacity: 0.38 !important;
}

.wcboost-variation-swatches__item.tpat-soldout-swatch img {
	opacity: 0.38 !important;
	filter: grayscale(1) !important;
}

body.single-product form.variations_form .wcboost-variation-swatches__wrapper > .wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch),
body.single-product form.variations_form .wcboost-variation-swatches__wrapper > .wcboost-variation-swatches__item[aria-pressed="true"]:not(.tpat-soldout-swatch) {
	color: var(--tpat-selected-color, #a12e30) !important;
	background: #fffafa !important;
	border-color: var(--tpat-selected-color, #a12e30) !important;
	box-shadow: inset 0 0 0 1px var(--tpat-selected-color, #a12e30) !important;
}

body.single-product form.variations_form .wcboost-variation-swatches__wrapper > .wcboost-variation-swatches__item.selected:not(.tpat-soldout-swatch) .wcboost-variation-swatches__name,
body.single-product form.variations_form .wcboost-variation-swatches__wrapper > .wcboost-variation-swatches__item[aria-pressed="true"]:not(.tpat-soldout-swatch) .wcboost-variation-swatches__name {
	color: var(--tpat-selected-color, #a12e30) !important;
}

/* Ảnh chính và ảnh thu nhỏ giống cách chọn ảnh trong video. */
.woocommerce-product-gallery img.tpat-image-changing {
	opacity: 0.72;
	transition: opacity 0.18s ease;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs img.flex-active {
	opacity: 1 !important;
	border: 2px solid var(--tpat-selected-color, #a12e30) !important;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9) inset !important;
}

/* Dải thumbnail mặc định chỉ có ảnh và từng xuất hiện phía trên ảnh lớn trên
 * desktop. TPAT dùng dải phân loại riêng có cả ảnh lẫn tên ở dưới ảnh lớn. */
body.single-product .woocommerce-product-gallery .flex-control-thumbs {
	display: none !important;
}

body.single-product .woocommerce-product-gallery__image a {
	cursor: zoom-in;
}

/* Cho phép thu nhỏ ảnh lớn mà không thay đổi kích thước khung gallery hoặc
 * cơ chế phóng to của theme. Giá trị 100% giữ nguyên giao diện hiện tại. */
body.single-product .woocommerce-product-gallery__image > a > img:not(.zoomImg),
body.single-product .woocommerce-product-gallery__image > img:not(.zoomImg) {
	display: block;
	width: var(--tpat-main-image-width, 100%) !important;
	max-width: 100% !important;
	height: auto !important;
	margin-right: auto !important;
	margin-left: auto !important;
}

body.single-product .woocommerce-product-gallery .flex-viewport {
	position: relative !important;
}

/* Nhãn tồn kho nổi giữa ảnh lớn như video Shopee. */
.tpat-main-soldout-badge {
	position: absolute;
	z-index: 40;
	top: 50%;
	left: 50%;
	display: inline-flex;
	visibility: hidden;
	align-items: center;
	justify-content: center;
	min-width: 104px;
	min-height: 104px;
	padding: 15px;
	color: #fff;
	background: rgba(28, 18, 17, 0.9);
	border-radius: 999px;
	font-size: 20px;
	font-weight: 500;
	line-height: 1.15;
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.92);
	transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
	pointer-events: none;
}

.tpat-main-soldout-badge.is-visible {
	visibility: visible;
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Dùng trình xem ảnh TPAT thay cho nút kính lúp cũ dễ lỗi khi jQuery tải chậm. */
body.single-product .woocommerce-product-gallery__trigger {
	display: none !important;
}

.tpat-variation-summary,
.tpat-quick-variants,
.tpat-variation-sheet,
.tpat-gallery-viewer {
	display: none;
}

@media (min-width: 0px) {
	html.tpat-sheet-open,
	html.tpat-sheet-open body,
	html.tpat-gallery-open,
	html.tpat-gallery-open body {
		overflow: hidden !important;
		overscroll-behavior: none;
	}

	body.single-product form.variations_form.tpat-swatch-ui-ready > table.variations {
		display: none !important;
	}

	/* Dải ảnh phân loại ở ngay dưới ảnh lớn. Chạm một ảnh sẽ đổi đồng bộ
	 * ảnh lớn và tên phân loại, nhưng vẫn yêu cầu chọn đủ thuộc tính khi mua. */
	.tpat-quick-variants {
		display: block;
		clear: both;
		width: 100%;
		margin: 10px 0 2px;
		padding: 0 2px;
		color: #34302e;
		background: #fff;
	}

	.tpat-quick-heading {
		display: flex;
		align-items: center;
		gap: 8px;
		clear: both;
		width: 100%;
		min-height: 25px;
		margin: 0 0 8px;
		padding: 0 2px;
		color: #34302e;
		background: #fff;
	}

	.tpat-quick-current-name {
		overflow: hidden;
		font-size: 14px;
		font-weight: 500;
		line-height: 1.3;
		text-overflow: ellipsis;
		text-transform: uppercase;
		white-space: nowrap;
	}

	.tpat-quick-soldout-text {
		display: none;
		flex: 0 0 auto;
		padding: 3px 7px;
		color: #fff;
		background: #2a1c1b;
		border-radius: 11px;
		font-size: 11px;
		font-weight: 600;
		line-height: 1;
	}

	.tpat-quick-heading.has-sold-out-selection .tpat-quick-soldout-text,
	.tpat-quick-variants.has-sold-out-selection .tpat-quick-soldout-text {
		display: inline-flex;
	}

	.tpat-quick-track {
		position: relative;
		display: grid;
		grid-template-columns: var(--tpat-arrow-size, 26px) minmax(0, 1fr) var(--tpat-arrow-size, 26px);
		gap: 4px;
		align-items: center;
		width: 100%;
		min-width: 0;
	}

	.tpat-quick-list {
		display: flex;
		flex-wrap: nowrap;
		gap: 5px;
		width: 100%;
		max-width: 100%;
		padding: 1px 2px 5px;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
		scroll-snap-type: x proximity;
		touch-action: pan-y;
		cursor: grab;
		user-select: none;
		-webkit-user-select: none;
		-webkit-overflow-scrolling: touch;
	}

	.tpat-quick-list.is-dragging {
		cursor: grabbing;
		scroll-snap-type: none;
	}

	.tpat-quick-list::-webkit-scrollbar {
		display: none;
	}

	.tpat-quick-nav {
		position: static;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: var(--tpat-arrow-size, 26px);
		height: var(--tpat-arrow-size, 26px);
		margin: 0;
		padding: 0 0 2px;
		color: #fff;
		background: var(--tpat-selected-color, #a12e30);
		border: 1px solid var(--tpat-selected-color, #a12e30);
		border-radius: 50%;
		box-shadow: 0 2px 7px rgba(36, 27, 24, 0.22);
		font-size: calc(var(--tpat-arrow-size, 26px) - 2px);
		font-weight: 500;
		line-height: 1;
		transform: none;
		transition: opacity 0.16s ease, visibility 0.16s ease;
		cursor: pointer;
	}

	.tpat-quick-prev {
		grid-column: 1;
		grid-row: 1;
	}

	.tpat-quick-list {
		grid-column: 2;
		grid-row: 1;
	}

	.tpat-quick-next {
		grid-column: 3;
		grid-row: 1;
	}

	.tpat-quick-nav:hover:not(:disabled),
	.tpat-quick-nav:focus:not(:disabled) {
		color: #fff;
		background: #842426;
		border-color: #842426;
		outline: none;
	}

	.tpat-quick-nav:disabled {
		visibility: hidden;
		opacity: 0;
		pointer-events: none;
	}

	.tpat-quick-item {
		position: relative;
		display: flex;
		flex: 0 0 var(--tpat-variant-image-size, 54px);
		flex-direction: column;
		align-items: stretch;
		width: var(--tpat-variant-image-size, 54px);
		min-width: var(--tpat-variant-image-size, 54px);
		min-height: var(--tpat-variant-image-size, 54px);
		height: auto;
		margin: 0;
		padding: 2px;
		overflow: hidden;
		background: #fff;
		border: 1px solid #e0dddb;
		border-radius: 3px;
		box-shadow: none;
		line-height: 1.25;
		scroll-snap-align: start;
		cursor: pointer;
		user-select: none;
		-webkit-user-select: none;
	}

	.tpat-quick-item:hover:not(.is-sold-out),
	.tpat-quick-item:focus:not(.is-sold-out),
	.tpat-quick-item.is-selected:not(.is-sold-out) {
		background: #fff;
		border-color: var(--tpat-selected-color, #a12e30);
		box-shadow: 0 0 0 1px var(--tpat-selected-color, #a12e30);
		outline: none;
	}

	.tpat-quick-item img {
		display: block;
		width: 100%;
		height: calc(var(--tpat-variant-image-size, 54px) - 6px);
		margin: 0;
		object-fit: cover;
		border: 0;
		border-radius: 1px;
		pointer-events: none;
		user-select: none;
		-webkit-user-drag: none;
		-webkit-user-select: none;
	}

	.tpat-quick-item.is-sold-out {
		opacity: 1;
		background: #f4f4f4;
		border-color: #ededed;
		cursor: pointer;
		pointer-events: auto;
	}

	.tpat-quick-item.is-sold-out:hover,
	.tpat-quick-item.is-sold-out:focus,
	.tpat-quick-item.is-sold-out.is-selected {
		border-color: #d92f34;
		box-shadow: 0 0 0 1px rgba(217, 47, 52, 0.14);
		outline: none;
	}

	.tpat-quick-item.is-sold-out img {
		opacity: 0.38;
		filter: grayscale(1);
	}

	.tpat-quick-item.is-sold-out::after {
		content: "";
		position: absolute;
		z-index: 6;
		top: 3px;
		right: 3px;
		left: auto;
		width: 14px;
		height: 14px;
		background: rgba(255, 255, 255, 0.9);
		border: 2px solid #d92f34;
		border-radius: 50%;
		box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
		transform: none;
		pointer-events: none;
	}

	.tpat-quick-item.is-sold-out::before {
		content: "";
		position: absolute;
		z-index: 7;
		top: 10px;
		right: 5px;
		left: auto;
		width: 10px;
		height: 2px;
		background: #d92f34;
		transform: translateY(-50%) rotate(45deg);
		pointer-events: none;
	}

	.tpat-screen-reader-text {
		position: absolute !important;
		width: 1px !important;
		height: 1px !important;
		padding: 0 !important;
		overflow: hidden !important;
		clip: rect(0, 0, 0, 0) !important;
		white-space: nowrap !important;
		border: 0 !important;
	}

	.tpat-variation-summary {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		gap: 10px;
		align-items: center;
		width: 100%;
		min-height: 54px;
		margin: 12px 0;
		padding: 12px 14px;
		color: #2f2925;
		background: #fff;
		border: 1px solid #e4e1df;
		border-radius: 4px;
		box-shadow: 0 2px 8px rgba(45, 35, 31, 0.04);
		font: inherit;
		text-align: left;
		cursor: pointer;
	}

	.tpat-variation-summary-label {
		font-weight: 700;
		white-space: nowrap;
	}

	.tpat-variation-summary-value {
		overflow: hidden;
		color: var(--tpat-selected-color, #a12e30);
		font-size: 13px;
		text-align: right;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.tpat-variation-summary-arrow {
		color: #8b7770;
		font-size: 27px;
		font-weight: 300;
		line-height: 1;
	}

	/* Bảng chọn phân loại trượt lên từ dưới màn hình. */
	.tpat-variation-sheet {
		position: fixed;
		z-index: 1000000;
		inset: 0;
		display: block;
		visibility: hidden;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease, visibility 0.2s ease;
	}

	.tpat-variation-sheet.is-open {
		visibility: visible;
		opacity: 1;
		pointer-events: auto;
	}

	.tpat-sheet-backdrop {
		position: absolute;
		inset: 0;
		background: rgba(0, 0, 0, 0.56);
	}

	.tpat-sheet-panel {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		max-height: min(90vh, 820px);
		padding: 0;
		overflow: hidden;
		color: #302824;
		background: #fff;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.22);
		transform: translateY(102%);
		transition: transform 0.25s cubic-bezier(0.22, 0.8, 0.26, 1);
	}

	.tpat-variation-sheet.is-open .tpat-sheet-panel {
		transform: translateY(0);
	}

	.tpat-sheet-close {
		position: absolute;
		z-index: 6;
		top: 10px;
		right: 10px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 42px;
		height: 42px;
		padding: 0;
		color: #8f8f8f;
		background: rgba(255, 255, 255, 0.94);
		border: 0;
		border-radius: 50%;
		box-shadow: none;
		font-family: Arial, sans-serif;
		font-size: 34px;
		font-weight: 300;
		line-height: 1;
		cursor: pointer;
	}

	.tpat-sheet-scroll {
		flex: 1 1 auto;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.tpat-sheet-product {
		display: flex;
		gap: 14px;
		align-items: flex-end;
		min-height: 146px;
		padding: 16px 58px 16px 18px;
		background: #fff;
		border-bottom: 1px solid #e9e9e9;
	}

	.tpat-sheet-preview {
		position: relative;
		flex: 0 0 112px;
		width: 112px;
		height: 112px;
		padding: 0;
		overflow: visible;
		background: #fff;
		border: 1px solid #e0e0e0;
		border-radius: 6px;
		box-shadow: none;
		cursor: zoom-in;
	}

	.tpat-sheet-product-image {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		border-radius: 5px;
	}

	.tpat-sheet-expand {
		position: absolute;
		top: -7px;
		right: -7px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 30px;
		height: 30px;
		color: #fff;
		background: rgba(79, 79, 79, 0.86);
		border-radius: 50%;
		font-size: 19px;
		line-height: 1;
	}

	.tpat-sheet-product-info {
		min-width: 0;
		padding-bottom: 4px;
	}

	.tpat-sheet-price,
	.tpat-sheet-price .amount,
	.tpat-sheet-price ins {
		color: var(--tpat-selected-color, #a12e30) !important;
		font-size: 22px !important;
		font-weight: 700 !important;
		text-decoration: none !important;
	}

	.tpat-sheet-price del,
	.tpat-sheet-price del .amount {
		color: #a0a0a0 !important;
		font-size: 13px !important;
		font-weight: 400 !important;
	}

	.tpat-sheet-stock {
		margin-top: 7px;
		color: #777;
		font-size: 15px;
	}

	.tpat-sheet-groups {
		padding: 0 18px;
	}

	.tpat-sheet-group {
		padding: 17px 0 15px;
		border-bottom: 1px solid #eeeeee;
	}

	.tpat-sheet-group h3 {
		margin: 0 0 12px;
		color: #292929;
		font-size: 15px;
		font-weight: 500;
		text-transform: uppercase;
	}

	.tpat-sheet-options {
		display: flex;
		flex-wrap: wrap;
		gap: 9px;
	}

	.tpat-sheet-option {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 42px;
		max-width: 100%;
		padding: 7px 13px;
		overflow: hidden;
		color: #3a3a3a;
		background: #f5f5f5;
		border: 1px solid transparent;
		border-radius: 4px;
		font-family: inherit;
		font-size: 13px;
		font-weight: 500;
		line-height: 1.25;
		text-align: center;
		text-transform: none;
		cursor: pointer;
	}

	/* Theme FurMart tô đỏ nút đang focus/hover trên Android. Chỉ ô có class
	 * selected mới được mang viền đỏ để không xuất hiện hai phân loại cùng lúc. */
	body.single-product .tpat-sheet-option:not(.selected):not(.tpat-soldout-swatch):hover,
	body.single-product .tpat-sheet-option:not(.selected):not(.tpat-soldout-swatch):focus,
	body.single-product .tpat-sheet-option:not(.selected):not(.tpat-soldout-swatch):active {
		color: #3a3a3a !important;
		background: #f5f5f5 !important;
		border-color: transparent !important;
		box-shadow: none !important;
		outline: 0 !important;
	}

	body.single-product .tpat-sheet-option:not(.selected):focus-visible {
		outline: 2px solid #777 !important;
		outline-offset: 2px !important;
	}

	.tpat-sheet-option img {
		width: 31px;
		height: 31px;
		margin: -3px 8px -3px -7px;
		object-fit: cover;
		border: 1px solid #e8e8e8;
		border-radius: 2px;
	}

	.tpat-sheet-option.selected:not(.tpat-soldout-swatch) {
		color: var(--tpat-selected-color, #a12e30);
		background: #fff;
		border-color: var(--tpat-selected-color, #a12e30);
		box-shadow: inset 0 0 0 1px var(--tpat-selected-color, #a12e30);
	}

	.tpat-sheet-option.selected:not(.tpat-soldout-swatch)::before {
		content: "";
		position: absolute;
		right: 0;
		bottom: 0;
		width: var(--tpat-corner-size, 28px);
		height: var(--tpat-corner-size, 28px);
		background: var(--tpat-check-background, #a12e30);
		clip-path: polygon(100% 0, 100% 100%, 0 100%);
		pointer-events: none;
	}

	.tpat-sheet-option.selected:not(.tpat-soldout-swatch)::after {
		content: "\2713";
		position: absolute;
		right: 2px;
		bottom: 1px;
		color: var(--tpat-check-color, #fff);
		font: 700 var(--tpat-check-size, 16px)/1 Arial, sans-serif;
		pointer-events: none;
	}

	.tpat-sheet-option.tpat-soldout-swatch {
		opacity: 1;
		color: #aaa29d;
		background: #f3f3f3;
		border-color: #ededed;
		cursor: not-allowed;
		pointer-events: none;
	}

	.tpat-sheet-option.tpat-soldout-swatch::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		z-index: 4;
		width: 18px;
		height: 18px;
		background: rgba(255, 255, 255, 0.9);
		border: 2px solid #d92f34;
		border-radius: 50%;
		box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
		transform: translate(-50%, -50%);
		pointer-events: none;
	}

	.tpat-sheet-option.tpat-soldout-swatch::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		z-index: 5;
		width: 13px;
		height: 2px;
		background: #d92f34;
		transform: translate(-50%, -50%) rotate(45deg);
		pointer-events: none;
	}

	.tpat-sheet-option.tpat-soldout-swatch img,
	.tpat-sheet-option.tpat-soldout-swatch span {
		opacity: 0.38;
		filter: grayscale(1);
	}

	.tpat-purchase-notice {
		position: fixed;
		right: 18px;
		bottom: 86px;
		left: 18px;
		z-index: 1000002;
		padding: 12px 16px;
		color: #fff;
		background: #2f8a48;
		border-radius: 7px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
		font-size: 14px;
		font-weight: 600;
		text-align: center;
		opacity: 0;
		pointer-events: none;
		transform: translateY(12px);
		transition: opacity 0.2s ease, transform 0.2s ease;
	}

	.tpat-purchase-notice.is-visible {
		opacity: 1;
		transform: translateY(0);
	}

	.tpat-purchase-notice.is-error {
		background: #a12e30;
	}

	.tpat-sheet-quantity {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 18px;
		padding: 18px;
		color: #333;
		background: #fff;
		border-bottom: 1px solid #eee;
	}

	.tpat-sheet-quantity-label {
		font-size: 16px;
		font-weight: 500;
	}

	.tpat-sheet-quantity-control {
		display: grid;
		grid-template-columns: 44px 54px 44px;
		height: 42px;
		overflow: hidden;
		border: 1px solid #dedede;
		border-radius: 5px;
	}

	.tpat-sheet-quantity-control button,
	.tpat-sheet-quantity-control input {
		width: 100%;
		height: 100%;
		margin: 0;
		padding: 0;
		color: #444;
		background: #fff;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		font-size: 22px;
		line-height: 1;
		text-align: center;
	}

	.tpat-sheet-quantity-control input {
		-moz-appearance: textfield;
		color: var(--tpat-selected-color, #a12e30);
		border-right: 1px solid #dedede;
		border-left: 1px solid #dedede;
		font-size: 16px;
		font-weight: 600;
	}

	.tpat-sheet-quantity-control input::-webkit-inner-spin-button,
	.tpat-sheet-quantity-control input::-webkit-outer-spin-button {
		margin: 0;
		-webkit-appearance: none;
	}

	.tpat-sheet-quantity-control button:disabled,
	.tpat-sheet-quantity-control input:disabled {
		color: #cfcfcf;
		background: #fafafa;
		cursor: not-allowed;
	}

	.tpat-sheet-footer {
		flex: 0 0 auto;
		padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
		background: #fff;
		border-top: 1px solid #eee;
		box-shadow: 0 -5px 16px rgba(0, 0, 0, 0.05);
	}

	.tpat-sheet-action {
		width: 100%;
		min-height: 50px;
		padding: 12px 18px;
		color: #fff;
		background: var(--tpat-selected-color, #a12e30);
		border: 0;
		border-radius: 4px;
		box-shadow: none;
		font-family: inherit;
		font-size: 15px;
		font-weight: 700;
		letter-spacing: 0.2px;
		cursor: pointer;
	}

	.tpat-sheet-action:disabled {
		color: #fff;
		background: #bdbdbd;
		cursor: not-allowed;
	}

	/* Trình xem ảnh toàn màn hình độc lập, có thẻ sản phẩm và Mua ngay. */
	.tpat-gallery-viewer {
		position: fixed;
		z-index: 1000001;
		inset: 0;
		display: flex;
		visibility: hidden;
		flex-direction: column;
		color: #fff;
		background: #000;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease, visibility 0.2s ease;
	}

	.tpat-gallery-viewer.is-open {
		visibility: visible;
		opacity: 1;
		pointer-events: auto;
	}

	.tpat-gallery-topbar {
		position: absolute;
		z-index: 4;
		top: 0;
		right: 0;
		left: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 68px;
		padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
		background: linear-gradient(180deg, rgba(0, 0, 0, 0.66), transparent);
	}

	.tpat-gallery-back,
	.tpat-gallery-prev,
	.tpat-gallery-next {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 0;
		color: #fff;
		background: rgba(0, 0, 0, 0.28);
		border: 0;
		border-radius: 50%;
		box-shadow: none;
		font-family: Arial, sans-serif;
		cursor: pointer;
	}

	.tpat-gallery-back {
		width: 46px;
		height: 46px;
		font-size: 34px;
		font-weight: 300;
	}

	.tpat-gallery-counter {
		padding: 6px 12px;
		color: #fff;
		background: rgba(25, 25, 25, 0.72);
		border: 1px solid rgba(255, 255, 255, 0.18);
		border-radius: 18px;
		font-size: 14px;
	}

	.tpat-gallery-stage {
		position: relative;
		display: flex;
		flex: 1 1 auto;
		align-items: center;
		justify-content: center;
		min-height: 0;
		padding: 76px 14px 178px;
		overflow: hidden;
		background: #000;
		touch-action: pan-y;
	}

	.tpat-gallery-image {
		display: block;
		max-width: 100%;
		max-height: 100%;
		object-fit: contain;
		user-select: none;
		-webkit-user-drag: none;
		transition: opacity 0.16s ease;
	}

	.tpat-gallery-image.is-changing {
		opacity: 0.7;
	}

	.tpat-gallery-prev,
	.tpat-gallery-next {
		position: absolute;
		z-index: 2;
		top: 50%;
		width: 44px;
		height: 44px;
		font-size: 38px;
		transform: translateY(-50%);
	}

	.tpat-gallery-prev {
		left: 12px;
	}

	.tpat-gallery-next {
		right: 12px;
	}

	.tpat-gallery-bottom {
		position: absolute;
		z-index: 4;
		right: 0;
		bottom: 0;
		left: 0;
		padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
		background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), transparent);
	}

	.tpat-gallery-product-card {
		display: grid;
		grid-template-columns: 66px minmax(0, 1fr);
		gap: 8px 12px;
		align-items: center;
		width: min(680px, 100%);
		margin: 0 auto;
		padding: 10px;
		color: #222;
		background: #fff;
		border-radius: 14px;
		box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
	}

	.tpat-gallery-product-thumb {
		grid-row: 1 / span 2;
		width: 66px;
		height: 66px;
		object-fit: cover;
		border: 1px solid #e8e8e8;
		border-radius: 5px;
	}

	.tpat-gallery-product-info {
		min-width: 0;
	}

	.tpat-gallery-product-price,
	.tpat-gallery-product-price .amount,
	.tpat-gallery-product-price ins {
		color: var(--tpat-selected-color, #a12e30) !important;
		font-size: 18px !important;
		font-weight: 700 !important;
		text-decoration: none !important;
	}

	.tpat-gallery-product-price del,
	.tpat-gallery-product-price del .amount {
		color: #999 !important;
		font-size: 11px !important;
		font-weight: 400 !important;
	}

	.tpat-gallery-product-title {
		overflow: hidden;
		color: #333;
		font-size: 13px;
		line-height: 1.3;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.tpat-gallery-buy {
		grid-column: 2;
		min-height: 38px;
		padding: 8px 16px;
		color: #fff;
		background: var(--tpat-selected-color, #a12e30);
		border: 0;
		border-radius: 5px;
		font-size: 14px;
		font-weight: 700;
		cursor: pointer;
	}

	.tpat-gallery-buy::before {
		content: "🛒";
		margin-right: 7px;
	}

	.tpat-gallery-dots {
		display: flex;
		gap: 5px;
		justify-content: center;
		width: min(680px, 100%);
		margin: 10px auto 0;
		overflow: hidden;
	}

	.tpat-gallery-dot {
		flex: 0 1 28px;
		height: 3px;
		background: rgba(255, 255, 255, 0.35);
		border-radius: 2px;
	}

	.tpat-gallery-dot.is-active {
		background: #fff;
	}
}

/* Thanh mua được tạo cho mọi trang biến thể nhưng chỉ hiển thị trên mobile. */
.tpat-mobile-purchase-bar {
	display: none;
}

@media (max-width: 767px) {
	body.single-product.tpat-sticky-buy-visible {
		padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important;
	}

	html.tpat-cart-sidebar-open body.single-product {
		padding-bottom: 0 !important;
	}

	.tpat-mobile-purchase-bar {
		position: fixed;
		z-index: 999990;
		right: 0;
		bottom: 0;
		left: 0;
		display: grid;
		visibility: hidden;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
		padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, 0.98);
		border-top: 1px solid #e9e2de;
		box-shadow: 0 -5px 18px rgba(43, 31, 27, 0.14);
		opacity: 0;
		transform: translateY(105%);
		transition: opacity 0.2s ease, transform 0.22s ease, visibility 0.2s ease;
		pointer-events: none;
	}

	.tpat-mobile-purchase-bar.is-visible {
		visibility: visible;
		opacity: 1;
		transform: translateY(0);
		pointer-events: auto;
	}

	html.tpat-sheet-open .tpat-mobile-purchase-bar,
	html.tpat-gallery-open .tpat-mobile-purchase-bar,
	html.tpat-cart-sidebar-open .tpat-mobile-purchase-bar {
		visibility: hidden;
		opacity: 0;
		transform: translateY(105%);
		pointer-events: none;
	}

	.tpat-mobile-purchase-bar button {
		min-height: 48px;
		margin: 0;
		padding: 9px 7px;
		border-radius: 4px;
		box-shadow: none;
		font-family: inherit;
		font-size: 13px;
		font-weight: 700;
		line-height: 1.2;
		cursor: pointer;
	}

	.tpat-sticky-add {
		color: var(--tpat-selected-color, #a12e30);
		background: #fff8f5;
		border: 1px solid var(--tpat-selected-color, #a12e30);
	}

	.tpat-sticky-buy {
		color: #fff;
		background: var(--tpat-selected-color, #a12e30);
		border: 1px solid var(--tpat-selected-color, #a12e30);
	}

	.tpat-quick-variants {
		margin-top: 9px;
		padding-right: 12px;
		padding-left: 12px;
	}

	.tpat-main-soldout-badge {
		min-width: 94px;
		min-height: 94px;
		font-size: 18px;
	}

	.tpat-gallery-prev,
	.tpat-gallery-next {
		display: none;
	}

	.tpat-sheet-panel {
		max-height: 92vh;
	}

}

@media (min-width: 480px) {
	.tpat-gallery-product-card {
		grid-template-columns: 74px minmax(0, 1fr) 150px;
		gap: 8px 12px;
	}

	.tpat-gallery-product-thumb {
		grid-row: 1 / span 2;
		width: 74px;
		height: 74px;
	}

	.tpat-gallery-product-info {
		grid-column: 2;
		grid-row: 1 / span 2;
	}

	.tpat-gallery-buy {
		grid-column: 3;
		grid-row: 1 / span 2;
		align-self: stretch;
	}
}

@media (min-width: 768px) {
	.tpat-sheet-panel {
		right: auto;
		left: 50%;
		width: min(560px, calc(100vw - 48px));
		max-height: min(86vh, 820px);
		border-radius: 16px;
		transform: translate(-50%, 104%);
	}

	.tpat-variation-sheet.is-open .tpat-sheet-panel {
		transform: translate(-50%, -24px);
	}

	.tpat-sheet-footer {
		padding-bottom: 16px;
	}

	.tpat-gallery-stage {
		padding-right: 72px;
		padding-left: 72px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tpat-variation-sheet,
	.tpat-sheet-panel,
	.tpat-gallery-viewer,
	.tpat-gallery-image,
	.woocommerce-product-gallery img.tpat-image-changing {
		transition: none !important;
	}
}
