/* AG Swatches – Author: August - https://augustcsgo.com */

/* ---------- Chấm màu dùng chung ---------- */
.ag-sw-dot {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var(--ag-sw-size, 20px);
	height: var(--ag-sw-size, 20px);
	min-height: 0;
	margin: 0;
	padding: 0;
	font-size: calc(var(--ag-sw-size, 20px) * 0.45);
	font-weight: 700;
	line-height: 1;
	color: #374151;
	background-color: var(--ag-sw-c, #f3f4f6);
	background-position: center;
	background-size: cover;
	border: 0;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, 0.08);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ag-sw-dot:hover,
.ag-sw-dot:focus-visible {
	transform: scale(1.1);
	outline: none;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 0 2px #fff, 0 0 0 3.5px #0f9d6c;
}

.ag-sw-dot.is-active,
.ag-sw-dot.is-selected {
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 0 2px #fff, 0 0 0 4px #0f9d6c;
}

/* Hết hàng: mờ + gạch chéo */
.ag-sw-dot.is-out,
.ag-sw-btn.is-out {
	opacity: 0.45;
}

.ag-sw-dot.is-out::after,
.ag-sw-btn.is-out::after {
	content: "";
	position: absolute;
	top: 50%;
	left: -2px;
	right: -2px;
	height: 1.5px;
	background: #dc2626;
	transform: rotate(-45deg);
}

/* ---------- Trang danh sách: hàng chấm màu, vuốt ngang ---------- */
.ag-sw-loop {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 8px 0 6px;
	min-height: calc(var(--ag-sw-size, 20px) + 8px);
}

.ag-sw-loop__track {
	display: flex;
	gap: calc(var(--ag-sw-size, 20px) * 0.45);
	max-width: calc(var(--ag-sw-max, 5) * var(--ag-sw-size, 20px) * 1.45 + 4px);
	padding: 4px;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.ag-sw-loop__track::-webkit-scrollbar {
	display: none;
}

.ag-sw-loop__track .ag-sw-dot {
	scroll-snap-align: start;
}

.ag-sw-loop__more {
	flex: 0 0 auto;
	min-height: 0;
	margin: 0;
	padding: 2px 7px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
	color: #0b6b4a;
	background: #e7f8ef;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.ag-sw-loop__more.is-done {
	opacity: 0;
	pointer-events: none;
}

/* Flatsome căn giữa khung chữ */
.box-text.text-center .ag-sw-loop,
.text-center .ag-sw-loop {
	justify-content: center;
}

/* ---------- Trang sản phẩm ---------- */
.ag-sw-select-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
}

.ag-sw-single {
	margin: 0;
}

/* Bảng biến thể: căn tên thuộc tính thẳng hàng với chấm / nút */
.variations_form table.variations th.label,
.variations_form table.variations td.label,
.variations_form table.variations td.value {
	padding-top: 6px;
	padding-bottom: 6px;
	vertical-align: middle;
}

.variations_form table.variations th.label label,
.variations_form table.variations td.label label {
	margin: 0;
	white-space: nowrap;
}

.ag-sw-label-value {
	font-weight: 600;
	color: #0b6b4a;
}

.ag-sw-single__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 4px;
}

.ag-sw-btn {
	position: relative;
	min-width: 44px;
	min-height: 0;
	margin: 0;
	padding: 7px 14px;
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.3;
	text-transform: none;
	color: #1f2937;
	background: #fff;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.ag-sw-btn:hover {
	border-color: #0f9d6c;
}

.ag-sw-btn.is-selected {
	color: #fff;
	background: #0f9d6c;
	border-color: #0f9d6c;
}

.ag-sw-opt.is-disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* Bảng biến thể: căn label với hàng swatch */
.variations td.value .ag-sw-single + .reset_variations {
	display: inline-block;
	margin-top: 4px;
}

/* ---------- Nhãn giảm giá (4 kiểu) ---------- */
.badge-container:has(.ag-ribbon-wrap),
.badge-container:has(.ag-sale) {
	top: 0 !important;
	left: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* 1. Ruy băng chéo */
.ag-ribbon-wrap {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 3;
	width: 108px;
	height: 108px;
	overflow: hidden;
	pointer-events: none;
}

.ag-ribbon {
	position: absolute;
	top: 24px;
	left: -40px;
	display: block;
	width: 160px;
	padding: 5px 0;
	font-size: 12px;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: 0.02em;
	text-align: center;
	text-transform: uppercase;
	white-space: nowrap;
	color: #fff;
	background: var(--ag-rb, #ef4444);
	background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.08));
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
	transform: rotate(-45deg);
}

.badge-container.is-larger .ag-ribbon-wrap {
	width: 140px;
	height: 140px;
}

.badge-container.is-larger .ag-ribbon {
	top: 32px;
	left: -48px;
	width: 210px;
	padding: 7px 0;
	font-size: 15px;
}

/* 2. Viên thuốc */
.ag-sale {
	position: absolute;
	z-index: 3;
	font-weight: 800;
	line-height: 1.25;
	white-space: nowrap;
	color: #fff;
	pointer-events: none;
}

.ag-sale--pill {
	top: 10px;
	left: 10px;
	padding: 4px 10px;
	font-size: 12px;
	background: var(--ag-rb, #ef4444);
	background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(249, 115, 22, 0.55));
	border-radius: 999px;
	box-shadow: 0 3px 8px rgba(239, 68, 68, 0.35);
}

/* 3. Thẻ góc */
.ag-sale--corner {
	top: 0;
	left: 0;
	padding: 5px 10px 6px;
	font-size: 13px;
	background: var(--ag-rb, #ef4444);
	border-radius: 8px 0 12px 0;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.ag-sale--corner small {
	display: block;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.1em;
	opacity: 0.9;
}

.badge-container.is-larger .ag-sale--pill,
.badge-container.is-larger .ag-sale--corner {
	font-size: 15px;
}

/* 4. % nhỏ cạnh giá */
.ag-price-pct {
	display: inline-block;
	margin-left: 4px;
	padding: 0 6px;
	font-size: 0.8em;
	font-weight: 700;
	line-height: 1.6;
	vertical-align: middle;
	color: #dc2626;
	background: #fee2e2;
	border-radius: 4px;
}

@media (max-width: 549px) {
	.ag-ribbon-wrap {
		width: 90px;
		height: 90px;
	}

	.ag-ribbon {
		top: 19px;
		left: -36px;
		width: 136px;
		padding: 4px 0;
		font-size: 10px;
	}

	.ag-sale--pill,
	.ag-sale--corner {
		font-size: 11px;
	}
}
