/**
 * Team Moon — mobile navbar (bottom of the screen on phones).
 * Colours: --tm-mnb-* from the settings, otherwise the --_* defaults of the chosen bar style.
 */

.tm-mnb {
	--_bg: #fff;
	--_icon: #8a8577;
	--_active: #09122d;
	--_accent: #c8a45c;
	--_soft: rgba(9, 18, 45, 0.08);
	--_border: rgba(9, 18, 45, 0.07);
	--_shadow: 0 -6px 24px rgba(9, 18, 45, 0.07);
	--_radius: 0;
	--_h: 64px;
	--_ease: cubic-bezier(0.34, 1.3, 0.64, 1);
	--_smooth: cubic-bezier(0.25, 0.8, 0.25, 1);
	--bg: var(--tm-mnb-bg, var(--_bg));
	--icon: var(--tm-mnb-icon, var(--_icon));
	--active: var(--tm-mnb-active, var(--_active));
	--accent: var(--tm-mnb-accent, var(--_accent));

	position: fixed;
	z-index: 399; /* under WoodMart side menus and popups */
	left: 0;
	right: 0;
	bottom: 0;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	background: var(--bg);
	border-top: 1px solid var(--_border);
	border-radius: var(--_radius) var(--_radius) 0 0;
	box-shadow: var(--_shadow);
	font-family: inherit;
	transition: transform 0.35s cubic-bezier(0.3, 0.9, 0.3, 1), opacity 0.25s;
	-webkit-tap-highlight-color: transparent;
}

/* Dark or light comes from the real background colour (PHP adds .tm-mnb--dark). */
.tm-mnb--dark {
	--_icon: #9aa3bd;
	--_active: #fff;
	--_soft: rgba(255, 255, 255, 0.12);
	--_border: transparent;
}

/* Soft background, border and shadow follow the chosen colours on every style. */
@supports (color: color-mix(in srgb, red 50%, blue)) {
	.tm-mnb {
		--_soft: color-mix(in srgb, var(--active) 13%, transparent);
		--_border: color-mix(in srgb, var(--icon) 10%, transparent);
		--_shadow: 0 -6px 24px color-mix(in srgb, var(--icon) 10%, transparent);
	}
}

/* ---------- Bar styles ---------- */
.tm-mnb--bar-cream {
	--_bg: #f3ece0;
	--_border: transparent;
	--_radius: 22px;
}

.tm-mnb--floating {
	left: 12px;
	right: 12px;
	bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	padding-bottom: 0;
	border-radius: 24px;
	--_radius: 24px;
}

.tm-mnb--bar-float,
.tm-mnb--bar-gold {
	--_bg: #09122d;
	--_shadow: 0 12px 30px rgba(9, 18, 45, 0.3);
	border: 0;
}

.tm-mnb--bar-gold {
	border: 1.5px solid var(--accent);
}

.tm-mnb--bar-glass {
	--_bg: rgba(255, 255, 255, 0.78);
	--_icon: #6b6a63;
	--_shadow: 0 12px 30px rgba(9, 18, 45, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.7);
	-webkit-backdrop-filter: blur(14px) saturate(1.4);
	backdrop-filter: blur(14px) saturate(1.4);
}

.tm-mnb.is-hidden {
	transform: translateY(calc(100% + 24px));
}

/* ---------- Items ---------- */
.tm-mnb__bar {
	position: relative;
	display: flex;
	align-items: stretch;
	height: var(--_h);
	padding: 0 6px;
}

.tm-mnb__item {
	position: relative;
	z-index: 1;
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	color: var(--icon);
	text-decoration: none !important;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.2;
	outline: none;
	transition: color 0.25s;
}

.tm-mnb__item:hover,
.tm-mnb__item:focus {
	color: var(--icon);
}

.tm-mnb__item:focus-visible .tm-mnb__icon {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 10px;
}

.tm-mnb__icon {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	transition: transform 0.4s var(--_ease), width 0.35s var(--_ease), height 0.35s var(--_ease), border-radius 0.35s, background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.tm-mnb__svg {
	display: block;
	width: 24px;
	height: 24px;
	transition: width 0.35s, height 0.35s;
}

.tm-mnb__label {
	max-width: 100%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	transition: opacity 0.25s, max-height 0.3s, margin 0.35s var(--_ease);
	max-height: 16px;
}

.tm-mnb--no-labels .tm-mnb__label {
	display: none;
}

.tm-mnb__icon {
	border-radius: 50%;
	box-shadow: 0 0 0 0 transparent;
}

.tm-mnb__item.is-active,
.tm-mnb__item.is-active:hover,
.tm-mnb__item.is-active:focus {
	color: var(--active);
}

.tm-mnb__item.is-active .tm-mnb__icon {
	transform: translateY(-2px) scale(1.1);
}

.tm-mnb__item:active .tm-mnb__icon,
.tm-mnb__item.is-pressed .tm-mnb__icon {
	transform: scale(0.88);
	transition-duration: 0.15s;
}

/* Soft ripple from the tapped icon. */
.tm-mnb__icon::after {
	content: "";
	position: absolute;
	inset: -10px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0;
	transform: scale(0.4);
	pointer-events: none;
}

.tm-mnb__item.is-tapped .tm-mnb__icon::after {
	animation: tm-mnb-ripple 0.5s var(--_smooth);
}

@keyframes tm-mnb-ripple {
	0% { opacity: 0.18; transform: scale(0.4); }
	100% { opacity: 0; transform: scale(1.25); }
}

.tm-mnb__item .tm-mnb__svg {
	transition: width 0.35s var(--_ease), height 0.35s var(--_ease), transform 0.35s var(--_ease);
}

.tm-mnb__item.is-active:not(.tm-mnb__item--mid) .tm-mnb__svg {
	animation: tm-mnb-pop 0.45s var(--_ease);
}

@keyframes tm-mnb-pop {
	0% { transform: scale(0.8); }
	60% { transform: scale(1.12); }
	100% { transform: scale(1); }
}

/* Cart count */
.tm-mnb__count {
	position: absolute;
	top: -7px;
	inset-inline-end: -11px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	box-sizing: border-box;
	border-radius: 9px;
	border: 2px solid var(--bg);
	background: var(--accent);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 14px;
	text-align: center;
}

.tm-mnb__count[hidden] {
	display: none;
}

.tm-mnb__count.is-bump {
	animation: tm-mnb-bump 0.5s var(--_ease);
}

@keyframes tm-mnb-bump {
	0% { transform: scale(1); }
	40% { transform: scale(1.45); }
	100% { transform: scale(1); }
}

/* ---------- The middle item (3 or 5 items) ---------- */
.tm-mnb__item--mid {
	flex: 1 1 0; /* same width as the others, so the big one can move without shifting */
}

.tm-mnb--mid-gold .tm-mnb__item--mid .tm-mnb__icon,
.tm-mnb--mid-circle .tm-mnb__item--mid .tm-mnb__icon,
.tm-mnb--mid-square .tm-mnb__item--mid .tm-mnb__icon {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	color: #fff;
	background: var(--accent);
	box-shadow: 0 0 0 5px var(--bg), 0 8px 18px rgba(9, 18, 45, 0.25);
	transform: translateY(-20px);
}

/* Circle / square use the chosen-item colour, with the bar colour on top so it always reads. */
.tm-mnb--mid-circle .tm-mnb__item--mid .tm-mnb__icon,
.tm-mnb--mid-square .tm-mnb__item--mid .tm-mnb__icon {
	background: var(--active);
	color: var(--bg);
}

.tm-mnb--bar-glass.tm-mnb--mid-circle .tm-mnb__item--mid .tm-mnb__icon,
.tm-mnb--bar-glass.tm-mnb--mid-square .tm-mnb__item--mid .tm-mnb__icon {
	color: #fff;
}

.tm-mnb--mid-square .tm-mnb__item--mid .tm-mnb__icon {
	border-radius: 18px;
}

.tm-mnb--bar-glass .tm-mnb__item--mid .tm-mnb__icon {
	box-shadow: 0 0 0 5px var(--tm-mnb-bg, #fff), 0 8px 18px rgba(9, 18, 45, 0.2);
}

.tm-mnb--mid-gold .tm-mnb__item--mid .tm-mnb__svg,
.tm-mnb--mid-circle .tm-mnb__item--mid .tm-mnb__svg,
.tm-mnb--mid-square .tm-mnb__item--mid .tm-mnb__svg {
	width: 27px;
	height: 27px;
}

.tm-mnb--mid-gold .tm-mnb__item--mid .tm-mnb__label,
.tm-mnb--mid-circle .tm-mnb__item--mid .tm-mnb__label,
.tm-mnb--mid-square .tm-mnb__item--mid .tm-mnb__label {
	margin-top: -17px;
}

.tm-mnb__item--mid.is-active .tm-mnb__icon {
	transform: translateY(-20px) scale(1.07);
}

.tm-mnb__item--mid:active .tm-mnb__icon,
.tm-mnb__item--mid.is-pressed .tm-mnb__icon {
	transform: translateY(-20px) scale(0.92);
}

.tm-mnb--mid-flat .tm-mnb__item--mid.is-pressed .tm-mnb__icon {
	transform: scale(0.92);
}

.tm-mnb__item--mid .tm-mnb__count {
	top: -3px;
	inset-inline-end: -3px;
	background: var(--active);
	color: var(--bg);
	border-color: var(--bg);
}

.tm-mnb--mid-gold .tm-mnb__item--mid,
.tm-mnb--mid-circle .tm-mnb__item--mid,
.tm-mnb--mid-square .tm-mnb__item--mid {
	color: var(--active);
}

/* Bigger but inside the bar */
.tm-mnb--mid-flat .tm-mnb__item--mid .tm-mnb__icon {
	width: 46px;
	height: 40px;
	border-radius: 14px;
	background: var(--_soft);
	color: var(--active);
}

.tm-mnb--mid-flat .tm-mnb__item--mid .tm-mnb__svg {
	width: 26px;
	height: 26px;
}

.tm-mnb--mid-flat .tm-mnb__item--mid.is-active .tm-mnb__icon {
	transform: scale(1.06);
}

.tm-mnb--mid-flat .tm-mnb__item--mid .tm-mnb__label {
	display: none;
}

/* ---------- Chosen item ---------- */
.tm-mnb__ind {
	position: absolute;
	left: 0;
	z-index: 0;
	width: 0;
	pointer-events: none;
	opacity: 0;
	transition: transform 0.45s var(--_ease), width 0.35s var(--_smooth), opacity 0.25s;
}

.tm-mnb__ind.is-ready {
	opacity: 1;
}

.tm-mnb__ind.is-ready.is-off,
.tm-mnb--act-bubble .tm-mnb__ind {
	opacity: 0;
}

.tm-mnb--act-pill .tm-mnb__ind,
.tm-mnb--act-labels .tm-mnb__ind {
	top: 8px;
	height: calc(var(--_h) - 16px);
	border-radius: 16px;
	background: var(--_soft);
}

.tm-mnb--act-line .tm-mnb__ind {
	top: 0;
	height: 3px;
	border-radius: 0 0 3px 3px;
	background: var(--active);
}

.tm-mnb--act-under .tm-mnb__ind {
	bottom: 6px;
	height: 3px;
	border-radius: 2px;
	background: var(--active);
}

.tm-mnb--act-dot .tm-mnb__ind {
	bottom: 5px;
	height: 5px;
	border-radius: 3px;
	background: var(--accent);
}

.tm-mnb--act-dot .tm-mnb__item:not(.tm-mnb__item--mid) .tm-mnb__label,
.tm-mnb--act-under .tm-mnb__item:not(.tm-mnb__item--mid) .tm-mnb__label {
	margin-bottom: 6px;
}

/* Raised bubble on the chosen item */
.tm-mnb--act-bubble .tm-mnb__item.is-active:not(.tm-mnb__item--mid) .tm-mnb__icon {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--active);
	color: var(--bg);
	box-shadow: 0 0 0 4px var(--bg);
	transform: translateY(-16px);
}

.tm-mnb--act-bubble .tm-mnb__item.is-active:not(.tm-mnb__item--mid) .tm-mnb__svg {
	width: 21px;
	height: 21px;
}

.tm-mnb--act-bubble .tm-mnb__item.is-active:not(.tm-mnb__item--mid) .tm-mnb__label {
	margin-top: -14px;
}

/* Only the chosen item shows its name */
.tm-mnb--act-labels .tm-mnb__item:not(.is-active):not(.tm-mnb__item--mid) .tm-mnb__label {
	opacity: 0;
	max-height: 0;
	margin-top: -3px;
}

/* ---------- Other floating buttons (WhatsApp, back to top) move above the bar ---------- */
.tm-mnb-lift {
	transition: transform 0.35s cubic-bezier(0.3, 0.9, 0.3, 1) !important;
}

/* ---------- Less motion ---------- */
.tm-mnb--still,
.tm-mnb--still * {
	transition: none !important;
	animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.tm-mnb,
	.tm-mnb * {
		transition: none !important;
		animation: none !important;
	}
}
