/* Модуль «Новинки, Скидки, Рекомендуем» — стиль сайта adamieva.by */

.home-products-module {
	--hpm-accent: var(--green);
	--hpm-accent-hover: var(--green-hover);
	--hpm-text: var(--white);
	--hpm-muted: var(--gray);
	--hpm-card-bg: var(--product-grid-bg);
	--hpm-border: var(--gray-border);
	margin: 48px 0;
	padding: 0 15px;
	width: 100%;
	max-width: none;
	background: transparent;
}

.home-products-tabs {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-bottom: 32px;
	flex-wrap: nowrap;
	white-space: nowrap;
}

.home-products-tab {
	position: relative;
	padding: 12px 24px;
	font-size: 21px;
	font-weight: 700;
	color: var(--black);
	background: transparent;
	border: none;
	border-radius: 0;
	cursor: pointer;
	transition: color 0.25s, background 0.25s;
	flex-shrink: 0;
}

.home-products-tab:hover {
	color: var(--black);
}

.home-products-tab.active {
	color: var(--white);
	background: var(--red);
}

.home-products-tab.active::after {
	display: none;
}

.home-products-panels { position: relative; }

/* CLS: резерв высоты для карусели (Owl инициализируется после DOMContentLoaded) */
.home-products-module .home-products-panels {
	min-height: 420px;
}
@media (max-width: 767px) {
	.home-products-module .home-products-panels {
		min-height: 360px;
	}
}

.home-products-panel { display: none; }
.home-products-panel.active { display: block; }

/* Owl Carousel + fallback для контента */
.home-products-grid {
	position: relative;
}

.home-products-grid.owl-carousel .owl-item .home-products-card {
	width: 100%;
	margin: 0;
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* Owl по умолчанию ставит img width:50% — переопределяем, картинка на всю область */
.home-products-module .owl-item .home-products-card__image {
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
}

.home-products-module .owl-item .home-products-card__image img {
	width: 100% !important;
	height: 100% !important;
	display: block !important;
	object-fit: cover;
}

.home-products-card {
	background: transparent;
	border-radius: 4px;
	overflow: hidden;
	transition: transform 0.2s, box-shadow 0.2s;
}

.home-products-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.home-products-card__inner { padding: 0; }

.home-products-card__image {
	position: relative;
	aspect-ratio: 1;
	overflow: hidden;
}

/* Иконка скидки — сверху слева */
.home-products-card__discount-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	color: var(--white);
	background: var(--red);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	padding: 4px 10px;
	border-radius: 0;
}

.home-products-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Избранное — тёмный фон для видимости сердца на любом изображении */
.home-products-card__wishlist {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 3;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 12px;
	color: #fff;
	cursor: pointer;
	transition: transform 0.2s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.home-products-card__wishlist:hover {
	background: rgba(0, 0, 0, 0.6);
	border-color: rgba(255, 255, 255, 0.35);
	transform: scale(1.05);
}

.home-products-card__wishlist .wishlist-heart--outline {
	stroke: #fff;
}

.home-products-card__wishlist.active {
	background: rgba(227, 0, 22, 0.95);
	border-color: rgba(255, 255, 255, 0.5);
	color: var(--white);
	box-shadow: 0 4px 16px rgba(227, 0, 22, 0.4);
}

.home-products-card__wishlist.active:hover {
	background: var(--red);
	transform: scale(1.05);
}

/* Две иконки: контур (по умолчанию) и заливка (в избранном) */
.home-products-card__wishlist .wishlist-icon {
	position: relative;
	width: 22px;
	height: 20px;
	display: block;
}

.home-products-card__wishlist .wishlist-heart {
	position: absolute;
	top: 0;
	left: 0;
	width: 22px;
	height: 20px;
	transition: opacity 0.25s ease, transform 0.2s ease;
}

.home-products-card__wishlist .wishlist-heart--outline {
	opacity: 1;
}

.home-products-card__wishlist .wishlist-heart--filled {
	opacity: 0;
	fill: currentColor;
}

.home-products-card__wishlist.active .wishlist-heart--outline {
	opacity: 0;
}

.home-products-card__wishlist.active .wishlist-heart--filled {
	opacity: 1;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
}

.home-products-card__body { padding: 16px; }

.home-products-card__title {
	margin: 0 0 12px;
	font-size: 17px;
	line-height: 1.35;
	font-weight: 700;
	text-align: center;
}

.home-products-card__title a {
	color: var(--black);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-align: center;
}

.home-products-card__title a:hover { color: var(--black); }

.home-products-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-bottom: 12px;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
}

/* Цена — видимая на любом фоне */
.home-products-card__price {
	color: #000 !important;
}

.home-products-card__price .price-current {
	color: #000 !important;
	font-weight: 600 !important;
}

.home-products-card__price .price-new {
	color: var(--red) !important;
	font-weight: 600 !important;
}

.home-products-card__price .price-old {
	text-decoration: line-through !important;
	color: #555 !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	margin-right: 8px !important;
}

/* Наличие в магазинах — всегда в два ряда */
.home-products-card__availability {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	margin: 0 0 14px 0;
	padding: 0;
	list-style: none;
	font-size: 12px;
	line-height: 1.2;
	font-weight: 600;
}

.home-products-card__availability .av {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 6px 6px;
	border-radius: 12px;
	transition: transform 0.15s, box-shadow 0.15s;
	white-space: normal;
	min-width: 0;
}

.home-products-card__availability .av span {
	color: inherit;
}

.home-products-card__availability .av:hover {
	transform: translateY(-1px);
}

/* В наличии: белый фон, чёрный текст */
.home-products-card__availability .av.active {
	background: #fff;
	color: #000;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	border: 1px solid #e8e8e8;
}

/* Нет в наличии: белый фон, перечёркнутый чёрный текст */
.home-products-card__availability .av:not(.active) {
	background: #fff;
	color: #000;
	text-decoration: line-through;
	border: 1px solid #e8e8e8;
}

/* Мобильная версия */
@media (max-width: 767px) {
	.home-products-card__availability {
		gap: 6px;
		margin: 0 0 12px 0;
		font-size: 13px;
	}
	.home-products-card__availability .av {
		padding: 8px 8px;
		font-size: 13px;
	}
}

/* Кнопка как в категориях */
.home-products-card__actions .button-shop,
.home-products-card__actions .availability-inquiry-btn {
	width: 100%;
	padding: 12px 16px;
	font-size: 24px;
	font-weight: 400;
	line-height: 38px;
	color: var(--white);
	background: var(--dark-gray);
	border: 1px solid var(--gray-border);
	border-radius: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.home-products-card__actions .button-shop:hover,
.home-products-card__actions .availability-inquiry-btn:hover {
	color: var(--white);
	background: var(--black);
	border-color: var(--black);
}

/* «Нет в наличии» — как кнопка «Купить», но не кликабельна */
.home-products-card__actions .out-of-stock-text,
.home-products-card__actions .button-shop.out-of-stock-text {
	width: 100%;
	padding: 12px 16px;
	font-size: 24px;
	font-weight: 400;
	line-height: 38px;
	color: var(--white);
	background: var(--dark-gray);
	border: 1px solid var(--gray-border);
	border-radius: 0;
	cursor: default;
	pointer-events: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Плитка «Загрузить ещё» — в стиле сетки товаров adamieva (product-grid-bg, красный акцент как у вкладок) */
.home-products-card--load-more-tile {
	cursor: default;
	background: var(--hpm-card-bg);
	border-radius: 4px;
	overflow: hidden;
	box-shadow: inset 0 0 0 1px var(--gray-border);
}

.home-products-card--load-more-tile:hover {
	transform: translateY(-3px);
	box-shadow:
		inset 0 0 0 1px var(--gray-border),
		0 14px 28px rgba(0, 0, 0, 0.45);
}

.home-products-card__inner--load-more {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	max-width: 100%;
	padding: 20px 16px;
	box-sizing: border-box;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 42%),
		var(--product-grid-bg);
	border-radius: 4px;
	border-top: 3px solid var(--red);
}

.home-products-load-more-hint {
	margin: 0 0 14px;
	padding: 0 8px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	text-align: center;
	color: var(--gray);
	letter-spacing: 0.02em;
}

.home-products-load-more-spinner {
	display: none;
	position: absolute;
	left: 50%;
	top: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 3px solid var(--gray-border);
	border-top-color: var(--green);
	border-radius: 50%;
	animation: hpm-spin 0.75s linear infinite;
	z-index: 2;
}

.home-products-card--load-more-tile.is-loading .home-products-load-more-spinner {
	display: block;
}

.home-products-card--load-more-tile.is-loading .home-products-load-more-hint,
.home-products-card--load-more-tile.is-loading .btn-load-more {
	opacity: 0.2;
	pointer-events: none;
}

.home-products-card--load-more-tile .btn-load-more {
	position: relative;
	z-index: 1;
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
	background: var(--dark-gray);
	color: var(--green);
	border: 2px solid var(--green);
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.home-products-card--load-more-tile .btn-load-more:hover:not(:disabled) {
	background: var(--green);
	color: var(--black);
	border-color: var(--green);
	box-shadow: 0 4px 18px rgba(179, 255, 0, 0.25);
}

.home-products-card--load-more-tile.is-loading .btn-load-more {
	cursor: wait;
}

.home-products-special-footer {
	text-align: center;
	margin-top: 24px;
	margin-bottom: 16px;
}

.home-products-special-footer .btn-view-all {
	display: inline-block;
	padding: 14px 32px;
	font-size: 16px;
	font-weight: 700;
	background: transparent;
	color: var(--black);
	border: 2px solid var(--black);
	border-radius: 4px;
	text-decoration: none;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.home-products-special-footer .btn-view-all:hover {
	background: var(--red);
	color: var(--black);
	border-color: var(--red);
}

.home-products-loader {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 24px;
}

.home-products-loader .spinner {
	width: 36px;
	height: 36px;
	border: 3px solid var(--hpm-border);
	border-top-color: var(--green);
	border-radius: 50%;
	animation: hpm-spin 0.8s linear infinite;
}

@keyframes hpm-spin { to { transform: rotate(360deg); } }

/* Owl: навигация для home-products */
.home-products-module .owl-home-products .owl-nav {
	margin-top: 16px;
}

/* Стрелки с классом .disabled не должны триггерить переход (иначе краевые баги Owl 2) */
.home-products-module .owl-home-products .owl-nav button.owl-prev.disabled,
.home-products-module .owl-home-products .owl-nav button.owl-next.disabled,
.home-products-module .owl-home-products .owl-nav .owl-prev.disabled,
.home-products-module .owl-home-products .owl-nav .owl-next.disabled {
	pointer-events: none;
	cursor: default;
}

/* Мобильная версия */
@media (max-width: 767px) {
	.home-products-module { margin: 32px 0; padding: 0 12px; }
	.home-products-tabs { gap: 6px; margin-bottom: 24px; font-size: 16px; }
	.home-products-tab { padding: 10px 16px; font-size: 16px; }
	.home-products-card__body { padding: 12px; }
	.home-products-card__title { font-size: 15px; }
	.home-products-card__discount-badge { font-size: 14px; padding: 3px 8px; }
	.home-products-load-more-hint { font-size: 12px; margin-bottom: 12px; }
	.home-products-card__inner--load-more { padding: 16px 12px; }
}
