/* AG Trang sản phẩm – Author: August - https://augustcsgo.com */

/* ---------- Khung ưu đãi ---------- */
.ag-px-offers {
	--ag-px: #0f9d6c;
	margin: 12px 0 18px;
	overflow: hidden;
	background: #fff;
	border: 1.5px dashed color-mix(in srgb, var(--ag-px) 55%, #fff);
	border-radius: 12px;
}

.ag-px-offers__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 14px;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #fff;
	background: linear-gradient(90deg, var(--ag-px), color-mix(in srgb, var(--ag-px) 60%, #4cc38a));
}

.ag-px-offers__head svg {
	flex: 0 0 auto;
	color: #fde68a;
}

.ag-px-offers__list {
	margin: 0;
	padding: 10px 14px 12px;
	list-style: none;
}

.ag-px-offers__list li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 7px;
	padding: 0;
	font-size: 14px;
	line-height: 1.45;
	color: #1f2937;
	list-style: none;
}

.ag-px-offers__list li:last-child {
	margin-bottom: 0;
}

.ag-px-offers__num {
	display: inline-flex;
	flex: 0 0 22px;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	font-size: 12px;
	font-weight: 800;
	color: #fff;
	background: var(--ag-px);
	border-radius: 50%;
}

/* ---------- Hàng chính sách ---------- */
.ag-px-policies {
	--ag-px: #0f9d6c;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin: 14px 0 18px;
	padding: 0;
	list-style: none;
}

.ag-px-policies li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 9px 12px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	color: #1f2937;
	list-style: none;
	background: color-mix(in srgb, var(--ag-px) 7%, #fff);
	border-radius: 10px;
}

.ag-px-policies__icon {
	display: inline-flex;
	flex: 0 0 34px;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	color: var(--ag-px);
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ---------- Xem thêm / Thu gọn ---------- */
.ag-px-collapse {
	position: relative;
}

.ag-px-collapse.is-collapsible:not(.is-open) .ag-px-collapse__inner {
	position: relative;
	max-height: var(--ag-px-h, 420px);
	overflow: hidden;
}

/* Lớp mờ bám đúng mép dưới phần mô tả đang bị thu gọn */
.ag-px-collapse.is-collapsible:not(.is-open) .ag-px-collapse__inner::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 120px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 88%);
	pointer-events: none;
}

.ag-px-collapse__fade,
.ag-px-collapse.is-collapsible:not(.is-open) .ag-px-collapse__fade {
	display: none;
}

.ag-px-collapse__btn {
	display: none;
	align-items: center;
	gap: 6px;
	margin: 14px auto 0;
	padding: 9px 26px;
	font-size: 14px;
	font-weight: 700;
	text-transform: none;
	color: #0f9d6c;
	background: #fff;
	border: 1.5px solid #0f9d6c;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ag-px-collapse.is-collapsible .ag-px-collapse__btn {
	display: flex;
}

.ag-px-collapse__btn:hover {
	color: #fff;
	background: #0f9d6c;
}

.ag-px-collapse__btn::after {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
	transition: transform 0.2s ease;
}

.ag-px-collapse.is-open .ag-px-collapse__btn::after {
	transform: translateY(2px) rotate(-135deg);
}

.ag-px-collapse .ag-px-less,
.ag-px-collapse.is-open .ag-px-more {
	display: none;
}

.ag-px-collapse.is-open .ag-px-less {
	display: inline;
}

.ag-px-tab ul {
	margin-left: 1.2em;
}

@media (max-width: 549px) {
	.ag-px-policies {
		grid-template-columns: 1fr 1fr;
	}

	.ag-px-policies li {
		padding: 8px;
		font-size: 12px;
	}

	.ag-px-policies__icon {
		flex-basis: 30px;
		width: 30px;
		height: 30px;
	}
}

/* Bỏ thụt lề danh sách mặc định của Flatsome */
ul.ag-px-policies {
	margin-left: 0 !important;
	padding-left: 0 !important;
}

ol.ag-px-offers__list {
	margin-left: 0 !important;
	padding: 10px 14px 12px !important;
}

.ag-px-policies li,
.ag-px-offers__list li {
	margin-left: 0 !important;
}

.ag-px-offers__list li {
	margin-bottom: 7px !important;
}

.ag-px-offers__list li:last-child {
	margin-bottom: 0 !important;
}


/* =====================================================================
 * Bố cục trang sản phẩm (ảnh trái – thẻ mua phải – Thông tin sản phẩm)
 * ===================================================================== */
.ag-pp .product-main {
	padding-top: 24px;
}

.ag-pp__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "gallery" "summary" "extras";
	gap: 20px;
}

.ag-pp__gallery { grid-area: gallery; min-width: 0; }
.ag-pp__summary { grid-area: summary; min-width: 0; }
.ag-pp__extras { grid-area: extras; min-width: 0; }
.ag-pp__gallery .product-images { margin-bottom: 0; }
.ag-pp .product-gallery { padding: 0; }

@media (min-width: 850px) {
	.ag-pp__grid {
		grid-template-columns: minmax(0, var(--ag-pp-left, 55%)) minmax(0, 1fr);
		column-gap: 36px;
		row-gap: 28px;
	}

	/* Ghim khối mua bên phải */
	.ag-pp--olivo .ag-pp__grid {
		grid-template-areas: "gallery summary" "extras summary";
		grid-template-rows: auto 1fr;
	}

	.ag-pp--olivo .ag-pp__card {
		position: sticky;
		top: calc(var(--flatsome-scroll-padding-top, 0px) + 20px);
		max-height: calc(100vh - var(--flatsome-scroll-padding-top, 0px) - 40px);
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}

	/* Ghim ảnh bên trái */
	.ag-pp--pin_gallery .ag-pp__grid {
		grid-template-areas: "gallery summary" "gallery extras";
		grid-template-rows: auto 1fr;
	}

	.ag-pp--pin_gallery .ag-pp__gallery-inner {
		position: sticky;
		top: calc(var(--flatsome-scroll-padding-top, 0px) + 20px);
	}

	.ag-pp__extras { align-self: start; }
}

/* Thẻ khối mua */
.ag-pp .ag-pp__card.product-info {
	padding: 22px 24px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 14px;
	box-shadow: 0 6px 24px rgba(15, 157, 108, 0.07);
}

.ag-pp .ag-pp__card > :last-child { margin-bottom: 0; }
.ag-pp .ag-pp__card .product-title { margin-bottom: 8px; }

/* Ô số lượng: chống CSS form của theme đẩy mất chữ */
.ag-pp .quantity input.qty {
	min-width: 2.6em;
	padding: 0 !important;
	text-align: center;
}

/* Khu dưới ảnh */
.ag-pp__extras .ag-px-offers { margin: 0 0 20px; }
.ag-pp__extras > :last-child { margin-bottom: 0; }

/* Thẻ "Thông tin sản phẩm" */
.ag-pp-desc {
	padding: 22px 24px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 14px;
}

.ag-pp-desc__title {
	position: relative;
	margin: 0 0 16px;
	padding-bottom: 12px;
	font-size: 18px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--ag-px, #0f9d6c);
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ag-pp-desc__title::after {
	content: "";
	position: absolute;
	bottom: -1px;
	left: 0;
	width: 56px;
	height: 3px;
	background: var(--ag-px, #0f9d6c);
	border-radius: 3px;
}

.ag-pp-desc__body {
	position: relative;
	overflow: hidden;
	transition: max-height 0.35s ease;
}

.ag-pp-desc__body img { max-width: 100%; height: auto; }

.ag-pp-desc.is-collapsed .ag-pp-desc__body::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 120px;
	background: linear-gradient(rgba(255, 255, 255, 0), #fff);
	pointer-events: none;
}

.ag-pp-desc__toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 14px auto 0;
	padding: 9px 28px;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--ag-px, #0f9d6c);
	background: #fff;
	border: 1.5px solid var(--ag-px, #0f9d6c);
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.ag-pp-desc__toggle::after {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
}

.ag-pp-desc__toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.ag-pp-desc__toggle:hover { color: #fff; background: var(--ag-px, #0f9d6c); }
.ag-pp-desc__toggle[hidden] { display: none; }

/* Mô tả ngắn trong khối mua: rút gọn N dòng (dùng max-height vì có nhiều đoạn) */
.ag-pp--clamp .ag-pp__card .product-short-description,
.ag-pp--clamp .ag-pp__card .woocommerce-product-details__short-description {
	position: relative;
	max-height: calc(var(--ag-pp-lines, 4) * 1.65em);
	margin-bottom: 1em;
	overflow: hidden;
	line-height: 1.65;
}

.ag-pp--clamp .ag-pp__card .product-short-description.is-clamped::after,
.ag-pp--clamp .ag-pp__card .woocommerce-product-details__short-description.is-clamped::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 1.65em;
	background: linear-gradient(rgba(255, 255, 255, 0), #fff);
	pointer-events: none;
}

.ag-pp--clamp .ag-pp__card .product-short-description p { margin: 0 0 0.4em; }
.ag-pp--clamp .ag-pp__card .product-short-description.is-open,
.ag-pp--clamp .ag-pp__card .woocommerce-product-details__short-description.is-open { max-height: none; }
.ag-pp--clamp .ag-pp__card .is-open::after { display: none; }

.ag-pp-excerpt-toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 0;
	margin: -6px 0 14px;
	padding: 0;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: none;
	color: var(--ag-px, #0f9d6c);
	background: none;
	border: 0;
	box-shadow: none;
	cursor: pointer;
}

.ag-pp-excerpt-toggle::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s;
}

.ag-pp-excerpt-toggle[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(-135deg); }
.ag-pp-excerpt-toggle:hover { color: var(--ag-px, #0f9d6c); background: none; text-decoration: underline; }

@media (max-width: 849px) {
	.ag-pp .product-main { padding-top: 12px; }
	.ag-pp .ag-pp__card.product-info,
	.ag-pp-desc { padding: 16px; }
}
