/* =========================================================
   GRAND BAR: мини-корзина — выпадающий список и панель в каталоге
   ========================================================= */
.gb-mc {
	--gb-mc-accent: #F9A91D;
	--gb-mc-accent-hover: #e09005;
	--gb-mc-text: #1d1d1b;
	--gb-mc-muted: #6b7280;
	--gb-mc-line: #eceef1;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--gb-mc-line);
	border-radius: 18px;
	box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
	font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--gb-mc-text);
	overflow: hidden;
}

.gb-mc *,
.gb-mc *::before,
.gb-mc *::after {
	box-sizing: border-box;
}

/* ---------- шапка ---------- */
.gb-mc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 18px 12px;
	border-bottom: 1px solid var(--gb-mc-line);
	font-size: 17px;
}

.gb-mc-head b {
	font-weight: 700;
}

.gb-mc-count {
	padding: 3px 10px;
	border-radius: 999px;
	background: #fff4dc;
	color: #8a5a00;
	font-size: 12px;
	font-weight: 600;
}

.gb-mc-close {
	margin-left: auto;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 10px;
	background: #f3f4f6;
	color: #4b5563;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.gb-mc-close:hover {
	background: #e5e7eb;
	color: var(--gb-mc-text);
}

/* ---------- список ---------- */
.gb-mc-list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 4px 8px;
	overscroll-behavior: contain;
}

.gb-mc-list::-webkit-scrollbar {
	width: 6px;
}

.gb-mc-list::-webkit-scrollbar-thumb {
	border-radius: 6px;
	background: #e5e7eb;
}

.gb-mc-item {
	position: relative;
	display: flex;
	gap: 10px;
	padding: 7px 26px 7px 6px;
	border-radius: 14px;
	transition: background-color 0.3s, opacity 0.2s;
}

.gb-mc-item + .gb-mc-item {
	margin-top: 2px;
}

.gb-mc-item:hover {
	background: #f9fafb;
}

.gb-mc-item.is-added {
	animation: gbMcFlash 2.2s ease-out 1;
}

.gb-mc-item.is-busy {
	opacity: 0.45;
	pointer-events: none;
}

@keyframes gbMcFlash {
	0%, 30% { background: #fff4dc; }
	100% { background: transparent; }
}

.gb-mc-pic {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--gb-mc-line);
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
}

.gb-mc-pic img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.gb-mc-noimg {
	font-size: 16px;
	font-weight: 700;
	color: #d1d5db;
}

.gb-mc-info {
	flex: 1 1 auto;
	min-width: 0;
}

.gb-mc-name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gb-mc-text) !important;
	text-decoration: none !important;
}

a.gb-mc-name:hover {
	color: var(--gb-mc-accent-hover) !important;
}

.gb-mc-units {
	margin-top: 2px;
	font-size: 11px;
	color: var(--gb-mc-muted);
	line-height: 1.35;
}

.gb-mc-units span {
	color: #9ca3af;
}

.gb-mc-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	margin-top: 5px;
}

.gb-mc-qty {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 2px;
	border: 1px solid var(--gb-mc-line);
	border-radius: 999px;
	background: #fff;
}

.gb-mc-qty button {
	width: 22px;
	height: 22px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #fff4dc;
	color: #8a5a00;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s;
}

.gb-mc-qty button:hover {
	background: var(--gb-mc-accent);
	color: var(--gb-mc-text);
}

.gb-mc-qty-val {
	min-width: 38px;
	padding: 0 3px;
	font-size: 12px;
	font-weight: 700;
	text-align: center;
	white-space: nowrap;
}

.gb-mc-pack {
	color: #8a5a00 !important;
	font-weight: 600;
}

.gb-mc-packplus {
	height: 22px;
	padding: 0 7px;
	border: 1px solid #f3d9a4;
	border-radius: 999px;
	background: #fff8ea;
	color: #8a5a00;
	font-family: inherit;
	font-size: 10px;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
}

.gb-mc-packplus:hover {
	background: #F9A91D;
	border-color: #F9A91D;
	color: #1d1d1b;
}

.gb-mc-sum {
	margin-left: auto;
	font-size: 13px;
	font-weight: 700;
	white-space: nowrap;
}

.gb-mc-del {
	position: absolute;
	top: 5px;
	right: 4px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #9ca3af;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.gb-mc-del:hover {
	background: #fef2f2;
	color: #dc2626;
}

/* ---------- итог и кнопки ---------- */
.gb-mc-foot {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 18px 18px;
	border-top: 1px solid var(--gb-mc-line);
	background: #fcfcfd;
}

.gb-mc-total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 4px;
	font-size: 14px;
	color: var(--gb-mc-muted);
}

.gb-mc-total b {
	font-size: 20px;
	font-weight: 800;
	color: var(--gb-mc-text);
}

.gb-mc-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none !important;
	transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

.gb-mc-btn--accent {
	background: var(--gb-mc-accent);
	color: var(--gb-mc-text) !important;
	box-shadow: 0 6px 14px rgba(249, 169, 29, 0.32);
}

.gb-mc-btn--accent:hover {
	background: var(--gb-mc-accent-hover);
	transform: translateY(-1px);
}

.gb-mc-btn--ghost {
	border: 1.5px solid var(--gb-mc-text);
	background: #fff;
	color: var(--gb-mc-text) !important;
}

.gb-mc-btn--ghost:hover {
	background: var(--gb-mc-text);
	color: #fff !important;
}

/* ---------- пусто / загрузка ---------- */
.gb-mc-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 26px 22px 22px;
	text-align: center;
	font-size: 14px;
	color: var(--gb-mc-muted);
}

.gb-mc-empty b {
	font-size: 16px;
	color: var(--gb-mc-text);
}

.gb-mc-empty .gb-mc-btn {
	width: 100%;
	margin-top: 10px;
}

.gb-mc-empty-ico,
.gb-mc-tab-ico {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff4dc no-repeat center / 22px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e09005' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E");
}

.gb-mc-loading {
	padding: 28px 18px;
	text-align: center;
	font-size: 14px;
	color: var(--gb-mc-muted);
}

/* =========================================================
   Выпадающий список у корзины в шапке
   ========================================================= */
.gb-mc-dropdown {
	position: fixed;
	z-index: 1060;
	width: 380px;
	max-width: calc(100vw - 24px);
	max-height: min(560px, calc(100vh - 120px));
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

.gb-mc-dropdown.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
}

.gb-mc-dropdown::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 0;
	right: 0;
	height: 10px;
}

/* =========================================================
   Панель корзины в каталоге
   ========================================================= */
.gb-mc-panel {
	position: fixed;
	z-index: 1050;
	display: none;
}

.gb-mc-panel.is-visible {
	display: flex;
}

/* панель — карточка справа под шапкой (верх считает скрипт: под липкой шапкой) */
.gb-mc-panel {
	top: var(--gb-mc-top, 101px);
	right: 20px;
	width: 320px;
	max-height: calc(100vh - var(--gb-mc-top, 101px) - 20px);
	transition: top 0.2s ease;
}

/* широкий экран: стоит справа от каталога постоянно */
.gb-mc-panel.is-docked {
	animation: gbMcIn 0.25s ease-out;
}

@keyframes gbMcIn {
	from { opacity: 0; transform: translateX(16px); }
	to { opacity: 1; transform: translateX(0); }
}

/* ноутбук и меньше: та же карточка, выезжает после добавления и прячется */
.gb-mc-panel:not(.is-docked) {
	right: 16px;
	width: min(300px, calc(100vw - 32px));
	transform: translateX(calc(100% + 32px));
	transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.2s ease;
}

.gb-mc-panel:not(.is-docked).is-open {
	transform: translateX(0);
}

/* ярлык «Корзина» у правого края (узкий экран) */
.gb-mc-tab {
	position: fixed;
	z-index: 1049;
	right: 0;
	top: 50%;
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 8px 12px;
	border: 1px solid var(--gb-mc-line, #eceef1);
	border-right: none;
	border-radius: 16px 0 0 16px;
	background: #fff;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
	font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: #1d1d1b;
	cursor: pointer;
	transform: translateY(-50%);
}

.gb-mc-tab.is-visible {
	display: flex;
}

.gb-mc-tab-ico {
	width: 38px;
	height: 38px;
	background-size: 19px;
}

.gb-mc-tab b {
	min-width: 22px;
	padding: 1px 6px;
	border-radius: 999px;
	background: #F9A91D;
	font-size: 12px;
	line-height: 18px;
	text-align: center;
}

.gb-mc-tab span:last-child {
	max-width: 64px;
	font-size: 11px;
	font-weight: 700;
	text-align: center;
	line-height: 1.2;
}

.gb-mc-tab:hover {
	background: #fff8ea;
}

/* планшет и телефон: панель компактнее, не выше 70% экрана */
@media (max-width: 991px) {
	.gb-mc-panel:not(.is-docked) {
		width: min(320px, calc(100vw - 24px));
		max-height: min(70vh, calc(100vh - var(--gb-mc-top, 101px) - 20px));
	}

	.gb-mc-head {
		padding: 12px 14px 10px;
		font-size: 15px;
	}

	.gb-mc-foot {
		gap: 6px;
		padding: 10px 14px 14px;
	}

	.gb-mc-total b {
		font-size: 17px;
	}

	.gb-mc-btn {
		height: 40px;
		font-size: 13px;
	}
}

/* уведомление «Добавлено в корзину» (планшет и телефон) */
.gb-mc-toast {
	position: fixed;
	z-index: 1065;
	left: 50%;
	bottom: 20px;
	display: flex;
	align-items: center;
	gap: 10px;
	width: min(420px, calc(100vw - 24px));
	padding: 10px 10px 10px 12px;
	border: 1px solid #eceef1;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 14px 34px rgba(15, 23, 42, 0.2);
	font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: #1d1d1b;
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 16px);
	transition: opacity 0.2s, transform 0.2s, visibility 0s linear 0.2s;
}

.gb-mc-toast.is-open {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	transition: opacity 0.2s, transform 0.2s, visibility 0s;
}

.gb-mc-toast-ok {
	flex: 0 0 30px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #16a34a;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 30px;
	text-align: center;
}

.gb-mc-toast-text {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 12px;
	line-height: 1.3;
}

.gb-mc-toast-text b {
	display: block;
	font-size: 13px;
}

.gb-mc-toast-text span {
	display: block;
	overflow: hidden;
	color: #6b7280;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.gb-mc-toast-open {
	flex: 0 0 auto;
	height: 36px;
	padding: 0 12px;
	border: none;
	border-radius: 999px;
	background: #F9A91D;
	color: #1d1d1b;
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
}

.gb-mc-tab.is-pulse {
	animation: gbMcPulse 0.9s ease-out 2;
}

@keyframes gbMcPulse {
	0% { box-shadow: 0 0 0 0 rgba(249, 169, 29, 0.6); }
	100% { box-shadow: 0 0 0 14px rgba(249, 169, 29, 0); }
}

@media (max-width: 575px) {
	.gb-mc-panel:not(.is-docked) {
		right: 12px;
		width: calc(100vw - 24px);
	}

	.gb-mc-tab {
		top: auto;
		bottom: 90px;
		transform: none;
	}
}

@media print {
	.gb-mc,
	.gb-mc-tab {
		display: none !important;
	}
}
