/* Mobile Bottom Nav — frontend
 * Design tokens (--mbn-*) and the desktop hide breakpoint are injected inline by PHP.
 */

.mbn-nav {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9999;
	display: flex;
	justify-content: space-around;
	align-items: stretch;
	background: var(--mbn-bg, #fff);
	border: var(--mbn-border, none);
	border-radius: var(--mbn-radius, 0);
	-webkit-backdrop-filter: var(--mbn-blur, none);
	backdrop-filter: var(--mbn-blur, none);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
	/* iOS safe area so the bar clears the home indicator (docked mode only — see PHP). */
	padding-bottom: env(safe-area-inset-bottom, 0px);
	transition: padding 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mbn-item {
	flex: 1 1 0;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	padding: 8px 4px;
	text-decoration: none;
	color: var(--mbn-icon, #888);
	font-size: var(--mbn-font-size, 11px);
	line-height: 1.2;
	transition: color 0.15s ease, padding 0.25s ease;
}

.mbn-item.is-active {
	color: var(--mbn-active, #2ecc71);
}

.mbn-icon svg {
	width: 24px;
	height: 24px;
	display: block;
	fill: none;
	stroke: currentColor;
	transition: width 0.2s ease, height 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}

.mbn-label {
	white-space: nowrap;
	overflow: hidden;
	transition: opacity 0.2s ease, max-height 0.25s ease, margin 0.25s ease;
}

/* Compact state — toggled by frontend-script.js while scrolling down. */
.mbn-nav.mbn-compact .mbn-item {
	padding-top: 4px;
	padding-bottom: 4px;
}

.mbn-nav.mbn-compact .mbn-icon svg {
	width: 20px;
	height: 20px;
}

.mbn-nav.mbn-compact .mbn-label {
	opacity: 0;
	max-height: 0;
	margin: 0;
}

/* Out of the way: hide-on-scroll, typing (keyboard open), and theme overlays (drawer/lightbox). */
.mbn-nav.mbn-away,
.mbn-nav.mbn-kbd,
.mbn-nav.mbn-overlay {
	transform: translateY(calc(100% + var(--mbn-margin, 0px) + 24px));
	pointer-events: none;
}

/* Empty cart: keep the element for WooCommerce fragments, but don't show a "0". */
.mbn-cart-count.is-empty {
	display: none;
}

.mbn-cart-count {
	position: absolute;
	top: 4px;
	inset-inline-end: calc(50% - 20px); /* RTL-aware */
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: var(--mbn-badge-bg, #2ecc71);
	color: var(--mbn-badge-text, #fff);
	font-size: 10px;
	line-height: 16px;
	text-align: center;
}


/* ==========================================================================
 * Styles — `.mbn-style-{slug}` on <nav>, chosen in Settings → Design.
 * --mbn-active-rgb (r,g,b) and --mbn-bg-solid (opaque bg) are injected by PHP.
 * ========================================================================== */

.mbn-cart-count {
	box-shadow: 0 0 0 2px var(--mbn-bg-solid, #fff);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Classic: soft tint behind the active item ---- */
.mbn-style-classic .mbn-item.is-active .mbn-label {
	font-weight: 600;
}

/* ---- Pill: icons only, active item grows into a labelled pill ---- */
.mbn-style-pill {
	padding: 8px;
	align-items: center;
}

.mbn-style-pill .mbn-item {
	flex: 0 1 auto;
	flex-direction: row;
	gap: 0;
	padding: 10px 14px;
	border-radius: 999px;
	transition: background 0.3s ease, gap 0.3s ease, color 0.2s ease, padding 0.25s ease;
}

.mbn-style-pill .mbn-label {
	max-width: 0;
	opacity: 0;
	font-weight: 600;
	transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.mbn-style-pill .mbn-item.is-active {
	gap: 8px;
	background: rgba(var(--mbn-active-rgb, 46, 204, 113), 0.14);
}

.mbn-style-pill .mbn-item.is-active .mbn-label {
	max-width: 140px;
	opacity: 1;
}

.mbn-style-pill .mbn-cart-count {
	top: 2px;
	inset-inline-end: 4px;
}

/* ---- Bubble: active icon floats up into a solid circle ---- */
.mbn-style-bubble .mbn-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: -6px 0 -4px;
	border-radius: 50%;
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease, box-shadow 0.3s ease, color 0.2s ease;
}

.mbn-style-bubble .mbn-item.is-active .mbn-icon {
	transform: translateY(-18px);
	background: var(--mbn-active, #2ecc71);
	color: var(--mbn-bg-solid, #fff);
	box-shadow: 0 0 0 5px var(--mbn-bg-solid, #fff), 0 10px 22px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.45);
}

.mbn-style-bubble .mbn-item.is-active .mbn-cart-count {
	transform: translateY(-20px);
}

.mbn-style-bubble .mbn-item.is-active .mbn-label {
	font-weight: 600;
}

/* ---- Indicator: glowing top line + soft gradient ---- */
.mbn-style-indicator {
	overflow: hidden; /* Keep the gradient inside the rounded corners. */
}

.mbn-style-indicator .mbn-item::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: 0;
	height: 3px;
	border-radius: 0 0 4px 4px;
	background: var(--mbn-active, #2ecc71);
	box-shadow: 0 2px 12px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.7);
	transform: translateX(-50%);
	transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mbn-style-indicator .mbn-item {
	transition: color 0.15s ease, padding 0.25s ease, background 0.3s ease;
}

.mbn-style-indicator .mbn-item.is-active {
	background: linear-gradient(to bottom, rgba(var(--mbn-active-rgb, 46, 204, 113), 0.14), transparent 75%);
}

.mbn-style-indicator .mbn-item.is-active::before {
	width: 32px;
}

/* ---- Neon: glowing outline, icons and labels ---- */
.mbn-style-neon {
	box-shadow:
		0 0 0 1px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.28),
		0 0 28px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.18),
		0 10px 30px rgba(0, 0, 0, 0.35);
}

.mbn-style-neon .mbn-item.is-active .mbn-icon svg {
	filter: drop-shadow(0 0 4px var(--mbn-active, #2ecc71)) drop-shadow(0 0 10px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.6));
}

.mbn-style-neon .mbn-item.is-active .mbn-label {
	text-shadow: 0 0 8px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.85);
}

.mbn-style-neon .mbn-cart-count {
	box-shadow: 0 0 10px var(--mbn-badge-bg, #2ecc71);
}

/* ---- Minimal Dot: icons only, dot under the active one ---- */
.mbn-style-dot .mbn-item {
	gap: 5px;
	padding: 12px 4px 8px;
}

.mbn-style-dot .mbn-label {
	position: absolute;
	width: 1px;
	height: 1px;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
}

.mbn-style-dot .mbn-item::after {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--mbn-active, #2ecc71);
	transform: scale(0);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mbn-style-dot .mbn-item.is-active::after {
	transform: scale(1);
}

/* ==========================================================================
 * Hover / press effects — `.mbn-hover-{slug}` on <nav>.
 * Hover only on devices that really hover; keyboard focus gets the same look;
 * touch gets a short press-down on :active.
 * ========================================================================== */

.mbn-item:focus-visible {
	outline: 2px solid var(--mbn-active, #2ecc71);
	outline-offset: -4px;
	border-radius: 12px;
}

.mbn-nav:not(.mbn-hover-none) .mbn-item:active .mbn-icon svg {
	transform: scale(0.88);
	transition-duration: 0.1s;
}

@media (hover: hover) {
	.mbn-nav:not(.mbn-hover-none) .mbn-item:hover {
		color: var(--mbn-active, #2ecc71);
	}
}

@media (hover: hover) {
	.mbn-hover-lift .mbn-item:hover .mbn-icon svg { transform: translateY(-3px); }
	.mbn-hover-grow .mbn-item:hover .mbn-icon svg { transform: scale(1.18); }
	.mbn-hover-glow .mbn-item:hover .mbn-icon svg { filter: drop-shadow(0 0 6px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.75)); }
	.mbn-hover-tint .mbn-item:hover { background-color: rgba(var(--mbn-active-rgb, 46, 204, 113), 0.1); }
	.mbn-hover-bounce .mbn-item:hover .mbn-icon svg { animation: mbn-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
}

.mbn-hover-lift .mbn-item:focus-visible .mbn-icon svg { transform: translateY(-3px); }
.mbn-hover-grow .mbn-item:focus-visible .mbn-icon svg { transform: scale(1.18); }
.mbn-hover-glow .mbn-item:focus-visible .mbn-icon svg { filter: drop-shadow(0 0 6px rgba(var(--mbn-active-rgb, 46, 204, 113), 0.75)); }
.mbn-hover-tint .mbn-item:focus-visible { background-color: rgba(var(--mbn-active-rgb, 46, 204, 113), 0.1); }

/* Tint on the pill/indicator styles should round like the pill. */
.mbn-hover-tint .mbn-item { border-radius: 14px; }
.mbn-hover-tint.mbn-style-pill .mbn-item { border-radius: 999px; }

@keyframes mbn-bounce {
	0%, 100% { transform: translateY(0); }
	30% { transform: translateY(-6px); }
	55% { transform: translateY(0); }
	75% { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
	.mbn-nav,
	.mbn-nav *,
	.mbn-nav *::before,
	.mbn-nav *::after {
		animation: none !important;
		transition: none !important;
	}
}
