/**
 * Мини-корзина в шапке [cart_header]
 */

.cch-wrap {
	position: relative;
	display: inline-block;
}

.cch-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	padding: 0.35rem 0.5rem;
	border: none;
	background: transparent;
	font: inherit;
	color: inherit;
	text-decoration: none;
}

.cch-trigger:hover {
	opacity: 0.85;
}

.cch-trigger-total {
	font-weight: 600;
	white-space: nowrap;
}

.cch-trigger-icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.cch-trigger-icon {
	display: block;
	width: 24px;
	height: 24px;
	object-fit: contain;
}

.cch-trigger-count {
	position: absolute;
	top: -6px;
	right: -8px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	color: #fff;
	background: #ca0815;
	border-radius: 999px;
}

/* Мобильная версия: только иконка, колонка, компактный отступ */
@media (max-width: 767px) {
	.cch-wrap .cch-trigger {
		display: inline-flex;
		flex-direction: column;
		align-items: center;
		padding: 0.05rem 0.1rem;
		gap: 0;
	}
	.cch-wrap .cch-trigger-total {
		display: none;
	}
}

.short_code_cart_mob {
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Мобильный шорткод [cart_header_mobile] — только иконка, ссылка на корзину */
.cch-wrap--mobile .cch-trigger {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	padding: 0.05rem 0.1rem;
	gap: 0;
}

/* Модальное окно */
.cch-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
	padding: 60px 16px 16px;
	pointer-events: none;
	visibility: hidden;
	opacity: 0;
	transition: visibility 0.2s, opacity 0.2s;
}

.cch-modal.cch-modal--open {
	pointer-events: auto;
	visibility: visible;
	opacity: 1;
}

.cch-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
}

.cch-container {
	position: relative;
	width: 100%;
	max-width: 600px;
	max-height: calc(100vh - 100px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	overflow: hidden;
}

.cch-loader {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	z-index: 20;
	pointer-events: none;
	border-radius: 12px;
}
.cch-loader--active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}
.cch-loader-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #f0f0f0;
	border-top-color: #ca0815;
	border-radius: 50%;
	animation: cch-spin 0.7s linear infinite;
}
@keyframes cch-spin {
	to { transform: rotate(360deg); }
}

.cch-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.cch-header-left {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.cch-header-icon {
	display: block;
	width: 24px;
	height: 24px;
	object-fit: contain;
}

.cch-header-count {
	font-weight: 700;
	color: #ca0815;
}

.cch-header-text {
	font-weight: 600;
}

.cch-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	background: transparent;
	color: #666;
	cursor: pointer;
	border-radius: 4px;
}

.cch-close:hover {
	background: #f0f0f0;
	color: #000;
}

.cch-close-icon {
	display: block;
	width: 20px;
	height: 20px;
}

.cch-body {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
}

.cch-empty {
	margin: 0;
	padding: 1.5rem 0;
	text-align: center;
	color: #666;
}

.cch-products {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.cch-product {
	display: grid;
	grid-template-columns: 60px 1fr;
	gap: 0.75rem;
	padding: 0.75rem;
	background: #f8f8f8;
	border-radius: 8px;
}

.cch-product-img img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.cch-product-info {
	position: relative;
	min-width: 0;
}

.cch-product-name {
	font-weight: 600;
	font-size: 0.9rem;
	line-height: 1.3;
	margin-bottom: 0.35rem;
}

.cch-product-name a {
	color: inherit;
	text-decoration: none;
}

.cch-product-name a:hover {
	text-decoration: underline;
}

.cch-product-qty-price {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.25rem 0.35rem;
	font-size: 0.85rem;
	color: #555;
}

.cch-product-qty-price .cch-sep {
	margin: 0 0.1em;
}

.cch-qty-wrap {
	display: inline-flex;
	align-items: center;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
}

.cch-qty-wrap .cch-qty-input {
	width: 2.5rem;
	min-width: 2.5rem;
	padding: 0.25rem 0.2rem;
	border: none;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
	font-size: 0.85rem;
	text-align: center;
}

.cch-qty-wrap .cch-qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 25px;
	height: 31px;
	padding: 0;
	border: none;
	background: #f0f0f0;
	color: #333;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.cch-qty-wrap .cch-qty-btn:hover {
	background: #e0e0e0;
}

.cch-qty-wrap .cch-qty-plus {
	background: #ca0815;
	color: #fff;
}

.cch-qty-wrap .cch-qty-plus:hover {
	background: #a30610;
}

.cch-remove {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	opacity: 0.6;
	color: #666;
}

.cch-remove:hover {
	opacity: 1;
	color: #ca0815;
}

.cch-remove-icon {
	display: block;
	width: 16px;
	height: 16px;
}

.cch-footer {
	padding: 1rem 1.25rem;
	border-top: 2px solid #eee;
	flex-shrink: 0;
}

.cch-totals {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	font-weight: 700;
	font-size: 1.1rem;
}

.cch-empty-cart {
	display: block;
	width: 100%;
	margin-top: 0.75rem;
	margin-bottom: 0;
	padding: 0.35rem 0;
	font-size: 0.8rem;
	color: #64748b;
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: underline;
	transition: color 0.2s;
	font-family: inherit;
}

.cch-empty-cart:hover {
	color: #ca0815;
}

.cch-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.cch-btn {
	display: inline-block;
	padding: 0.5rem 1rem;
	font-size: 0.9rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 0.2s;
}

.cch-btn:hover {
	opacity: 0.9;
}

.cch-btn-cart {
	background: #eee;
	color: #333;
}

.cch-btn-close {
	background: #eee;
	color: #333;
	font: inherit;
}

.cch-btn-checkout {
	background: #ca0815;
	color: #fff;
	flex: 1;
	min-width: 0;
}
