/**
 * mobile2.css — две карточки товара в ряд на мобильных (≤499px).
 * Откат: убрать подключение в common/header.tpl.
 * Swiper на главной — ширину слайдов задаёт mobile2.js (без дублирующих width !important).
 */

@media screen and (max-width: 499px) {

	/* --- Сетка каталога: 2 колонки --- */
	.one-column #content .main-products.product-grid:not(.swiper-wrapper),
	#mobmainproducts.product-grid,
	.main-products-wrapper .main-products.product-grid:not(.swiper-wrapper) {
		display: flex !important;
		flex-wrap: wrap !important;
		margin-left: -5px !important;
		margin-right: -5px !important;
	}

	.one-column #content .main-products.product-grid .product-layout:not(.swiper-slide),
	#mobmainproducts.product-grid .product-layout:not(.swiper-slide),
	.main-products-wrapper .main-products.product-grid .product-layout:not(.swiper-slide) {
		width: calc(50% - 0.01px) !important;
		max-width: 50% !important;
		flex: 0 0 50% !important;
		padding-left: 5px !important;
		padding-right: 5px !important;
		box-sizing: border-box !important;
	}

	/* Список — одна колонка */
	.main-products.product-list .product-layout {
		width: 100% !important;
		max-width: 100% !important;
		flex: 0 0 100% !important;
	}

	/* --- Карточка: компактные отступы и типографика --- */
	.main-products.product-grid .product-thumb,
	.module-products .product-grid .product-thumb {
		padding: 6px 4px 8px !important;
	}

	/* Убираем «растягивание» caption и лишние отступы между брендом и названием */
	.main-products.product-grid .product-thumb .caption,
	.module-products .product-grid .product-thumb .caption,
	.swiper-wrapper.product-grid .product-thumb .caption {
		display: flex !important;
		flex-direction: column !important;
		flex-grow: 1 !important;
		gap: 0 !important;
		position: relative !important;
		padding-top: 0 !important;
	}

	.main-products.product-grid .product-thumb .caption .buttons-wrapper,
	.module-products .product-grid .product-thumb .caption .buttons-wrapper,
	.swiper-wrapper.product-grid .product-thumb .caption .buttons-wrapper {
		margin-top: 0 !important;
		margin-bottom: 0 !important;
		flex-grow: 0 !important;
		flex-shrink: 0 !important;
		order: 99 !important;
	}

	/* Плотнее к строке бренда (.stats сразу над .name) */
	.main-products.product-grid .caption > .stats + .name,
	.module-products .product-grid .caption > .stats + .name,
	.swiper-wrapper.product-grid .caption > .stats + .name {
		margin-top: -2px !important;
	}

	.main-products.product-grid .product-thumb .name,
	.module-products .product-grid .product-thumb .name,
	.swiper-wrapper.product-grid .product-thumb .name,
	.main-products.product-grid .product-thumb-new .name,
	.module-products .product-grid .product-thumb-new .name {
		flex-grow: 0 !important;
		margin-top: 0 !important;
		margin-bottom: 0 !important;
		padding-top: 0 !important;
	}

	body .site-wrapper .main-products.product-grid .product-thumb-new .name,
	body .site-wrapper .module-products .product-grid .product-thumb-new .name {
		margin-bottom: 0 !important;
	}

	.main-products.product-grid .product-thumb .name a,
	.module-products .product-grid .product-thumb .name a,
	.swiper-wrapper.product-grid .product-thumb .name a {
		font-size: 11px !important;
		line-height: 1.15 !important;
		min-height: 20px !important;
		max-height: 26px !important;
		-webkit-line-clamp: 2;
	}

	.main-products.product-grid .product-thumb .description,
	.module-products .product-grid .product-thumb .description {
		display: none !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* --- Блок цены: одна строка (новая | старая | %); без скидки — по центру; вертикальные отступы минимальные --- */
	.main-products.product-grid .myblockprice .onlyprice,
	.module-products .product-grid .myblockprice .onlyprice,
	.swiper-wrapper.product-grid .myblockprice .onlyprice {
		margin: 0 !important;
		padding: 0 !important;
		display: flex !important;
		justify-content: center !important;
		align-items: center !important;
		width: 100% !important;
		box-sizing: border-box !important;
	}

	.main-products.product-grid .product-thumb .price br,
	.module-products .product-grid .product-thumb .price br,
	.swiper-wrapper.product-grid .product-thumb .price br {
		display: none !important;
	}

	.main-products.product-grid .product-thumb .price,
	.module-products .product-grid .product-thumb .price,
	.swiper-wrapper.product-grid .product-thumb .price {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 4px 6px !important;
		width: 100% !important;
		max-width: 100% !important;
		font-size: 12px !important;
		line-height: 1 !important;
		margin: 0 !important;
		padding: 0 !important;
		box-sizing: border-box !important;
	}

	/* Только обычная цена — по центру в одну строку */
	.main-products.product-grid .product-thumb .price:not(:has(.price-new)),
	.module-products .product-grid .product-thumb .price:not(:has(.price-new)),
	.swiper-wrapper.product-grid .product-thumb .price:not(:has(.price-new)) {
		justify-content: center !important;
		flex-wrap: nowrap !important;
	}

	.main-products.product-grid .product-thumb .price:not(:has(.price-new)) .price-normal,
	.module-products .product-grid .product-thumb .price:not(:has(.price-new)) .price-normal,
	.swiper-wrapper.product-grid .product-thumb .price:not(:has(.price-new)) .price-normal {
		text-align: center !important;
		width: 100% !important;
	}

	/* Акция: три элемента в одну строку, группа по центру карточки */
	.main-products.product-grid .product-thumb .price:has(.price-new),
	.module-products .product-grid .product-thumb .price:has(.price-new),
	.swiper-wrapper.product-grid .product-thumb .price:has(.price-new) {
		flex-wrap: nowrap !important;
		justify-content: center !important;
	}

	.main-products.product-grid .product-thumb .price .price-new,
	.module-products .product-grid .product-thumb .price .price-new,
	.swiper-wrapper.product-grid .product-thumb .price .price-new {
		font-size: 12px !important;
		flex: 0 0 auto !important;
		white-space: nowrap !important;
		order: 1 !important;
		display: inline-flex !important;
		align-items: center !important;
		align-self: center !important;
		line-height: 1.15 !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	.main-products.product-grid .product-thumb .price .price-old,
	.module-products .product-grid .product-thumb .price .price-old,
	.swiper-wrapper.product-grid .product-thumb .price .price-old {
		font-size: 10px !important;
		flex: 0 1 auto !important;
		min-width: 0 !important;
		white-space: nowrap !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		order: 2 !important;
		display: inline-flex !important;
		align-items: center !important;
		align-self: center !important;
		line-height: 1.15 !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	.main-products.product-grid .product-thumb .price .price-sale,
	.module-products .product-grid .product-thumb .price .price-sale,
	.swiper-wrapper.product-grid .product-thumb .price .price-sale {
		font-size: 9px !important;
		margin-left: 0 !important;
		padding: 0 4px !important;
		flex: 0 0 auto !important;
		white-space: nowrap !important;
		order: 3 !important;
		display: inline-flex !important;
		align-items: center !important;
		align-self: center !important;
		line-height: 1.15 !important;
		min-height: 1.15em !important;
		box-sizing: border-box !important;
	}

	.main-products.product-grid .product-thumb .price .price-normal,
	.module-products .product-grid .product-thumb .price .price-normal,
	.swiper-wrapper.product-grid .product-thumb .price .price-normal {
		font-size: 12px !important;
	}

	/* Налог — отдельная строка под ценой, не ломает ряд */
	.main-products.product-grid .product-thumb .price .price-tax,
	.module-products .product-grid .product-thumb .price .price-tax,
	.swiper-wrapper.product-grid .product-thumb .price .price-tax {
		flex-basis: 100% !important;
		width: 100% !important;
		text-align: center !important;
		font-size: 9px !important;
		margin: 2px 0 0 !important;
		padding: 0 !important;
		order: 10 !important;
	}

	.main-products.product-grid .myblockprice,
	.main-products.product-grid .product-thumb-new .myblockprice,
	.module-products .product-grid .myblockprice,
	.swiper-slide .product-thumb-new .myblockprice,
	.swiper-wrapper.product-grid .myblockprice {
		min-height: 0 !important;
		flex-wrap: wrap !important;
		align-items: flex-start !important;
		padding: 0 !important;
		margin: 0 !important;
		gap: 0 !important;
	}

	.main-products.product-grid .myblockprice .onlyprice,
	.module-products .product-grid .myblockprice .onlyprice,
	.swiper-wrapper.product-grid .myblockprice .onlyprice {
		width: 100% !important;
		max-width: 100% !important;
		flex: 0 0 100% !important;
		padding: 0 !important;
	}

	.main-products.product-grid .myblockprice .supercartsmall,
	.module-products .product-grid .myblockprice .supercartsmall,
	.swiper-wrapper.product-grid .myblockprice .supercartsmall {
		width: 100% !important;
		max-width: 100% !important;
		flex: 0 0 100% !important;
		padding: 0 !important;
	}

	.main-products.product-grid .supercartsmall,
	.module-products .product-grid .supercartsmall {
		display: flex !important;
		justify-content: center !important;
		align-items: center !important;
		text-align: center !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* Одна кнопка корзины: add/remove по классу product-in-cart (не ломать display:none из style.css) */
	.main-products.product-grid .supercartsmall .standartcart-new-add,
	.main-products.product-grid .supercartsmall .standartcart-new-remove,
	.module-products .product-grid .supercartsmall .standartcart-new-add,
	.module-products .product-grid .supercartsmall .standartcart-new-remove,
	.swiper-wrapper.product-grid .supercartsmall .standartcart-new-add,
	.swiper-wrapper.product-grid .supercartsmall .standartcart-new-remove {
		width: 100% !important;
		max-width: 100% !important;
		padding: 6px 8px !important;
		font-size: 10px !important;
		margin: 0 !important;
		justify-content: center !important;
		align-items: center !important;
		text-align: center !important;
		box-sizing: border-box !important;
	}

	/* Перебивает style.css max-width: 160px и margin у standartcart-new */
	body .site-wrapper .main-products.product-grid .product-thumb-new .caption .standartcart-new.btn,
	body .site-wrapper .module-products .product-grid .product-thumb-new .caption .standartcart-new.btn,
	body .site-wrapper .swiper-wrapper.product-grid .product-thumb-new .caption .standartcart-new.btn {
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		height: 28px !important;
	}

	.main-products.product-grid .supercartsmall .standartcart-new-add,
	.module-products .product-grid .supercartsmall .standartcart-new-add,
	.swiper-wrapper.product-grid .supercartsmall .standartcart-new-add {
		display: flex !important;
	}

	.main-products.product-grid .product-thumb.product-in-cart .supercartsmall .standartcart-new-remove,
	.module-products .product-grid .product-thumb.product-in-cart .supercartsmall .standartcart-new-remove,
	.swiper-wrapper.product-grid .product-thumb.product-in-cart .supercartsmall .standartcart-new-remove {
		display: flex !important;
	}

	.main-products.product-grid .supercartsmall .standartcart-new-remove,
	.module-products .product-grid .supercartsmall .standartcart-new-remove,
	.swiper-wrapper.product-grid .supercartsmall .standartcart-new-remove {
		display: none !important;
	}

	.main-products.product-grid .product-thumb.product-in-cart .supercartsmall .standartcart-new-add,
	.module-products .product-grid .product-thumb.product-in-cart .supercartsmall .standartcart-new-add,
	.swiper-wrapper.product-grid .product-thumb.product-in-cart .supercartsmall .standartcart-new-add {
		display: none !important;
	}

	/* Старая кнопка «В корзину» без standartcart-new — не показывать рядом с «Завтра» */
	.main-products.product-grid .supercartsmall .standartcart:not(.standartcart-new-add):not(.standartcart-new-remove),
	.module-products .product-grid .supercartsmall .standartcart:not(.standartcart-new-add):not(.standartcart-new-remove) {
		display: none !important;
	}

	.main-products.product-grid .standartcart-new .btn-text,
	.main-products.product-grid .btn-cart .btn-text {
		font-size: 10px !important;
	}

	.main-products.product-grid .standartcart-new .icon-svg,
	.main-products.product-grid .product-thumb .icon-svg,
	.module-products .product-grid .icon-svg {
		width: 14px !important;
		height: 14px !important;
		margin-right: 2px !important;
	}

	/* После кнопки: 1-я строка «Доставим завтра», 2-я — звёзды и отзывы */
	.main-products.product-grid .product-thumb .caption .rating,
	.module-products .product-grid .product-thumb .caption .rating,
	.swiper-wrapper.product-grid .product-thumb .caption .rating {
		display: flex !important;
		flex-direction: column !important;
		align-items: center !important;
		justify-content: flex-start !important;
		text-align: center !important;
		width: 100% !important;
		margin-top: 2px !important;
		margin-bottom: 0 !important;
		gap: 2px !important;
		flex-grow: 0 !important;
	}

	.main-products.product-grid .product-thumb .caption .rating .myzakaz,
	.module-products .product-grid .product-thumb .caption .rating .myzakaz,
	.swiper-wrapper.product-grid .product-thumb .caption .rating .myzakaz {
		order: 1 !important;
		display: block !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	.main-products.product-grid .product-thumb .caption .rating .rating-stars,
	.module-products .product-grid .product-thumb .caption .rating .rating-stars,
	.swiper-wrapper.product-grid .product-thumb .caption .rating .rating-stars {
		order: 2 !important;
		display: block !important;
		width: 100% !important;
		margin: 0 auto !important;
		padding: 0 !important;
		line-height: 1 !important;
		text-align: center !important;
		white-space: nowrap !important;
		font-size: 0 !important;
	}

	/* FontAwesome .fa-stack: не inline-flex — иначе видна одна звезда */
	.main-products.product-grid .product-thumb .caption .rating .rating-stars .fa-stack,
	.module-products .product-grid .product-thumb .caption .rating .rating-stars .fa-stack,
	.swiper-wrapper.product-grid .product-thumb .caption .rating .rating-stars .fa-stack {
		font-size: 10px !important;
		width: 1.1em !important;
		height: 1em !important;
		line-height: 1em !important;
		display: inline-block !important;
		vertical-align: middle !important;
		padding-top: 0 !important;
		margin: 0 0 0 1px !important;
		position: relative !important;
	}

	.main-products.product-grid .product-thumb .caption .rating .rating-stars .fa-stack:first-child,
	.module-products .product-grid .product-thumb .caption .rating .rating-stars .fa-stack:first-child,
	.swiper-wrapper.product-grid .product-thumb .caption .rating .rating-stars .fa-stack:first-child {
		margin-left: 0 !important;
	}

	.main-products.product-grid .rating-stars > span:not(.fa-stack),
	.module-products .product-grid .rating-stars > span:not(.fa-stack),
	.swiper-wrapper.product-grid .rating-stars > span:not(.fa-stack) {
		font-size: 9px !important;
		line-height: 1em !important;
		display: inline-block !important;
		vertical-align: middle !important;
		margin: 0 0 0 3px !important;
		padding: 0 !important;
		white-space: nowrap !important;
	}

	.main-products.product-grid .myzakaz,
	.module-products .product-grid .myzakaz,
	.swiper-wrapper.product-grid .myzakaz {
		font-size: 8px !important;
		padding-right: 0 !important;
		padding-left: 0 !important;
		text-align: center !important;
		width: 100% !important;
		line-height: 1.1 !important;
	}

	.main-products.product-grid .product-thumb .btn-wishlist::before,
	.main-products.product-grid .product-thumb .btn-compare::before,
	.module-products .product-grid .btn-wishlist::before,
	.module-products .product-grid .btn-compare::before {
		font-size: 14px !important;
	}

	/* Строка бренда: одинаковые отступы до и после mobile2.js (без «прыжка») */
	.main-products.product-grid .caption > .stats,
	.module-products .product-grid .caption > .stats,
	.swiper-wrapper.product-grid .caption > .stats,
	.main-products.product-grid .has-zero-price .caption > .stats,
	.module-products .product-grid .has-zero-price .caption > .stats {
		display: grid !important;
		grid-template-columns: 24px 1fr 24px !important;
		align-items: center !important;
		gap: 0 !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 2px !important;
		min-height: 18px !important;
		max-height: 18px !important;
		position: relative !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		font-size: 10px !important;
		line-height: 1.1 !important;
		box-sizing: border-box !important;
		overflow: hidden !important;
	}

	/* До переноса иконок — бренд по центру (колонка 2) */
	.main-products.product-grid .caption > .stats:not(.mobile2-brand-row) .stat-1,
	.module-products .product-grid .caption > .stats:not(.mobile2-brand-row) .stat-1 {
		grid-column: 2 !important;
		text-align: center !important;
		justify-self: center !important;
	}

	.main-products.product-grid .mobile2-brand-slot,
	.module-products .product-grid .mobile2-brand-slot,
	.swiper-wrapper.product-grid .mobile2-brand-slot {
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		min-width: 24px !important;
		min-height: 18px !important;
	}

	.main-products.product-grid .mobile2-brand-slot--wish,
	.module-products .product-grid .mobile2-brand-slot--wish,
	.swiper-wrapper.product-grid .mobile2-brand-slot--wish {
		grid-column: 1 !important;
		justify-content: flex-start !important;
	}

	.main-products.product-grid .mobile2-brand-center,
	.module-products .product-grid .mobile2-brand-center,
	.swiper-wrapper.product-grid .mobile2-brand-center {
		grid-column: 2 !important;
		text-align: center !important;
		min-width: 0 !important;
		overflow: hidden !important;
		white-space: nowrap !important;
		text-overflow: ellipsis !important;
	}

	.main-products.product-grid .mobile2-brand-slot--compare,
	.module-products .product-grid .mobile2-brand-slot--compare,
	.swiper-wrapper.product-grid .mobile2-brand-slot--compare {
		grid-column: 3 !important;
		justify-content: flex-end !important;
	}

	/* Схлопываем блок, если там только перенесённые иконки (не трогаем «Запрос цены») */
	.main-products.product-grid .buttons-wrapper,
	.module-products .product-grid .buttons-wrapper,
	.swiper-wrapper.product-grid .buttons-wrapper {
		position: static !important;
		margin-top: 0 !important;
		min-height: 0 !important;
		height: 0 !important;
		overflow: visible !important;
		padding: 0 !important;
		border: none !important;
	}

	.main-products.product-grid .has-zero-price .buttons-wrapper,
	.module-products .product-grid .has-zero-price .buttons-wrapper,
	.swiper-wrapper.product-grid .has-zero-price .buttons-wrapper {
		height: auto !important;
		margin-top: 6px !important;
	}

	.main-products.product-grid .buttons-wrapper .cart-group,
	.module-products .product-grid .buttons-wrapper .cart-group {
		display: none !important;
	}

	/* Товары без цены — кнопка «Запрос цены» на всю ширину */
	.main-products.product-grid .has-zero-price .buttons-wrapper .boc_order_category_btn,
	.module-products .product-grid .has-zero-price .buttons-wrapper .boc_order_category_btn,
	.swiper-wrapper.product-grid .has-zero-price .buttons-wrapper .boc_order_category_btn {
		display: flex !important;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding: 8px 10px !important;
		font-size: 10px !important;
		line-height: 1.2 !important;
		justify-content: center !important;
		align-items: center !important;
		box-sizing: border-box !important;
	}

	/* Иконки внизу скрыты до сборки строки (убирает скачок layout) */
	body:not(.mobile2-ready) .main-products.product-grid .buttons-wrapper .wish-group,
	body:not(.mobile2-ready) .module-products .product-grid .buttons-wrapper .wish-group {
		visibility: hidden !important;
		pointer-events: none !important;
	}

	body.mobile2-ready .main-products.product-grid .buttons-wrapper .wish-group:empty,
	body.mobile2-ready .module-products .product-grid .buttons-wrapper .wish-group:empty {
		display: none !important;
	}

	.main-products.product-grid .mobile2-brand-slot .btn-wishlist,
	.main-products.product-grid .mobile2-brand-slot .btn-compare,
	.module-products .product-grid .mobile2-brand-slot .btn-wishlist,
	.module-products .product-grid .mobile2-brand-slot .btn-compare,
	.swiper-wrapper.product-grid .mobile2-brand-slot .btn-wishlist,
	.swiper-wrapper.product-grid .mobile2-brand-slot .btn-compare {
		pointer-events: auto !important;
		width: 26px !important;
		height: 26px !important;
		padding: 0 !important;
		margin: 0 !important;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.main-products.product-grid .product-thumb .image .myvid a,
	.module-products .product-grid .myvid a {
		transform: scale(0.85);
		transform-origin: bottom right;
	}

	.main-products.product-grid .product-thumb .image img,
	.module-products .product-grid .product-thumb .image img {
		border-radius: 8px !important;
	}

	.main-products.product-grid .product-layout:hover,
	.main-products .product-layout:hover {
		border-radius: 8px !important;
	}

	/* Главная: только высота карточки в карусели (ширину — mobile2.js) */
	.module-products-grid.carousel-mode .product-layout.swiper-slide {
		min-height: 300px !important;
	}

	.mobile .module-products-398 .product-grid .product-thumb .btn-cart.btn,
	.mobile .module-products-398 .product-grid .product-thumb .standartcart-new.btn {
		width: 100% !important;
		max-width: 100% !important;
		padding: 6px 8px !important;
		margin: 0 !important;
	}

	.mobile .module-products-398 .myblockprice {
		padding-right: 0 !important;
		padding-left: 0 !important;
	}
}
