/* Карточка товара в стиле React PageProduct (tskdiplomat) */
/* Важно: саму сетку (.items.productList) строим через grid в section.css,
   здесь не задаем display/flex/width для контейнера, чтобы не ломать ширину. */

.tsk-product-card {
	cursor: pointer;
	position: relative;
	z-index: 1;
	padding: 12px;
	padding-bottom: 16px;
	background: #fff;
	border-radius: 12px;
	border: 1px solid transparent;
	transition:
		box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	min-height: 0;
	font-family: "Montserrat", sans-serif;
	justify-content: space-between;
}

.tsk-product-card:hover {
	box-shadow: 0 4px 16px rgba(255, 204, 51, 0.2);
	border-color: rgba(255, 204, 51, 0.3);
}

/* Ссылка на товар: растянута на всю карточку, клик по карточке ведёт в карточку товара */
.tsk-product-card__link {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	pointer-events: auto;
}

/* Верхний блок: клики проходят к ссылке карточки */
.tsk-product-card__top {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	position: relative;
	z-index: 0;
	pointer-events: none;
}

/* Нижний блок поверх ссылки, но клики проходят кроме кнопок и табов цен */
.tsk-product-card__bottom {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	position: relative;
	z-index: 2;
	pointer-events: none;
}

.tsk-product-card__buttons,
.tsk-product-card__price-tabs,
.tsk-product-card__availability {
	pointer-events: auto;
}

.tsk-product-card__buttons a {
	transition: all 0.25s ease;
}

/* Ссылка "В наличии на складах" — пунктирное подчёркивание */
.tsk-product-card__availability-link {
	position: relative;
	color: #059669;
	text-decoration: none;
	border-bottom: 1px dashed rgba(5, 150, 105, 0.7);
	padding-bottom: 1px;
	cursor: pointer;
}

.tsk-product-card__availability-link:hover {
	color: #047857;
	border-bottom-color: rgba(4, 120, 87, 0.9);
}

/* Модалка "Наличие на складах" как оверлей */
.modal-window.js-stores-modal {
	position: fixed;
	inset: 0;
	z-index: 1400;
	display: none;
	background: rgba(15, 23, 42, 0.45);
}

.modal-window.js-stores-modal .modal-header {
	font-family: "Montserrat", sans-serif;
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 10px;
}

.modal-window.js-stores-modal .modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #ffffff;
	border-radius: 12px;
	padding: 16px 18px 18px;
	min-width: 260px;
	max-width: 360px;
	box-shadow: 0 18px 40px rgba(15, 23, 42, 0.4);
	box-sizing: border-box;
}

.modal-window.js-stores-modal .modal-close {
	position: absolute;
	top: 8px;
	right: 10px;
	font-size: 20px;
	cursor: pointer;
	color: #4b5563;
}

.modal-window.js-stores-modal .store-info {
	font-size: 13px;
	color: #111827;
}

.modal-window.js-stores-modal .store-label {
	font-weight: 600;
	margin-right: 4px;
}

.tsk-product-card__img {
	position: relative;
	margin-bottom: 12px;
	border-radius: 8px;
	overflow: hidden;
	height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

/* Иконки избранного / сравнения поверх изображения */
.tsk-product-card .icons-wish-and-compare {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	z-index: 3;
	pointer-events: auto;
}

.tsk-product-card .icons-wish-and-compare .row {
	margin: 0;
}

.tsk-product-card .icons-wish-and-compare .custom-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.95);
	color: #6b7280;
	text-decoration: none;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
	transition:
		background 0.2s ease,
		box-shadow 0.2s ease,
		transform 0.15s ease,
		opacity 0.15s ease;
}

.tsk-product-card .icons-wish-and-compare .custom-icon:hover {
	background: #ffffff;
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(15, 23, 42, 0.32);
	opacity: 0.98;
}

/* Состояние «добавлено в избранное» — красное сердце */
.tsk-product-card .icons-wish-and-compare .addWishlist.custom-icon.added {
	color: #ef4444;
}

.tsk-product-card
	.icons-wish-and-compare
	.addWishlist.custom-icon.added
	.icon-svg
	path {
	fill: #ef4444;
	stroke: #ef4444;
}

/* Состояние «в сравнении» — жёлтые столбики */
.tsk-product-card .icons-wish-and-compare .addCompare.custom-icon.added {
	color: var(--primary-color, #fcb514);
}

.tsk-product-card .icons-wish-and-compare .icon-svg {
	pointer-events: none;
}

/* Скрытые старые иконки для JS-логики addWishlist/addCompare */
.tsk-product-card .icons-wish-and-compare img.icon {
	display: none;
}

.tsk-product-card__img img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: transform 0.3s ease;
}

.tsk-product-card:hover .tsk-product-card__img img {
	opacity: 0.95;
}

.tsk-product-card__badges {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	z-index: 2;
	pointer-events: none;
}

.tsk-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 999px;
	font-family: "Montserrat", sans-serif;
	line-height: 1.2;
	color: #0f172a;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid rgba(15, 23, 42, 0.08);
	box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
	white-space: nowrap;
}

.tsk-badge--new {
	color: #fff;
	background: rgba(34, 197, 94, 0.95);
	border-color: rgba(34, 197, 94, 0.55);
}

.tsk-badge--hit {
	color: #1a1a1a;
	background: rgba(251, 191, 36, 0.95);
	border-color: rgba(251, 191, 36, 0.6);
}

.tsk-badge--sale {
	color: #fff;
	background: rgba(239, 68, 68, 0.95);
	border-color: rgba(239, 68, 68, 0.5);
}

.tsk-product-card__name {
	font-size: 14px;
	line-height: 1.4;
	margin: 0 0 10px 0;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
	min-height: 60px; /* резерв под 3 строки, чтобы артикул/цена/кнопки были на одной высоте */
	color: #1f2937;
	font-weight: 500;
	flex-shrink: 0;
	position: relative;
	z-index: 2;
}

.tsk-product-card__art-wrap {
	min-height: 28px;
	margin-bottom: 2px;
	flex-shrink: 0;
}

.tsk-product-card__art {
	font-size: 12px;
	color: #4b5563;
	margin: 0;
	position: relative;
	z-index: 1;
}

.tsk-product-card__avoid {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	margin: 0 0 10px 0;
	padding: 4px 0;
	min-height: 24px;
	flex-shrink: 0;
	position: relative;
	z-index: 2;
}

.tsk-product-card__avoid-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	font-size: 14px;
	color: #10b981;
	font-weight: bold;
}

.tsk-product-card__avoid--backorder .tsk-product-card__avoid-icon {
	color: #9ca3af;
	filter: grayscale(100%) brightness(0.7);
}

.tsk-product-card__availability--instock {
	color: #047857;
	margin: 0;
	font-weight: 500;
}

.tsk-product-card__availability--backorder {
	color: #6b7280;
	margin: 0;
	font-weight: 500;
}

.tsk-product-card__price-block {
	font-size: 13px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
	padding: 8px 0;
	min-height: 40px;
	flex-shrink: 0;
	position: relative;
	z-index: 2;
}

.tsk-product-card__price-tabs {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	flex-wrap: wrap;
}

.tsk-tab {
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 12px;
	color: #6b7280;
	font-weight: 400;
	transition: all 0.2s ease;
}

.tsk-tab:hover {
	background: #f3f4f6;
	color: #374151;
}

.tsk-tab--active {
	font-weight: 600;
	color: #1f2937;
	background: #fef3c7;
}

.tsk-product-card__price {
	font-size: 20px;
	font-weight: 700;
	margin: 0;
	white-space: nowrap;
	color: #1f2937;
}

.tsk-product-card__buttons {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: auto;
	flex-shrink: 0;
	position: relative;
	z-index: 2;
}

/* Базовые кнопки: фиксированная высота и выравнивание, чтобы не ломались при смене текста */
.tsk-btn {
	display: inline-flex;
	width: 100%;
	min-height: 38px;
	padding: 8px 16px;
	align-items: center;
	justify-content: center;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	font-family: "Montserrat", sans-serif;
	border-radius: 12px;
	text-decoration: none;
	cursor: pointer;
	transition:
		background 0.25s ease,
		box-shadow 0.25s ease,
		border-color 0.25s ease,
		opacity 0.25s ease,
		transform 0.2s ease;
	border: 1px solid transparent;
	box-sizing: border-box;
	white-space: nowrap;
	line-height: 1.2;
}

@media (max-width: 450px) {
	.tsk-btn {
		min-height: 34px !important;
		padding: 6px 10px !important;
		font-size: 11px !important;
	}
}

.tsk-btn span {
	white-space: nowrap;
}

/* «В корзину» — основное состояние */
.tsk-btn--cart {
	background: linear-gradient(135deg, #ffcc33 0%, #ffd700 50%, #ffcc33 100%);
	background-size: 200% 200%;
	background-position: 0 0;
	color: #1a1a1a;
	border-color: rgba(255, 204, 51, 0.4);
	box-shadow:
		0 2px 8px rgba(255, 204, 51, 0.3),
		inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.tsk-btn--cart:hover:not(.disabled):not(.added) {
	background-position: 100% 0;
	box-shadow:
		0 4px 12px rgba(255, 204, 51, 0.45),
		inset 0 1px 0 rgba(255, 255, 255, 0.5);
	transform: translateY(-1px);
}

.tsk-btn--cart:active:not(.disabled) {
	transform: translateY(0);
	box-shadow:
		0 1px 4px rgba(255, 204, 51, 0.35),
		inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* «В корзине» — тёмный фон, белый текст, при наведении аккуратное выцветание */
.tsk-btn--cart.added,
.tsk-btn--cart.cart-add {
	background: #1a1a1a !important;
	color: #fff !important;
	border: 1px solid #2d2d2d !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition:
		opacity 0.25s ease,
		background 0.25s ease;
}

.tsk-btn--cart.added:hover,
.tsk-btn--cart.cart-add:hover {
	background: #2d2d2d !important;
	color: #fff !important;
	border-color: #3d3d3d !important;
	opacity: 0.92;
	transform: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tsk-btn--cart.added:active,
.tsk-btn--cart.cart-add:active {
	opacity: 0.88;
}

.tsk-btn--cart.disabled {
	background: #e5e7eb;
	color: #fff;
	cursor: not-allowed;
	box-shadow: none;
}

.tsk-btn--cart.disabled:hover {
	transform: none;
}

.tsk-btn.addCart.loading {
	pointer-events: none;
	opacity: 0.9;
}

/* Купить в 1 клик */
.tsk-btn--oneclick {
	background: #f9fafb;
	color: #1f2937;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tsk-btn--oneclick:hover {
	background: #fff;
	border-color: #d1d5db;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.tsk-btn--oneclick:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Запросить цену — тёмный фон, белый текст, без жёлтой обводки */
/* Убираем margin-top из глобального @media (max-width: 1800px) .addCart.requestPrice */
.tsk-btn--request,
.tsk-product-card .addCart.requestPrice {
	margin-top: 0 !important;
}

.tsk-btn--request {
	background: #1a1a1a;
	color: #fff;
	border: 1px solid #2d2d2d;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	transition:
		opacity 0.25s ease,
		background 0.25s ease;
}

.tsk-btn--request:hover {
	background: #2d2d2d;
	color: #fff;
	border-color: #3d3d3d;
	opacity: 0.92;
	transform: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tsk-btn--request:active {
	opacity: 0.88;
	transform: none;
}

/* Запросить цену — после отправки (если добавляют .added) */
.tsk-btn--request.added {
	background: #252525;
	border-color: #353535;
	color: #e5e5e5;
	cursor: default;
}

.tsk-btn--request.added:hover {
	background: #2d2d2d;
	border-color: #3d3d3d;
	color: #e5e5e5;
	opacity: 0.92;
	transform: none;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Фокус для доступности */
.tsk-btn:focus {
	outline: none;
}

.tsk-btn:focus-visible {
	outline: 2px solid #ffcc33;
	outline-offset: 2px;
}

/* У тёмных кнопок — нейтральная обводка фокуса, без жёлтого */
.tsk-btn--request:focus-visible,
.tsk-btn--cart.added:focus-visible,
.tsk-btn--cart.cart-add:focus-visible {
	outline-color: rgba(255, 255, 255, 0.7);
}

/* Переопределение глобальных .addCart.added — тёмный фон, белый текст */
.tsk-product-card .tsk-btn--cart.added,
.tsk-product-card .tsk-btn--cart.cart-add {
	background: #1a1a1a !important;
	color: #fff !important;
	border-color: #2d2d2d !important;
}

.tsk-product-card .tsk-btn--cart.added:hover,
.tsk-product-card .tsk-btn--cart.cart-add:hover {
	background: #2d2d2d !important;
	color: #fff !important;
	border-color: #3d3d3d !important;
}

@media (max-width: 1400px) {
	.tsk-product-card {
		flex: 0 0 25%;
	}
}

@media (max-width: 1100px) {
	.tsk-product-card {
		flex: 0 0 33.333%;
	}
}

@media (max-width: 700px) {
	.tsk-product-card {
		flex: 0 0 50%;
	}
}

/* Мобильный: компактные карточки — меньше места между названием и блоком «под заказ» */
@media (max-width: 768px) {
	.tsk-product-card {
		padding: 10px 10px 12px;
	}
	.tsk-product-card__top {
		min-height: 0;
	}
	.tsk-product-card__img {
		margin-bottom: 8px;
		height: 180px;
	}
	.tsk-product-card__name {
		margin-bottom: 4px;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		min-height: 40px;
	}
	.tsk-product-card__art-wrap {
		min-height: 0;
		margin-bottom: 0;
	}
	.tsk-product-card__art {
		font-size: 11px;
	}
	.tsk-product-card__avoid {
		margin: 0 0 6px 0;
		padding: 2px 0;
		min-height: 20px;
		font-size: 12px;
	}
	.tsk-product-card__price-block {
		margin-bottom: 8px;
		padding: 4px 0;
		min-height: 36px;
	}
	.tsk-product-card__buttons {
		gap: 3px;
	}
	.tsk-btn {
		min-height: 36px;
		padding: 6px 12px;
		font-size: 12px;
	}
}

@media (max-width: 450px) {
	.tsk-product-card {
		flex: 0 0 100%;
		max-width: 360px;
		margin-left: auto;
		margin-right: auto;
	}
	.tsk-product-card__img {
		height: 160px;
		margin-bottom: 6px;
	}
	.tsk-product-card__name {
		margin-bottom: 3px;
		font-size: 13px;
	}
	.tsk-product-card__avoid {
		margin: 0 0 4px 0;
		min-height: 18px;
		font-size: 11px;
	}
	.tsk-product-card__price-block {
		margin-bottom: 6px;
		min-height: 32px;
	}
	.tsk-product-card__price {
		font-size: 18px;
	}
	.tsk-btn {
		min-height: 34px;
		padding: 6px 10px;
		font-size: 11px;
	}
}
