/*
 * Alef Rehitim – נייד (alef-mobile).
 * Все элементы плагина — под корневым классом .alm. Вне .alm только правила с нашими
 * классами на body/html (alm-has-bar, alm-buy-on, alm-lock).
 * Точка перелома = точка темы Moderno, где появляется гамбургер: ширина < 1190 px.
 * Шире — плагин ничего не показывает.
 * Цвета и шрифт — сайта (ТЗ «Факты сайта»): правьте переменные в .alm ниже.
 */

.alm { display: none; }

@media (max-width: 1189.98px) {

	/* ---------- База ---------- */
	.alm {
		--alm-ink: #070707;
		--alm-text: #454545;
		--alm-muted: #838383;
		--alm-line: #e3e3e3;
		--alm-brown: #a87851;
		--alm-gold: #c69657;
		--alm-soft: #f7f2ec;
		--alm-bg: #fff;
		--alm-wa: #25d366;
		--alm-waze: #33ccff;
		--alm-red: #e5533d;
		--alm-safe: env(safe-area-inset-bottom, 0px);
		display: block;
		direction: rtl;
		font-family: "Assistant", var(--font-text, sans-serif), sans-serif;
		color: var(--alm-ink);
		line-height: 1.35;
		letter-spacing: normal;
	}
	.alm *,
	.alm *::before,
	.alm *::after { box-sizing: border-box; }
	.alm[hidden],
	.alm [hidden] { display: none; }

	/* Сброс оформления темы для наших ссылок и кнопок. */
	.alm-bar__item,
	.alm-x,
	.alm-cat__toggle,
	.alm-drawer__btn,
	.alm-cookies,
	.alm-buy__add,
	.alm-sq,
	.alm-btn {
		-webkit-appearance: none;
		appearance: none;
		margin: 0;
		border-radius: 0;
		box-shadow: none;
		font: inherit;
		letter-spacing: normal;
		text-transform: none;
		text-decoration: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
	.alm :focus-visible { outline: 2px solid var(--alm-gold); outline-offset: -2px; }

	.alm-i {
		width: 22px;
		height: 22px;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.7;
		stroke-linecap: round;
		stroke-linejoin: round;
		flex: none;
	}
	.alm-ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

	.alm-chip {
		display: inline-block;
		padding: 2px 8px;
		border-radius: 10px;
		background: #e6f4ea;
		color: #1e6a3a;
		font-size: 12px;
		font-weight: 700;
	}
	.alm-chip--closed { background: #f1f1f1; color: var(--alm-text); }

	/* Отступ снизу под панель, чтобы подвал не перекрывался. Второе правило перебивает
	   отступ липкой кнопки темы на странице товара. */
	body.alm-has-bar,
	body.alm-has-bar.single-product.h-sticky-atc { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
	body.alm-has-bar .c-to-top-button,
	body.alm-has-bar.single-product.h-sticky-atc .c-to-top-button { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

	/* Чужие плавающие элементы не должны ложиться на наши панели (README, раздел «Чужие плавающие кнопки»).
	   1) Кружок WhatsApp плагина Click to Chat: в панели уже есть своя кнопка WhatsApp. Click to Chat
	      прячет кружок только на экранах до 1024 px, поэтому на планшетах и в узком окне он оставался.
	   2) Баннер согласия и кружок cookie (CookieAdmin) — поднимаем над панелью.
	   3) Когда скрипт перенёс настройки cookie в боковое меню (класс alm-cookies-in-menu на html),
	      кружок не нужен совсем. !important — CookieAdmin показывает его инлайновым display:block. */
	body.alm-has-bar #ht-ctc-chat { display: none !important; }
	body.alm-has-bar .cookieadmin_law_container,
	body.alm-has-bar .cookieadmin_re_consent { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
	html.alm-cookies-in-menu .cookieadmin_re_consent { display: none !important; }

	/* Блокировка прокрутки фона под открытой шторкой. */
	html.alm-lock,
	html.alm-lock body { overflow: hidden; }

	/* ---------- Модуль A: нижняя панель ---------- */
	.alm-bar {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 1150;
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		padding-bottom: var(--alm-safe);
		background: var(--alm-bg);
		border-top: 1px solid var(--alm-line);
		box-shadow: 0 -6px 16px -10px rgba(0, 0, 0, .25);
	}
	.alm-bar__item {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-height: 64px;
		padding: 8px 2px 9px;
		background: none;
		border: 0;
		color: var(--alm-ink);
		font-size: 12px;
		font-weight: 600;
	}
	.alm-bar__item + .alm-bar__item { border-inline-start: 1px solid var(--alm-line); }
	.alm-dot {
		display: grid;
		place-items: center;
		width: 34px;
		height: 34px;
		border-radius: 50%;
		color: #fff;
	}
	.alm-dot .alm-i { width: 20px; height: 20px; }
	.alm-dot--tel { background: var(--alm-ink); }
	.alm-dot--wa { background: var(--alm-wa); }
	.alm-dot--nav { background: var(--alm-waze); color: var(--alm-ink); }
	.alm-dot--bag { background: var(--alm-brown); }
	.alm-count {
		position: absolute;
		top: 4px;
		inset-inline-end: calc(50% - 24px);
		display: grid;
		place-items: center;
		min-width: 16px;
		height: 16px;
		padding: 0 4px;
		border-radius: 8px;
		background: var(--alm-red);
		color: #fff;
		font-size: 10px;
		font-weight: 700;
		line-height: 1;
	}

	/* ---------- Затемнение и шторки ---------- */
	.alm-dim {
		position: fixed;
		inset: 0;
		z-index: 99990;
		background: rgba(0, 0, 0, .45);
		opacity: 0;
		transition: opacity .22s ease;
	}
	.alm-dim.is-open { opacity: 1; }

	.alm-x {
		position: absolute;
		top: 6px;
		inset-inline-end: 8px;
		display: grid;
		place-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		background: none;
		border: 0;
		color: var(--alm-muted);
	}

	/* Шторка «ניווט» (идея 1). */
	.alm-sheet {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 99991;
		display: flex;
		flex-direction: column;
		gap: 10px;
		max-height: 90vh;
		overflow-y: auto;
		padding: 14px 16px calc(16px + var(--alm-safe));
		background: var(--alm-bg);
		border-top: 3px solid var(--alm-brown);
		box-shadow: 0 -18px 40px rgba(0, 0, 0, .28);
		transform: translateY(100%);
		transition: transform .22s ease;
	}
	.alm-sheet.is-open { transform: none; }
	.alm-sheet__title {
		margin: 0;
		padding-inline-end: 44px;
		font-family: inherit;
		font-size: 18px;
		font-weight: 800;
		line-height: 1.25;
		text-transform: none;
		letter-spacing: normal;
		color: var(--alm-ink);
	}
	.alm-sheet__row {
		display: flex;
		justify-content: space-between;
		gap: 12px;
		margin: 0;
		font-size: 14px;
		color: var(--alm-text);
	}
	.alm-btn {
		display: block;
		width: 100%;
		min-height: 44px;
		padding: 12px;
		background: var(--alm-ink);
		border: 1px solid var(--alm-ink);
		color: #fff;
		font-size: 15px;
		font-weight: 700;
		text-align: center;
	}
	.alm-btn--ghost { background: var(--alm-bg); color: var(--alm-ink); }

	/* ---------- Модуль B: боковое меню (идея 2) ---------- */
	.alm-drawer {
		position: fixed;
		top: 0;
		bottom: 0;
		inset-inline-start: 0;
		z-index: 99991;
		display: flex;
		flex-direction: column;
		width: min(86vw, 420px);
		background: var(--alm-bg);
		transform: translateX(100%);
		transition: transform .22s ease;
	}
	.alm-drawer.is-open { transform: none; }
	.alm-drawer__top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 4px 14px 4px 6px;
		border-bottom: 1px solid var(--alm-line);
	}
	.alm-drawer__top .alm-x { position: static; }
	.alm-drawer__title {
		margin: 0;
		font-family: inherit;
		font-size: 17px;
		font-weight: 800;
		line-height: 1.25;
		text-transform: none;
		letter-spacing: normal;
		color: var(--alm-ink);
	}
	.alm-drawer__scroll {
		flex: 1;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.alm-cats {
		display: grid;
		grid-template-columns: 1fr 1fr;
		grid-auto-flow: row dense; /* открытый список подпунктов — строкой под парой плиток */
		gap: 8px;
		margin: 0;
		padding: 10px 12px;
		list-style: none;
	}
	.alm-cat {
		position: relative;
		margin: 0;
		overflow: hidden;
		border: 1px solid var(--alm-line);
		border-radius: 4px;
	}
	.alm-cat__link { display: block; color: var(--alm-ink); text-decoration: none; }
	.alm-cat__img { display: block; aspect-ratio: 4 / 3; background: var(--alm-soft); }
	.alm-cat__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
	.alm-cat__name {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 4px;
		min-height: 44px;
		padding: 6px 8px;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.25;
	}
	.alm-cat--parent .alm-cat__name { padding-inline-end: 44px; }
	.alm-cat__name small,
	.alm-sub small { color: var(--alm-muted); font-size: 12px; font-weight: 600; }
	.alm-cat__toggle {
		position: absolute;
		inset-inline-end: 0;
		bottom: 0;
		display: grid;
		place-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		background: none;
		border: 0;
		color: var(--alm-ink);
	}
	.alm-cat__toggle .alm-i { transition: transform .2s ease; }
	.alm-cat__toggle[aria-expanded="true"] .alm-i { transform: rotate(180deg); }

	.alm-sub {
		grid-column: 1 / -1;
		margin: 0;
		border: 1px solid var(--alm-line);
		border-radius: 4px;
	}
	.alm-sub ul,
	.alm-links,
	.alm-links ul { margin: 0; padding: 0; list-style: none; }
	.alm-sub li + li { border-top: 1px solid var(--alm-line); }
	.alm-sub a,
	.alm-links a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 44px;
		padding: 10px 12px;
		color: var(--alm-ink);
		font-size: 15px;
		text-decoration: none;
	}
	.alm-links { padding: 2px 14px 10px; }
	.alm-links > li { border-top: 1px solid var(--alm-line); }
	.alm-links a { padding-inline: 0; }
	.alm-links ul a { padding-inline-start: 14px; color: var(--alm-text); }

	/* Строка «настройки cookie» в конце меню — заменяет плавающий кружок CookieAdmin. */
	.alm-cookies {
		display: block;
		width: 100%;
		min-height: 44px;
		padding: 10px 14px 14px;
		background: none;
		border: 0;
		border-top: 1px solid var(--alm-line);
		color: var(--alm-muted);
		font-size: 13px;
		font-weight: 600;
		text-align: start;
	}

	.alm-drawer__foot {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 6px;
		padding: 10px 12px calc(10px + var(--alm-safe));
		background: var(--alm-soft);
	}
	.alm-drawer__btn {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-height: 56px;
		padding: 8px 2px;
		background: var(--alm-bg);
		border: 1px solid var(--alm-line);
		color: var(--alm-ink);
		font-size: 12px;
		font-weight: 700;
		text-align: center;
	}
	.alm-drawer__hours {
		grid-column: 1 / -1;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 6px;
		margin: 0;
		color: var(--alm-text);
		font-size: 13px;
		font-weight: 600;
	}

	/* ---------- Модуль C: панель покупки (идея 3) ---------- */
	.alm-buy {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 1150;
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto auto;
		align-items: center;
		gap: 8px;
		padding: 8px 10px calc(8px + var(--alm-safe));
		background: var(--alm-bg);
		border-top: 1px solid var(--alm-line);
		box-shadow: 0 -6px 16px -10px rgba(0, 0, 0, .25);
		transform: translateY(110%);
		visibility: hidden;
		transition: transform .22s ease, visibility 0s linear .22s;
	}
	.alm-buy.is-shown {
		transform: none;
		visibility: visible;
		transition: transform .22s ease;
	}
	/* Цена — одна строка без переноса; колонка не уже своего текста, кнопка «הוספה לסל» сжимается. */
	.alm-buy__price {
		min-width: 0;
		white-space: nowrap;
		font-size: 16px;
		font-weight: 800;
		line-height: 1.1;
		color: var(--alm-ink);
	}
	.alm-buy__amount { display: block; }
	.alm-buy__price small { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--alm-muted); }
	.alm-buy__add {
		width: 100%;
		min-height: 44px;
		padding: 11px 4px;
		background: var(--alm-ink);
		border: 0;
		color: #fff;
		white-space: nowrap;
		font-size: 15px;
		font-weight: 800;
		text-align: center;
	}
	.alm-sq {
		display: grid;
		place-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		background: var(--alm-bg);
		border: 1px solid var(--alm-line);
		color: var(--alm-ink);
	}
	.alm-sq--wa { background: var(--alm-wa); border-color: var(--alm-wa); color: #fff; }

	@media (prefers-reduced-motion: reduce) {
		.alm-dim,
		.alm-sheet,
		.alm-drawer,
		.alm-buy,
		.alm-buy.is-shown,
		.alm-cat__toggle .alm-i { transition: none; }
	}
}

/* Панель покупки заменяет липкую кнопку темы (тема прибивает настоящую кнопку к низу экрана
   на ширине < 768 px): возвращаем ряд с кнопкой в форму, иначе две панели лягут друг на друга. */
@media (max-width: 767.98px) {
	body.alm-buy-on .c-product:not(.c-product--quick-view) .c-product__atc-row-1--sticky {
		position: static;
		padding: 0;
		box-shadow: none;
		z-index: auto;
	}
}
