/*
 * Product Showcase: brand tabs, product grid and product card — Figma node 3316:196.
 * Loaded on the front end and in the editor.
 */

.mnn-product-showcase {
	position: relative;
	scroll-margin-top: 24px;
	transition: opacity 0.15s ease;
}

.mnn-product-showcase[aria-busy="true"] {
	opacity: 0.6;
	pointer-events: none;
}

/* ---------- Brand tabs ---------- */

.mnn-product-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding-bottom: 24px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mnn-product-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: none;
	padding: 10px 16px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: var(--wp--custom--radius--md);
	background-color: rgba(0, 0, 0, 0.25);
	box-shadow: var(--wp--preset--shadow--sm);
	color: var(--wp--preset--color--cream);
	font-size: 14px;
	font-weight: 600;
	line-height: 18px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.mnn-product-tab:hover {
	border-color: rgba(230, 199, 106, 0.6);
	background-color: rgba(0, 0, 0, 0.4);
	color: var(--wp--preset--color--cream);
	text-decoration: none;
}

.mnn-product-tab:focus-visible {
	outline: 2px solid var(--wp--preset--color--gold-light);
	outline-offset: 2px;
}

.mnn-product-tab.is-active,
.mnn-product-tab.is-active:hover {
	padding: 10px 20px;
	border-color: var(--wp--preset--color--gold);
	background-color: var(--wp--preset--color--gold);
	box-shadow: none;
	color: var(--wp--preset--color--maroon-deep);
	font-weight: 700;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.mnn-product-tab--all::before {
	content: "";
	flex: none;
	width: 12px;
	height: 12px;
	background: url(../../assets/icons/tab-all.svg) center / 100% 100% no-repeat;
}

/* The grid icon is drawn in dark maroon, so it is only shown on the gold (active) tab. */
.mnn-product-tab--all:not(.is-active)::before {
	display: none;
}

/* ---------- Spacing between tabs, group headers and grids (Figma: 32 / 24) ---------- */

.mnn-product-showcase.mnn-product-showcase > *,
.mnn-product-showcase .mnn-product-showcase__content > * {
	margin-block: 0;
}

.mnn-product-showcase.mnn-product-showcase > .mnn-product-group__header,
.mnn-product-showcase .mnn-product-showcase__content > .mnn-product-group__header {
	margin-top: 56px;
}

.mnn-product-showcase.mnn-product-showcase > .mnn-product-tabs + .mnn-product-group__header,
.mnn-product-showcase .mnn-product-showcase__content > .mnn-product-group__header:first-child {
	margin-top: 40px;
}

.mnn-product-showcase.mnn-product-showcase > .wp-block-maynongnghiep365-product-grid,
.mnn-product-showcase .mnn-product-showcase__content > .wp-block-maynongnghiep365-product-grid {
	margin-top: 24px;
}

/* ---------- Group header: icon box, title, tag, description ---------- */

.mnn-product-group__header {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	column-gap: 8px;
	row-gap: 2px;
	min-height: 44px;
	padding-left: 46px;
}

.mnn-product-showcase .mnn-product-group__header > * {
	margin-block: 0;
}

.mnn-product-group__header::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 36px;
	height: 36px;
	margin-top: -18px;
	box-sizing: border-box;
	border: 1px solid rgba(230, 199, 106, 0.3);
	border-radius: var(--wp--custom--radius--xs);
	background: rgba(0, 0, 0, 0.25) center no-repeat;
	box-shadow: var(--wp--preset--shadow--sm);
}

.mnn-product-group__header--best::before {
	background-image: url(../../assets/icons/group-best.svg);
	background-size: 16.67px 10px;
}

.mnn-product-group__header--new::before {
	border-color: #e5e7eb;
	background-image: url(../../assets/icons/group-new.svg);
	background-size: 18.33px 17.5px;
}

.mnn-product-group__header > .wp-block-heading {
	color: var(--wp--preset--color--white);
	font-size: 20px;
	font-weight: 700;
	line-height: 26px;
}

.mnn-product-group__header > .mnn-product-group__tag {
	justify-self: start;
	padding: 3px 11px;
	border: 1px solid rgba(230, 199, 106, 0.4);
	border-radius: var(--wp--custom--radius--md);
	background-color: rgba(0, 0, 0, 0.3);
	box-shadow: var(--wp--preset--shadow--sm);
	color: var(--wp--preset--color--gold-light);
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	white-space: nowrap;
}

.mnn-product-group__header--new > .mnn-product-group__tag {
	border-color: #e5e7eb;
	background-color: transparent;
	color: var(--wp--preset--color--accent-green);
}

.mnn-product-group__header > .mnn-product-group__desc {
	grid-column: 1 / -1;
	color: var(--wp--preset--color--cream);
	font-size: 12px;
	line-height: 16px;
	opacity: 0.85;
}

/* ---------- Grid ---------- */

.mnn-product-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mnn-product-grid__empty,
.mnn-product-grid__note {
	margin: 0;
	padding: 20px 24px;
	border: 1px dashed rgba(255, 255, 255, 0.35);
	border-radius: var(--wp--custom--radius--md);
	color: var(--wp--preset--color--cream);
	font-size: 14px;
	line-height: 20px;
}

.mnn-product-grid__note {
	margin-bottom: 16px;
	padding: 10px 14px;
	font-size: 12px;
}

/* ---------- Product card ---------- */

.mnn-product-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--contrast);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.mnn-product-card__media {
	position: relative;
	aspect-ratio: 1;
	background-color: var(--wp--preset--color--white);
	overflow: hidden;
}

.mnn-product-card__media > a,
.mnn-product-card__media img {
	display: block;
	width: 100%;
	height: 100%;
}

/* Whole machine visible: landscape and square photos are fitted, never cropped or stretched. */
.mnn-product-card__media > a {
	box-sizing: border-box;
	padding: 8px;
}

/* Two classes: WooCommerce's ".woocommerce img { height: auto }" loads later and would win a tie. */
.mnn-product-card .mnn-product-card__media img {
	height: 100%;
	object-fit: contain;
	object-position: center;
}

.mnn-product-card__media img {
	transition: transform 0.4s ease;
}

.mnn-product-card__badges {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	pointer-events: none;
}

.mnn-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	white-space: nowrap;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.mnn-badge--hot::before,
.mnn-badge--new::before {
	content: "";
	flex: none;
	background: center / 100% 100% no-repeat;
}

.mnn-badge--hot::before {
	width: 12.46px;
	height: 10.29px;
	background-image: url(../../assets/icons/badge-hot.svg);
}

.mnn-badge--new::before {
	width: 11.92px;
	height: 11.38px;
	background-image: url(../../assets/icons/badge-new.svg);
}

.mnn-badge--sold {
	padding: 3px 9px;
	border: 1px solid var(--wp--preset--color--border);
	background-color: rgba(255, 255, 255, 0.95);
	box-shadow: var(--wp--preset--shadow--sm);
	color: #9e0e24;
	font-size: 11px;
	line-height: 16.5px;
	filter: none;
}

.mnn-product-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 20px;
}

.mnn-product-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	min-height: 20px;
	margin-bottom: 6px;
}

.mnn-brand-chip,
.mnn-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border-radius: 2px;
	font-size: 12px;
	line-height: 16px;
	white-space: nowrap;
}

.mnn-brand-chip,
.mnn-brand-chip:hover {
	background-color: var(--wp--preset--color--surface-strong);
	color: var(--wp--preset--color--contrast);
	font-weight: 700;
	letter-spacing: 0.6px;
	text-decoration: none;
	text-transform: uppercase;
}

/* Brand colours as drawn in Figma; other brands keep the neutral chip. */
.mnn-brand-chip--vinafarm,
.mnn-brand-chip--vinafarm:hover {
	background-color: rgba(30, 64, 175, 0.1);
	color: #1e40af;
}

.mnn-brand-chip--mitsuyama,
.mnn-brand-chip--mitsuyama:hover {
	background-color: #fff0f2;
	color: var(--wp--preset--color--primary-dark);
}

.mnn-brand-chip--yataka,
.mnn-brand-chip--yataka:hover {
	background-color: rgba(185, 28, 28, 0.1);
	color: #b91c1c;
}

.mnn-brand-chip--rotary,
.mnn-brand-chip--rotary:hover {
	background-color: rgba(234, 88, 12, 0.1);
	color: #ea580c;
}

.mnn-brand-chip--katsu,
.mnn-brand-chip--katsu:hover,
.mnn-brand-chip--champion,
.mnn-brand-chip--champion:hover {
	background-color: #fef3c7;
	color: #92400e;
}

.mnn-chip {
	font-weight: 600;
}

.mnn-chip::before {
	content: "";
	flex: none;
	width: 11.67px;
	height: 11.67px;
	background: center / 100% 100% no-repeat;
}

.mnn-chip--stock {
	gap: 2px;
	background-color: #dcfce7;
	color: var(--wp--preset--color--contrast);
}

.mnn-chip--stock::before {
	background-image: url(../../assets/icons/check-circle.svg);
}

.mnn-chip--rating {
	background-color: #fef3c7;
	color: #b45309;
	font-weight: 700;
	line-height: 18px;
}

.mnn-chip--rating::before {
	height: 11.08px;
	background-image: url(../../assets/icons/star.svg);
}

.mnn-chip--out,
.mnn-chip--backorder {
	background-color: var(--wp--preset--color--surface-strong);
	color: var(--wp--preset--color--muted);
}

.mnn-chip--out::before,
.mnn-chip--backorder::before {
	display: none;
}

.mnn-product-card__title {
	display: -webkit-box;
	min-height: 49.5px;
	margin: 4px 0 8px;
	overflow: hidden;
	color: var(--wp--preset--color--contrast);
	font-size: 18px;
	font-weight: 700;
	line-height: 24.75px;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.mnn-product-card__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}

.mnn-product-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 8px;
	margin-top: auto;
	padding-top: 8px;
	color: var(--wp--preset--color--primary);
	font-size: 22px;
	font-weight: 800;
	line-height: 26px;
}

.mnn-product-card__price del {
	order: 2;
	color: var(--wp--preset--color--muted);
	font-size: 12px;
	font-weight: 400;
	line-height: 18px;
}

.mnn-product-card__price ins {
	order: 1;
	background: none;
	text-decoration: none;
}

.mnn-product-card__action {
	margin-top: 12px;
}

.mnn-product-card__button,
.mnn-product-card__button:visited {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 44px;
	padding: 0 12px;
	box-sizing: border-box;
	border: 0;
	border-radius: var(--wp--custom--radius--sm);
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	font-size: 14px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
	transition: background-color 0.15s ease;
}

.mnn-product-card__button:hover,
.mnn-product-card__button:focus-visible {
	background-color: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--white);
	text-decoration: none;
}

.mnn-product-card__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.mnn-product-card__button:not(.is-details)::before {
	content: "";
	flex: none;
	width: 15.82px;
	height: 15.83px;
	background: url(../../assets/icons/cart-white.svg) center / 100% 100% no-repeat;
}

.mnn-product-card__button.is-loading {
	opacity: 0.75;
	pointer-events: none;
}

.mnn-product-card__button.is-added,
.mnn-product-card__button.is-added:hover {
	background-color: #15803d;
	opacity: 1;
}

.mnn-product-card__button.is-details,
.mnn-product-card__button.is-details:visited {
	border: 1px solid var(--wp--preset--color--primary);
	background-color: transparent;
	color: var(--wp--preset--color--primary);
}

.mnn-product-card__button.is-details:hover {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}
.mnn-product-card.is-out-of-stock .mnn-product-card__media img {
	opacity: 0.6;
}

/* Hover/focus are not in Figma; proposed. */
.mnn-product-card:hover,
.mnn-product-card:focus-within {
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.18), 0 4px 6px -4px rgba(0, 0, 0, 0.12);
	transform: translateY(-2px);
}

.mnn-product-card:hover .mnn-product-card__media img {
	transform: scale(1.04);
}

.mnn-product-card:hover .mnn-product-card__title a,
.mnn-product-card__title a:focus-visible {
	color: var(--wp--preset--color--primary);
}

/* ---------- Responsive (Figma has desktop only; the rest is proposed) ---------- */

@media (max-width: 1139px) {
	.mnn-product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 20px;
	}
}

@media (max-width: 767px) {
	.mnn-product-tabs {
		flex-wrap: nowrap;
		margin-inline: -16px;
		padding-inline: 16px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.mnn-product-tabs::-webkit-scrollbar {
		display: none;
	}

	.mnn-product-showcase.mnn-product-showcase > .mnn-product-group__header,
	.mnn-product-showcase .mnn-product-showcase__content > .mnn-product-group__header {
		margin-top: 40px;
	}

	.mnn-product-showcase.mnn-product-showcase > .mnn-product-tabs + .mnn-product-group__header,
	.mnn-product-showcase .mnn-product-showcase__content > .mnn-product-group__header:first-child {
		margin-top: 28px;
	}

	.mnn-product-group__header {
		grid-template-columns: 1fr;
	}

	.mnn-product-group__header > .mnn-product-group__tag {
		grid-row: 2;
	}

	.mnn-product-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.mnn-product-card {
		border-radius: var(--wp--custom--radius--md);
	}

	.mnn-product-card__badges {
		top: 8px;
		left: 8px;
	}

	.mnn-badge {
		padding: 3px 8px;
		font-size: 11px;
	}

	.mnn-product-card__body {
		padding: 12px;
	}

	.mnn-brand-chip,
	.mnn-chip {
		padding: 2px 6px;
		font-size: 11px;
	}

	.mnn-product-card__title {
		min-height: 40px;
		font-size: 14px;
		line-height: 20px;
	}

	.mnn-product-card__price {
		font-size: 17px;
		line-height: 22px;
	}

	.mnn-product-card__button {
		gap: 6px;
		height: 40px;
		padding: 0 6px;
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mnn-product-showcase,
	.mnn-product-card,
	.mnn-product-card__media img {
		transition: none;
	}

	.mnn-product-card:hover,
	.mnn-product-card:focus-within {
		transform: none;
	}

	.mnn-product-card:hover .mnn-product-card__media img {
		transform: none;
	}
}

/* ---------- Editor ---------- */

.mnn-product-showcase.is-editor .mnn-product-tab {
	cursor: default;
}

.mnn-product-grid-editor a {
	pointer-events: none;
}
