/**
 * Корзина topCart3basket: выпадающее окно (ПК), модалка на весь экран (мобильные).
 * Стили навигации .cart-header, .cart-navigation и т.д. — в tsk_header_cart.css.
 */

.cart-dropdown {
	--cart-font:
		"Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		sans-serif;
	font-family: var(--cart-font);
}

.cart-dropdown *,
.cart-dropdown *::before,
.cart-dropdown *::after {
	box-sizing: border-box;
}

/* Оверлей: скрыт по умолчанию */
.cart-overlay {
	display: none;
}

/* ----- Десктоп: выпадающая панель ----- */
.cart-dropdown {
	position: absolute;
	top: 40px;
	right: 0;
	margin-top: 8px;
	width: 400px;
	max-height: min(480px, 85vh);
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
	z-index: 1003;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition:
		opacity 0.25s ease,
		transform 0.25s ease,
		visibility 0.25s;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.cart-dropdown.active {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.cart-dropdown-header {
	flex-shrink: 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 18px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.cart-title {
	font-weight: 600;
	font-size: 18px;
	letter-spacing: -0.02em;
	color: #111;
}

.cart-close {
	font-size: 24px;
	font-weight: 300;
	line-height: 1;
	color: #666;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	margin: -8px -8px -8px 0;
}

.cart-close:hover {
	color: #111;
}

.cart-dropdown-content {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.cart-items-wrapper {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 14px 18px;
	-webkit-overflow-scrolling: touch;
}

.cart-items-wrapper.custom-scrollbar {
	max-height: 260px;
}

.cart-items {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.cart-item {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.cart-item-image {
	width: 56px;
	height: 56px;
	border-radius: 10px;
	overflow: hidden;
	flex-shrink: 0;
	background: #f5f5f5;
}

.cart-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cart-item-link {
	color: inherit;
	text-decoration: none;
}

.cart-item-link:hover {
	color: #c95a00;
}

.cart-item-info {
	flex: 1;
	min-width: 0;
}

.cart-item-name {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
	margin-bottom: 4px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
	white-space: normal;
	color: #111;
}

a.cart-item-name {
	text-decoration: none;
	color: #111;
}

a.cart-item-name:hover {
	color: #c95a00;
}

.cart-item-price {
	font-weight: 600;
	font-size: 14px;
	color: #333;
}

.cart-item-remove {
	font-size: 22px;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
	color: #ff3b30;
	padding: 6px;
	margin: -6px -6px -6px 0;
	flex-shrink: 0;
	background: none;
	border: none;
	transition: opacity 0.2s ease, color 0.2s ease;
}

.cart-item-remove:hover {
	opacity: 0.6;
}

.cart-footer {
	flex-shrink: 0;
	padding: 16px 18px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	background: #fafafa;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.cart-total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 700;
	font-size: 16px;
	color: #111;
}

.cart-total-price {
	color: #111;
}

.cart-checkout-wrap {
	display: flex;
	justify-content: center;
}

.cart-checkout-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	margin-right: 10px;
	font-size: 14px;
	color: #1a1a1a;
	height: 46px;
	min-width: 190px;
	padding: 0 22px;
	background: linear-gradient(135deg, #ffcc33 0%, #ffd700 50%, #ffcc33 100%);
	background-size: 200% 200%;
	background-position: 0 0;
	border: 1px solid 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);
	text-decoration: none;
	font-weight: 600;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-checkout-button:hover {
	background-position: 100% 0;
	box-shadow:
		0 4px 14px rgba(255, 204, 51, 0.45),
		inset 0 1px 0 rgba(255, 255, 255, 0.5);
	transform: translateY(-1px);
}

.cart-empty {
	padding: 32px 20px;
	text-align: center;
	color: #666;
	font-size: 15px;
}

.cart-empty p {
	margin: 0;
}

/* Скроллбар */
.custom-scrollbar::-webkit-scrollbar {
	width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

/* ----- Мобильные: модалка на весь экран + кнопка «Закрыть» ----- */
@media (max-width: 1099px) {
	.cart-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: 10005;
		opacity: 0;
		transition: opacity 0.2s ease;
	}

	body.cart-mobile-open .cart-overlay {
		display: block;
		opacity: 1;
	}

	.cart-dropdown {
		position: fixed;
		inset: 0;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		max-height: none;
		margin: 0;
		border-radius: 0;
		border: none;
		z-index: 10010;
		opacity: 0;
		visibility: hidden;
		transform: none;
		transition:
			opacity 0.2s ease,
			visibility 0.2s;
	}

	.cart-dropdown.active {
		opacity: 1;
		visibility: visible;
	}

	.cart-dropdown-header {
		padding: 14px 16px;
		border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	}

	.cart-title {
		font-size: 18px;
	}

	.cart-close {
		width: 44px;
		height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 0;
		font-size: 28px;
		color: #333;
		background: rgba(0, 0, 0, 0.06);
		border-radius: 50%;
	}

	.cart-close:hover {
		background: rgba(0, 0, 0, 0.1);
	}

	.cart-dropdown-content {
		flex: 1;
		min-height: 0;
		overflow: hidden;
		background: #fff;
	}

	.cart-items-wrapper {
		padding: 12px 16px;
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
	}

	.cart-items-wrapper.custom-scrollbar {
		max-height: none;
	}

	.cart-footer {
		padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
		background: #fff;
		border-top: 1px solid rgba(0, 0, 0, 0.06);
	}

	.cart-checkout-button {
		padding: 12px 24px;
		font-size: 14px;
	}
}

@media (max-width: 480px) {
	.cart-dropdown-header {
		padding: 12px 14px;
	}

	.cart-title {
		font-size: 17px;
	}

	.cart-items-wrapper {
		padding: 10px 14px;
	}

	.cart-item-image {
		width: 48px;
		height: 48px;
	}

	.cart-item-name {
		font-size: 13px;
	}

	.cart-item-price {
		font-size: 13px;
	}

	.cart-footer {
		padding: 14px;
	}

	.cart-checkout-button {
		padding: 10px 20px;
		font-size: 13px;
	}
}
