/**
 * Base components shared across templates: buttons, forms, badges, price,
 * rating, cards, accordions, skeletons, toasts, utility layout classes.
 */

/* ---------- Layout utilities ---------- */
.mf-container {
	max-width: var(--mf-container);
	margin-inline: auto;
	padding-inline: var(--mf-gutter);
}

.mf-container--wide {
	max-width: var(--mf-container-wide);
}

/* ---------- Buttons ---------- */
.mf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--mf-sp-2);
	min-height: 44px;
	padding: 0 var(--mf-sp-6);
	border: 1px solid var(--mf-accent);
	border-radius: var(--mf-r-md);
	background: var(--mf-accent);
	color: #fff;
	font-family: var(--mf-font);
	font-size: var(--mf-fs-base);
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.01em;
	cursor: pointer;
	text-decoration: none;
	transition: background var(--mf-t-fast) var(--mf-ease), border-color var(--mf-t-fast) var(--mf-ease), color var(--mf-t-fast) var(--mf-ease);
}

.mf-btn:hover,
.mf-btn:focus {
	background: var(--mf-accent-dark);
	border-color: var(--mf-accent-dark);
	color: #fff;
}

.mf-btn:focus-visible {
	outline: 2px solid var(--mf-ink);
	outline-offset: 2px;
}

.mf-btn--ghost {
	background: transparent;
	color: var(--mf-accent);
}

.mf-btn--ghost:hover,
.mf-btn--ghost:focus {
	background: var(--mf-accent-soft);
	border-color: var(--mf-accent);
	color: var(--mf-accent-dark);
}

.mf-btn--quiet {
	border: 0;
	background: transparent;
	color: var(--mf-ink);
	font-weight: 500;
	padding-inline: var(--mf-sp-2);
}

.mf-btn--quiet:hover,
.mf-btn--quiet:focus {
	background: transparent;
	color: var(--mf-accent);
	text-decoration: underline;
}

.mf-btn--sm {
	min-height: 36px;
	padding-inline: var(--mf-sp-4);
	font-size: var(--mf-fs-sm);
}

.mf-btn--lg {
	min-height: 52px;
	font-size: var(--mf-fs-md);
}

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

.mf-btn[disabled],
.mf-btn.is-disabled {
	opacity: 0.5;
	pointer-events: none;
}

/* ---------- Badges ---------- */
.mf-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: var(--mf-r-sm);
	background: var(--mf-accent);
	color: #fff;
	font-size: var(--mf-fs-xs);
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
}

.mf-badge--deal { background: var(--mf-deal); }
.mf-badge--clearance { background: var(--mf-danger); }
.mf-badge--new { background: var(--mf-ink); }
.mf-badge--collection { background: var(--mf-cream); color: var(--mf-ink); }

/* ---------- Price ---------- */
.mf-price-row {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: var(--mf-sp-2);
}

.mf-price {
	color: var(--mf-ink);
	font-weight: 700;
}

.mf-price__mrp {
	color: var(--mf-text-faint);
	text-decoration: line-through;
	font-weight: 400;
}

.mf-price__off {
	color: var(--mf-success);
	font-weight: 600;
}

/* ---------- Rating ---------- */
.mf-rating {
	display: inline-flex;
	align-items: center;
	gap: var(--mf-sp-1);
	color: var(--mf-star);
	font-size: var(--mf-fs-sm);
	line-height: 1;
}

.mf-rating__count {
	color: var(--mf-text-faint);
}

/* ---------- Accordion ---------- */
.mf-acc__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 44px;
	padding: var(--mf-sp-3) 0;
	border: 0;
	background: none;
	font-family: var(--mf-font);
	font-size: var(--mf-fs-md);
	font-weight: 600;
	color: var(--mf-ink);
	cursor: pointer;
	text-align: left;
}

.mf-acc__head::after {
	content: "";
	width: 10px;
	height: 10px;
	border-right: 2px solid var(--mf-text-soft);
	border-bottom: 2px solid var(--mf-text-soft);
	transform: rotate(45deg);
	transition: transform var(--mf-t-fast) var(--mf-ease);
	flex-shrink: 0;
}

.mf-acc__head[aria-expanded="true"]::after {
	transform: rotate(225deg);
}

.mf-acc__body {
	padding-bottom: var(--mf-sp-4);
}

.mf-acc__body[hidden] {
	display: none;
}

.mf-acc {
	border-bottom: 1px solid var(--mf-border);
}

/* ---------- Skeleton ---------- */
.mf-skel {
	position: relative;
	overflow: hidden;
	background: var(--mf-bg-soft);
	border-radius: var(--mf-r-sm);
}

.mf-skel::after {
	content: "";
	position: absolute;
	inset: 0;
	transform: translateX(-100%);
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
	animation: mf-shimmer 1.4s infinite;
}

@keyframes mf-shimmer {
	100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
	.mf-skel::after { animation: none; }
}

/* ---------- Toast ---------- */
.mf-toast {
	position: fixed;
	bottom: var(--mf-sp-6);
	left: 50%;
	transform: translateX(-50%);
	z-index: var(--mf-z-toast);
	padding: var(--mf-sp-3) var(--mf-sp-6);
	border-radius: var(--mf-r-full);
	background: var(--mf-ink);
	color: #fff;
	font-size: var(--mf-fs-sm);
	font-weight: 500;
	box-shadow: var(--mf-shadow-3);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--mf-t-med) var(--mf-ease);
}

.mf-toast.is-open {
	opacity: 1;
}

@media (min-width: 768px) {
	.mf-toast {
		left: auto;
		right: var(--mf-sp-8);
		transform: none;
	}
}

/* ---------- Section headers ---------- */
.mf-section {
	margin-block: var(--mf-sp-10);
}

.mf-section__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--mf-sp-4);
	margin-bottom: var(--mf-sp-6);
}

.mf-section__title {
	font-size: var(--mf-fs-2xl);
	font-weight: 600;
	color: var(--mf-ink);
	margin: 0;
}

.mf-section__sub {
	color: var(--mf-text-soft);
	margin: var(--mf-sp-1) 0 0;
}

@media (min-width: 768px) {
	.mf-section {
		margin-block: var(--mf-sp-16);
	}
}

/* ---------- Visually hidden ---------- */
.mf-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Floating WhatsApp chat (all pages) ---------- */
.mf-whatsapp {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: var(--mf-z-toast);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #25d366;
	color: #fff;
	box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
	text-decoration: none;
	transition: transform var(--mf-t-fast) var(--mf-ease), box-shadow var(--mf-t-fast) var(--mf-ease);
}

.mf-whatsapp:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 26px rgba(37, 211, 102, 0.55);
	color: #fff;
}

.mf-whatsapp svg { width: 30px; height: 30px; display: block; }

.mf-whatsapp::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
	animation: mf-wa-pulse 2.4s infinite;
}

@keyframes mf-wa-pulse {
	70% { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
	100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.mf-whatsapp::before { animation: none; }
}

@media (max-width: 767px) {
	.mf-whatsapp {
		width: 50px;
		height: 50px;
		left: 16px;
		bottom: calc(var(--mf-toolbar-height, 55px) + env(safe-area-inset-bottom, 0px) + 16px);
	}

	.mf-whatsapp svg { width: 26px; height: 26px; }
}

/* ================= App-style bottom navigation (mobile) ================= */
.mf-bottomnav {
	display: none;
}

@media (max-width: 767px) {
	.mf-bottomnav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: calc(var(--mf-z-drawer) - 2);
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		background: var(--mf-surface);
		border-top: 1px solid var(--mf-border);
		box-shadow: 0 -2px 14px rgba(10, 10, 10, 0.08);
		/* Sit above the iOS home indicator */
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.mf-bottomnav__item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-height: 56px;
		padding: 6px 2px;
		border: 0;
		background: none;
		font-family: var(--mf-font);
		font-size: 10px;
		font-weight: 500;
		line-height: 1.2;
		color: var(--mf-text-soft);
		text-decoration: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.mf-bottomnav__item svg {
		width: 22px;
		height: 22px;
		display: block;
		flex-shrink: 0;
	}

	.mf-bottomnav__item.is-active { color: var(--mf-accent); }
	.mf-bottomnav__item.is-active svg { stroke-width: 2.1; }

	.mf-bottomnav__icon {
		position: relative;
		display: block;
		line-height: 0;
	}

	.mf-bottomnav__icon .mf-count {
		top: -6px;
		right: -10px;
	}

	/* Room for the bar so it never covers page content/footer */
	body {
		padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
	}

	/* Float the WhatsApp button above the bar */
	.mf-whatsapp {
		bottom: calc(68px + env(safe-area-inset-bottom, 0px));
	}

	/* PDP sticky add-to-cart stacks directly on top of the bar */
	.mf-pdp__sticky-cta {
		bottom: calc(56px + env(safe-area-inset-bottom, 0px));
	}

	.mf-pdp {
		padding-bottom: 40px;
	}
}

/* ================= Mobile responsive safety ================= */
/* Never allow sideways scrolling of the page itself. */
html,
body {
	max-width: 100%;
	overflow-x: hidden;
}

@media (max-width: 767px) {
	/* Media and embeds must never exceed their column */
	img,
	video,
	iframe,
	table {
		max-width: 100%;
	}

	/* Long words/URLs shouldn't push the layout wide */
	body {
		overflow-wrap: break-word;
	}

	/* Wide tables scroll inside themselves rather than the page */
	.mf-pdp__spec-table,
	.woocommerce table.shop_table {
		display: block;
		width: 100%;
		overflow-x: auto;
	}
}
