/* ==========================================================================
   Карточка товара (inc/rs-card.php). Одинаковый файл на aquasnab, trubosnab, radiatorsnab.
   --rs-card-accent и --rs-card-heading задаются из настроек темы (основной цвет и цвет заголовков).
   ========================================================================== */

:root {
	--rs-card-accent: #111827;
	--rs-card-heading: #111827;
	--rs-card-btn-bg: var(--rs-card-accent);
	--rs-card-btn-text: #fff;
	--rs-card-btn-hover-bg: var(--rs-card-btn-bg);
	--rs-card-btn-hover-text: var(--rs-card-btn-text);
	--rs-card-muted: #9aa1a9;
	--rs-card-text: #4b5563;
	--rs-card-border: #eceef1;
	--rs-card-photo: #f4f5f7;
	--rs-card-chip: #f1f3f5;
	--rs-card-in: #2e7d32;
	--rs-card-order: #b26a00;
}

/* Свои элементы показываются только в карточке .rs-card (в списке и виджетах — нет) */
.rs-card__badge,
.rs-card__chips,
.rs-card__foot { display: none; }

/* --- Сама карточка --- */
.rs-card > .product-wrapper {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 10px 10px 14px;
	background: #fff;
	border: 1px solid var(--rs-card-border);
	border-radius: 16px;
	transition: box-shadow .2s, border-color .2s;
}
/* Карусели: все слайды по высоте самого высокого, низ карточек на одной линии */
.swiper-wrapper:has(> .rs-card) { align-items: stretch !important; }
.swiper-slide.rs-card {
	display: flex !important;
	height: auto !important;
}
.swiper-slide.rs-card > .product-wrapper {
	flex: 1 1 auto;
	width: 100%;
	height: auto;
}
.rs-card > .product-wrapper:hover {
	border-color: transparent;
	box-shadow: 0 10px 30px rgba(17, 24, 39, .08);
}

/* --- Фото: серая подложка, скруглённые углы, товар целиком --- */
.rs-card .product-thumbnail {
	position: relative;
	margin: 0 !important;
	border-radius: 12px;
	overflow: hidden;
	background: var(--rs-card-photo);
}
.rs-card .product-thumbnail .product-main-image {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: transparent !important;
}
.rs-card .product-thumbnail .product-hover-image {
	position: absolute !important;
	inset: 0 !important;
	background: var(--rs-card-photo) !important;
}
.rs-card .product-thumbnail .product-main-image m-image.minimog-lazy-image,
.rs-card .product-thumbnail .product-hover-image m-image.minimog-lazy-image {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	padding: 0 !important;
	margin: 0 !important;
	background: transparent !important;
}
.rs-card .product-thumbnail m-image.minimog-lazy-image::before,
.rs-card .product-thumbnail m-image.minimog-lazy-image::after {
	display: none !important;
	content: none !important;
}
.rs-card .product-thumbnail m-image.minimog-lazy-image img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	padding: 12% !important;
	box-sizing: border-box;
	object-fit: contain !important;
	mix-blend-mode: multiply; /* белый фон фото сливается с серой подложкой */
	transition: transform .3s ease;
}
.rs-card > .product-wrapper:hover .product-main-image img { transform: scale(1.04); }

/* Бейдж размера (Ду800) — левый верхний угол фото */
.rs-card .rs-card__badge {
	display: inline-flex;
	position: absolute;
	top: 20px;
	left: 20px;
	z-index: 3;
	padding: 3px 8px;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(17, 24, 39, .08);
	font-size: 12px;
	line-height: 1.4;
	font-weight: 600;
	letter-spacing: .01em;
	color: var(--rs-card-heading);
	pointer-events: none;
}
/* Бейджи темы (скидка, новинка) — в левый нижний угол, чтобы не наезжали */
.rs-card .product-thumbnail .product-badges {
	top: auto !important;
	bottom: 10px !important;
	left: 10px !important;
}

/* Кнопка «В корзину» темы поверх фото — скрыта, своя внизу карточки */
.rs-card .product-thumbnail .woocommerce_loop_add_to_cart_wrap { display: none !important; }

/* --- Текст --- */
.rs-card .product-info {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: 12px 4px 0 !important;
	text-align: left !important;
}
.rs-card .product-info > .price,
.rs-card .product-info .star-rating,
.rs-card .product-info .reviews-wrap,
.rs-card .product-info .loop-product-rating { display: none !important; }

/* Бренд или категория — всегда одна строка с многоточием, чтобы названия стояли на одном уровне */
.rs-card .loop-product-brand,
.rs-card .loop-product-category {
	margin: 0 0 4px !important;
	overflow: hidden;
	font-size: 11px !important;
	line-height: 1.5 !important;
	padding-bottom: 1px; /* не обрезать низ букв */
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.rs-card .loop-product-brand + .loop-product-category,
.rs-card .loop-product-category + .loop-product-brand { display: none !important; } /* оба сразу — оставить первый */
.rs-card .loop-product-brand a,
.rs-card .loop-product-category a { color: var(--rs-card-muted) !important; }
.rs-card .loop-product-brand a:hover,
.rs-card .loop-product-category a:hover { color: var(--rs-card-accent) !important; }
/* Товар без бренда и категории: пустая строка на их месте */
.rs-card .product-info:not(:has(.loop-product-brand, .loop-product-category))::before {
	content: "";
	display: block;
	height: 20.5px !important; /* 16.5px строки + 4px отступа */
}

.rs-card .woocommerce-loop-product__title {
	margin: 0 !important;
	font-size: 15px !important;
	line-height: 1.35 !important;
	font-weight: 500 !important;
	min-height: 2.7em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.rs-card .woocommerce-loop-product__title a { color: var(--rs-card-heading) !important; }
.rs-card .woocommerce-loop-product__title a:hover { color: var(--rs-card-accent) !important; }

/* Чипсы характеристик — одна строка */
.rs-card .rs-card__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	height: 24px;
	margin: 8px 0 0;
	overflow: hidden;
}
.rs-card .rs-card__chips span {
	padding: 2px 8px;
	border-radius: 6px;
	background: var(--rs-card-chip);
	color: var(--rs-card-text);
	font-size: 12px;
	line-height: 20px;
	white-space: nowrap;
}

/* --- Низ: цена + наличие слева, кнопка справа --- */
.rs-card .rs-card__foot {
	display: flex;
	order: 99;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: auto;
	padding-top: 14px;
}
.rs-card .rs-card__buy { min-width: 0; }
.rs-card .rs-card__price {
	font-size: 20px;
	line-height: 1.2;
	font-weight: 600;
	color: var(--rs-card-heading);
	white-space: nowrap;
}
.rs-card .rs-card__price .woocommerce-Price-currencySymbol {
	margin-left: 2px;
	font-size: 13px;
	font-weight: 500;
	color: var(--rs-card-muted);
}
.rs-card .rs-card__price del {
	display: block;
	font-size: 12px;
	font-weight: 400;
	color: var(--rs-card-muted);
}
.rs-card .rs-card__price ins { text-decoration: none; background: none; }
.rs-card .rs-card__price--none {
	font-size: 14px;
	font-weight: 600;
	color: var(--rs-card-text);
	white-space: normal;
}
.rs-card .rs-card__stock {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 4px;
	font-size: 12px;
	line-height: 1.3;
	color: var(--rs-card-in);
}
.rs-card .rs-card__stock::before {
	content: "";
	flex: none;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}
.rs-card .rs-card__stock.is-order { color: var(--rs-card-order); }
.rs-card .rs-card__stock.is-out { color: var(--rs-card-muted); }

/* Кнопка */
.rs-card .rs-card__cart { flex: none; }
.rs-card .rs-card__cart .woocommerce_loop_add_to_cart_wrap {
	position: static !important;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	opacity: 1 !important;
	visibility: visible !important;
	transform: none !important;
	background: none !important;
}
.rs-card .rs-card__cart .woocommerce_loop_add_to_cart_wrap::before,
.rs-card .rs-card__cart .woocommerce_loop_add_to_cart_wrap::after { display: none !important; } /* подсказка темы */
.rs-card .rs-card__cart .button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	min-width: 0 !important;
	box-sizing: border-box !important;
	height: 40px !important;
	padding: 0 16px !important;
	border: 0 !important;
	border-radius: 10px !important;
	background: var(--rs-card-btn-bg) !important;
	box-shadow: none !important;
	color: var(--rs-card-btn-text) !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	text-indent: 0 !important;
	white-space: nowrap;
	transition: background-color .2s, color .2s, transform .1s;
}
.rs-card .rs-card__cart .button:hover,
.rs-card .rs-card__cart .button:focus-visible {
	background: var(--rs-card-btn-hover-bg) !important;
	color: var(--rs-card-btn-hover-text) !important;
}
.rs-card .rs-card__cart .button:active { transform: translateY(1px); }
.rs-card .rs-card__cart .button::before,
.rs-card .rs-card__cart .button::after { display: none !important; }
.rs-card .rs-card__cart .button span {
	display: inline !important;
	position: static !important;
	width: auto !important;
	height: auto !important;
	font-size: inherit !important;
	opacity: 1 !important;
	visibility: visible !important;
	color: inherit !important;
}
.rs-card .rs-card__cart .button.loading { opacity: .7; }
.rs-card .rs-card__cart .added_to_cart { display: none !important; }

/* --- Телефон: две колонки, кнопка на всю ширину под ценой --- */
@media (max-width: 575px) {
	.rs-card > .product-wrapper { padding: 8px 8px 10px; border-radius: 14px; }
	.rs-card .product-thumbnail { border-radius: 10px; }
	.rs-card .rs-card__badge { top: 14px; left: 14px; font-size: 11px; }
	.rs-card .woocommerce-loop-product__title { font-size: 14px !important; }
	.rs-card .rs-card__chips span { padding: 1px 6px; font-size: 11px; }
	.rs-card .rs-card__foot { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; }
	.rs-card .rs-card__price { font-size: 17px; }
	.rs-card .rs-card__cart .woocommerce_loop_add_to_cart_wrap { display: block !important; width: 100% !important; }
	.rs-card .rs-card__cart .button { width: 100% !important; height: 38px !important; padding: 0 8px !important; }
}
