/*
 * Нижняя панель телефона и кнопка «наверх». Видна до 1024px, как скрытое сердце в шапке.
 */

.cm-mbar,
.cm-totop {
	display: none;
}

@media (max-width: 1024px) {
	body:has(.cm-mbar) {
		padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
	}

	.cm-mbar {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 40;
		display: flex;
		align-items: stretch;
		justify-content: space-around;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		border-top: 1px solid var(--cm-line);
		background: #fff;
		box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
	}

	.cm-mbar__item {
		position: relative;
		display: flex;
		flex: 1 1 0;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-width: 0;
		min-height: 60px;
		padding: 6px 4px;
		color: var(--cm-black);
		font-family: var(--cm-font);
		font-size: 11px;
		font-weight: 600;
		line-height: 1.2;
		text-decoration: none;
		-webkit-tap-highlight-color: transparent;
	}

	.cm-mbar__item:hover,
	.cm-mbar__item:focus-visible,
	.cm-mbar__item[aria-current="page"] {
		color: var(--cm-orange);
	}

	.cm-mbar__ico {
		position: relative;
		display: inline-flex;
		font-size: 24px;
	}

	.cm-mbar__label {
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* Бейдж на иконке: тот же элемент, что и в шапке. */
	.cm-mbar__ico > .cm-tool__count {
		position: absolute;
		top: -5px;
		right: -9px;
		min-width: 16px;
		height: 16px;
		padding: 0 4px;
		border-radius: 8px;
		background: var(--cm-orange);
		color: #fff;
		font-size: 10px;
		font-weight: 700;
		line-height: 16px;
		text-align: center;
	}

	.cm-mbar__ico > .cm-tool__count[data-count="0"] {
		display: none;
	}

	/* «Фильтры»: оранжевая вкладка. Без колонки подбора на странице она не нужна. */
	.cm-mbar__item--filters {
		background: var(--cm-orange);
		color: #fff;
		cursor: pointer;
	}

	.cm-mbar__item--filters:hover,
	.cm-mbar__item--filters:focus-visible {
		background: var(--cm-dark-grey);
		color: #fff;
	}

	body:not(:has(.cm-shop-side__check)) .cm-mbar__item--filters {
		display: none;
	}

	.cm-totop {
		position: fixed;
		right: 14px;
		bottom: calc(76px + env(safe-area-inset-bottom, 0px));
		z-index: 39;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 1px solid var(--cm-line);
		border-radius: 50%;
		background: #fff;
		box-shadow: 0 4px 14px rgb(0 0 0 / 14%);
		color: var(--cm-black);
		font-size: 24px;
		cursor: pointer;
	}

	.cm-totop[hidden] {
		display: none;
	}

	.cm-totop:hover,
	.cm-totop:focus-visible {
		color: var(--cm-orange);
	}

	html.cm-menu-open .cm-mbar,
	html.cm-menu-open .cm-totop {
		display: none;
	}
}
