/* Превью корзины в шапке: поповер под иконкой корзины. JS позиционирует и показывает. */
/* Выше .lf-header (z-index: 12000), иначе шапка перекрывает верхнюю кромку поповера; ниже .lf-callback-modal (13000) */
.lf-cart-preview {
	position: fixed;
	top: 0;
	left: 0;
	width: 360px;
	max-width: calc(100vw - 24px);
	z-index: 12500;
	pointer-events: none;
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Стрелка-нотча сверху: указывает на иконку корзины. JS обновляет --lf-cart-preview-arrow-x под текущую иконку. */
.lf-cart-preview::before {
	content: "";
	position: absolute;
	bottom: 100%;
	left: var(--lf-cart-preview-arrow-x, calc(100% - 24px));
	width: 0;
	height: 0;
	margin-bottom: -1px;
	transform: translateX(-50%);
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-bottom: 9px solid #ffffff;
	pointer-events: none;
	filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.06));
}

.lf-cart-preview.lf-cart-preview--open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

@media (max-width: 1023px) {
	.lf-cart-preview,
	.lf-cart-preview.lf-cart-preview--open {
		display: none !important;
	}
}

.lf-cart-preview__inner {
	display: flex;
	flex-direction: column;
	max-height: min(70vh, 480px);
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0px 18px 44px 0px rgba(0, 0, 0, 0.16);
	overflow: hidden;
	font-family: 'Rubik', system-ui, sans-serif;
	color: #111111;
}

.lf-cart-preview__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px 12px;
	border-bottom: 1px solid #eeeeee;
}

.lf-cart-preview__title {
	margin: 0;
	font-size: 18px;
	line-height: 1.25;
	font-weight: 400;
	color: #111111;
}

.lf-cart-preview__items {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 14px 18px;
	overflow-y: auto;
	flex: 1 1 auto;
	min-height: 0;
}

.lf-cart-preview__items:empty {
	display: none;
}

.lf-cart-preview__items::-webkit-scrollbar {
	width: 6px;
}

.lf-cart-preview__items::-webkit-scrollbar-thumb {
	background: #d8d8dc;
	border-radius: 3px;
}

.lf-cart-preview__empty {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	min-height: 180px;
	padding: 40px 18px;
	text-align: center;
	color: #6f6f73;
	font-size: 14px;
}

/* Карточка позиции в превью: фото 3:4 + детали + удалить.
   Фото и текст одной высоты: фото 78×104 (3:4), у тела min-height = высоте фото, чтобы при коротком названии текст не «стягивал» строку. */
.lf-cart-preview__item {
	display: grid;
	grid-template-columns: 78px minmax(0, 1fr) auto;
	gap: 12px;
	align-items: flex-start;
}

.lf-cart-preview__media {
	display: block;
	width: 78px;
	height: 104px; /* 3:4 */
	border-radius: 6px;
	overflow: hidden;
	background: #f3f3f5;
	flex: 0 0 auto;
}

.lf-cart-preview__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lf-cart-preview__body {
	min-width: 0;
	min-height: 104px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.lf-cart-preview__name {
	margin: 0;
	font-size: 14px;
	line-height: 1.3;
	font-weight: 500;
	color: #111111;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	text-decoration: none;
}

.lf-cart-preview__name:hover {
	color: #404042;
}

.lf-cart-preview__props {
	margin: 0;
	font-size: 12px;
	line-height: 1.35;
	color: #6f6f73;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 6px;
}

.lf-cart-preview__props-separator {
	color: #c0c0c4;
}

.lf-cart-preview__qty-row {
	display: flex;
	align-items: baseline;
	gap: 6px;
	margin-top: 2px;
	font-size: 13px;
	line-height: 1.25;
	color: #404042;
}

.lf-cart-preview__unit-price {
	display: inline-flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 7px;
	min-width: 0;
}

.lf-cart-preview__price-old {
	position: relative;
	display: inline-flex;
	align-items: baseline;
	color: inherit;
	font-size: 13px;
	line-height: 1.2;
	font-weight: inherit;
	white-space: nowrap;
}

.lf-cart-preview__price-old::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 1px;
	background: currentColor;
	transform: translateY(-50%);
}

.lf-cart-preview__price-current {
	display: inline-flex;
	align-items: baseline;
	color: inherit;
	font-weight: inherit;
	white-space: nowrap;
}

.lf-cart-preview__sum {
	font-size: 14px;
	line-height: 1.25;
	font-weight: 500;
	color: #111111;
	margin-top: 2px;
}

.lf-cart-preview__sum .lf-product-card__price-digits,
.lf-cart-preview__qty-row .lf-product-card__price-digits {
	font-variant-numeric: tabular-nums;
}

.lf-cart-preview__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 1px solid #d8d8dc;
	border-radius: 6px;
	background: #ffffff;
	color: #404042;
	cursor: pointer;
	flex: 0 0 auto;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lf-cart-preview__remove:hover,
.lf-cart-preview__remove:focus-visible {
	background: #404042;
	border-color: #404042;
	color: #ffffff;
}

/* Без рамки фокуса после клика мышью; для клавиатурного focus-visible — рамка остаётся выше. */
.lf-cart-preview__remove:focus:not(:focus-visible) {
	outline: none;
}

.lf-cart-preview__remove[disabled] {
	opacity: 0.5;
	cursor: default;
}

.lf-cart-preview__footer {
	border-top: 1px solid #eeeeee;
	padding: 14px 18px 18px;
	background: #ffffff;
}

.lf-cart-preview__summary {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid #eeeeee;
}

.lf-cart-preview__summary-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	font-size: 14px;
	line-height: 1.25;
	font-weight: 400;
	color: #404042;
}

.lf-cart-preview__summary-row strong {
	color: #111111;
	font-size: 15px;
	line-height: 1.25;
	font-weight: 500;
	text-align: right;
	white-space: nowrap;
}

.lf-cart-preview__summary-row--discount strong {
	color: #ff1734;
}

.lf-cart-preview__summary-row .lf-product-card__price-digits {
	font-variant-numeric: tabular-nums;
}

.lf-cart-preview__total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 12px;
	font-size: 16px;
	line-height: 1.25;
	color: #111111;
}

.lf-cart-preview__total strong {
	font-size: 20px;
	font-weight: 500;
	letter-spacing: -0.0195em;
}

.lf-cart-preview__total .lf-product-card__price-digits {
	font-variant-numeric: tabular-nums;
}

.lf-cart-preview__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.lf-cart-preview__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	padding: 0 16px;
	border-radius: 8px;
	font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	-webkit-appearance: none;
	appearance: none;
}

/* Без рамки фокуса после клика мышью у обеих кнопок popover-а. */
.lf-cart-preview__btn:focus:not(:focus-visible) {
	outline: none;
}

/* Primary «Перейти в корзину» — стиль кнопки «Обратный звонок» в шапке (без тени). */
.lf-cart-preview__btn--primary {
	background: #404042;
	color: #ffffff;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.375;
	border: 0;
	box-shadow: none;
	transition: opacity 0.2s ease;
}

.lf-cart-preview__btn--primary:hover,
.lf-cart-preview__btn--primary:focus-visible {
	opacity: 0.88;
	background: #404042;
	color: #ffffff;
	box-shadow: none;
}

/* Ghost «Очистить корзину» — стиль кнопки «Запросить цену» из карточки каталога. */
.lf-cart-preview__btn--ghost {
	background: #ffffff;
	color: #0a0a0a;
	border: 1px solid #404042;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.15;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Hover как у кнопки «Очистить» в умном фильтре: светло-серая заливка, текст и обводка не меняются. */
@media (hover: hover) and (pointer: fine) {
	.lf-cart-preview__btn--ghost:hover:not(:focus) {
		background: #f5f5f5;
		color: #0a0a0a;
		border-color: #404042;
	}
}

.lf-cart-preview__btn--ghost:focus:not(:focus-visible),
.lf-cart-preview__btn--ghost:focus:not(:focus-visible):hover {
	background: #ffffff;
	color: #0a0a0a;
	border: 1px solid #404042;
}

.lf-cart-preview__btn--ghost:focus-visible {
	outline: 2px solid rgba(64, 64, 66, 0.45);
	outline-offset: 2px;
	background: #ffffff;
	color: #0a0a0a;
	border: 1px solid #404042;
}

.lf-cart-preview--busy .lf-cart-preview__inner {
	pointer-events: none;
}

/* Адаптив: на узких экранах поповер растягивается почти на всю ширину */
@media (max-width: 480px) {
	.lf-cart-preview {
		width: calc(100vw - 16px);
	}

	.lf-cart-preview__items {
		padding: 12px 14px;
	}

	.lf-cart-preview__header {
		padding: 14px 14px 10px;
	}

	.lf-cart-preview__footer {
		padding: 12px 14px 14px;
	}
}
