/* 03-components: thành phần dùng ở nhiều trang. Di động trước. */

/* ---------- Nút ---------- */
.mas-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--mas-space-2);
	min-height: var(--mas-tap);
	padding: var(--mas-space-2) var(--mas-space-5);
	border: 1px solid transparent;
	border-radius: var(--mas-radius-sm);
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.mas-btn--primary {
	background: var(--mas-color-accent);
	color: #fff;
}

.mas-btn--primary:hover {
	background: var(--mas-color-accent-dark);
	color: #fff;
}

.mas-btn--outline {
	background: transparent;
	border-color: var(--mas-color-primary);
	color: var(--mas-color-primary);
}

.mas-btn--dark {
	background: var(--mas-color-text);
	color: #fff;
}

.mas-btn--dark:hover {
	background: #000;
	color: #fff;
}

.mas-btn.disabled,
.mas-btn[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
}

.mas-btn--block {
	width: 100%;
}

/* ---------- Nhãn nhỏ (Mới, Bán chạy, -20%) ---------- */
.mas-badge {
	display: inline-block;
	padding: 2px var(--mas-space-2);
	border-radius: var(--mas-radius-pill);
	background: var(--mas-color-primary-soft);
	color: var(--mas-color-primary-dark);
	font-size: var(--mas-text-sm);
	font-weight: 700;
}

.mas-badge--sale {
	background: var(--mas-color-accent);
	color: #fff;
}

/* ---------- Khung cảnh báo bắt buộc (thực phẩm bảo vệ sức khỏe) ---------- */
.mas-health-notice {
	margin-block: var(--mas-space-4);
	padding: var(--mas-space-3) var(--mas-space-4);
	border: 1px solid var(--mas-color-border);
	border-left: 4px solid var(--mas-color-accent);
	border-radius: var(--mas-radius);
	background: var(--mas-color-bg-soft);
	font-size: var(--mas-text-sm);
	line-height: 1.5;
}

.mas-health-notice__title {
	display: block;
	font-weight: 700;
}

.mas-health-notice__meta {
	margin-top: var(--mas-space-1);
	color: var(--mas-color-muted);
}

/* ---------- Thẻ sản phẩm .mas-card (cửa hàng, danh mục, liên quan, trang chủ) ---------- */
/* ghi đè Kadence/WooCommerce: mọi selector của thẻ bắt đầu bằng
   .woocommerce ul.products li.product.mas-card để ngang độ cụ thể với Kadence (file này nạp sau nên thắng) */
.woocommerce ul.products li.product.mas-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--mas-color-border);
	border-radius: var(--mas-radius);
	background: var(--mas-color-bg);
}

.woocommerce ul.products li.product.mas-card .woocommerce-loop-image-link img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	margin: 0;
}

.woocommerce ul.products li.product.mas-card .product-details {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: var(--mas-space-1);
	padding: var(--mas-space-2) var(--mas-space-3) var(--mas-space-3);
}

/* Tên: tối đa 2 dòng */
.woocommerce ul.products li.product.mas-card .woocommerce-loop-product__title {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	padding: 0;
	font-size: var(--mas-text-sm);
	font-weight: 600;
	line-height: 1.4;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.woocommerce ul.products li.product.mas-card .woocommerce-loop-product__title a {
	color: var(--mas-color-text);
}

.woocommerce ul.products li.product.mas-card .price {
	margin: 0;
	color: var(--mas-color-accent-dark);
	font-size: var(--mas-text-md);
	font-weight: 800;
}

.woocommerce ul.products li.product.mas-card .price del {
	display: block;
	color: var(--mas-color-muted);
	font-size: 0.75rem;
	font-weight: 400;
}

.woocommerce ul.products li.product.mas-card .price ins {
	text-decoration: none;
}

.mas-price-from {
	color: var(--mas-color-muted);
	font-size: 0.75rem;
	font-weight: 400;
}

/* Mô tả ngắn: bỏ trong thẻ cho gọn */
.woocommerce ul.products li.product.mas-card .product-excerpt {
	display: none;
}

/* Nút: luôn hiện (Kadence chỉ hiện khi rê chuột, điện thoại không rê chuột được) */
/* độ cụ thể bằng Kadence (.woocommerce ul.products.woo-archive-action-on-hover li.product ...), nạp sau nên thắng */
.woocommerce ul.products li.product.mas-card .product-action-wrap {
	position: static;
	width: 100%;
	margin-top: auto;
	padding: var(--mas-space-2) 0 0;
	opacity: 1;
	visibility: visible;
	transform: none;
}

.woocommerce ul.products li.product.mas-card .product-action-wrap .button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 40px;
	padding: var(--mas-space-1) var(--mas-space-2);
	border: 1px solid var(--mas-color-primary);
	border-radius: var(--mas-radius-sm);
	background: var(--mas-color-bg);
	color: var(--mas-color-primary);
	font-size: var(--mas-text-sm);
	font-weight: 700;
	letter-spacing: normal;
	text-transform: none;
	white-space: nowrap;
}

.woocommerce ul.products li.product.mas-card .product-action-wrap .button:hover {
	background: var(--mas-color-primary);
	color: #fff;
}

.woocommerce ul.products li.product.mas-card .product-action-wrap .button .kadence-arrow-right-alt-svg {
	display: none;
}

.woocommerce ul.products li.product.mas-card .added_to_cart {
	display: block;
	margin-top: var(--mas-space-1);
	font-size: 0.75rem;
	text-align: center;
}

/* Nhãn -x% góc trên trái */
/* độ cụ thể bằng Kadence (.woocommerce ul.products li.product .onsale) */
.woocommerce ul.products li.product.mas-card .onsale {
	background: var(--mas-color-accent);
	color: #fff;
	position: absolute;
	top: var(--mas-space-2);
	right: auto;
	left: var(--mas-space-2);
	z-index: 2;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 2px var(--mas-space-2);
	line-height: 1.4;
}

@media (min-width: 1025px) {
	.woocommerce ul.products li.product.mas-card {
		transition: box-shadow 0.2s, transform 0.2s;
	}

	.woocommerce ul.products li.product.mas-card:hover {
		box-shadow: var(--mas-shadow);
		transform: translateY(-2px);
	}

	.woocommerce ul.products li.product.mas-card .woocommerce-loop-product__title {
		font-size: var(--mas-text-md);
	}
}

/* ---------- Lưới danh sách sản phẩm: 2 cột điện thoại, 3 máy tính bảng, 4 máy tính ---------- */
/* ghi đè Kadence: bản Kadence đang dùng không có quy tắc 2 cột cho điện thoại (grid-ss-col-2) */
ul.products.grid-cols {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--mas-space-3);
}

@media (min-width: 768px) {
	ul.products.grid-cols {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1025px) {
	ul.products.grid-cols {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: var(--mas-space-5);
	}
}
