/*
 * The side cart — design/Cart.dc.html. A <dialog>, hidden until the script
 * opens it. Loaded as a plain stylesheet (inc/assets.php says why).
 * On phones (≤ 520 px) it takes the whole screen.
 */

.minicart {
	position: fixed;
	inset: 0 0 0 auto;
	width: min(480px, 100vw);
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--white);
	color: var(--ink);
	box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.4);
	overflow: hidden;
}

.minicart[open] {
	display: flex;
	animation: minicart-in 0.26s var(--ease);
}

.minicart::backdrop {
	background: rgba(21, 19, 28, 0.55);
}

@keyframes minicart-in {
	from { transform: translateX(32px); opacity: 0; }
}

html:has(.minicart[open]) {
	overflow: hidden;
}

.minicart__content {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 0;
}

.minicart__content.is-busy {
	cursor: progress;
}

.minicart__content.is-busy .minicart__scroll,
.minicart__content.is-busy .minicart__foot {
	opacity: 0.6;
	pointer-events: none;
}

.minicart__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 16px 14px 24px;
}

.minicart__title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
}

.minicart__count {
	color: var(--muted);
	font-weight: 500;
}

/* Free delivery */
.minicart__free {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0 24px;
	padding: 16px;
	border-radius: 18px;
	background: var(--soft);
	font-size: 15px;
}

.minicart__bar {
	display: block;
	height: 8px;
	border-radius: 8px;
	background: #e5e1ea;
	overflow: hidden;
}

.minicart__bar .stripe {
	display: block;
	height: 100%;
	transition: width 0.4s var(--ease);
}

/* A refusal from the shop (not enough in stock, a plugin's rule) */
.minicart__notice {
	margin: 8px 0 0;
	padding: 12px 14px;
	border-radius: 14px;
	background: #fdecef;
	color: #9b1239;
	font-size: 14px;
}

/* Items */
.minicart__scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px 24px 16px;
}

.minicart__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mc-item {
	display: flex;
	gap: 16px;
	padding: 18px 0;
	border-bottom: 1px solid var(--line);
}

.mc-item__thumb {
	flex: none;
	width: 92px;
	height: 112px;
	border-radius: 16px;
}

.mc-item__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mc-item__top {
	display: flex;
	justify-content: space-between;
	gap: 10px;
}

.mc-item__name {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--ink);
}

.mc-item__name:hover {
	color: var(--b2b);
}

.mc-item__price {
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
}

.mc-item__meta,
.mc-item__body .variation {
	font-size: 13px;
	color: var(--muted);
}

.mc-item__body .variation {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0 6px;
	margin: 0;
}

.mc-item__body .variation dd,
.mc-item__body .variation p {
	margin: 0;
}

.mc-item__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0 12px;
	margin-top: auto;
	padding-top: 8px;
}

.mc-qty {
	display: inline-flex;
	align-items: center;
	height: 44px;
	border: 1.5px solid var(--field-border);
	border-radius: var(--r-pill);
}

.mc-qty button {
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: var(--r-pill);
	background: transparent;
	color: var(--ink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.mc-qty button:hover:not(:disabled) {
	background: var(--soft-3);
}

.mc-qty button:disabled {
	color: var(--line-2);
	cursor: default;
}

.mc-qty__value {
	min-width: 20px;
	text-align: center;
	font-size: 14px;
	font-weight: 700;
}

.mc-item__qty-fixed {
	font-size: 14px;
	font-weight: 600;
}

.mc-item__remove {
	min-height: 44px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var(--muted);
	font: 500 13px var(--font-body);
	text-decoration: underline;
	cursor: pointer;
}

.mc-item__remove:hover {
	color: var(--ink);
}

/* „Добави и спести доставката“ */
.mc-upsell {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px 0 8px;
}

.mc-upsell__title {
	font-size: 14px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}

.mc-upsell__row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	border: 1.5px dashed var(--line-2);
	border-radius: 18px;
}

.mc-upsell__thumb {
	flex: none;
	width: 56px;
	height: 56px;
	border-radius: 12px;
}

.mc-upsell__text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mc-upsell__name {
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
}

.mc-upsell__meta {
	font-size: 13px;
	color: var(--muted);
}

.mc-upsell__add {
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: var(--r-pill);
	background: var(--ink);
	color: var(--white);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.mc-upsell__add:hover {
	background: var(--ink-hover);
	color: var(--white);
}

.mc-upsell__add.is-loading {
	opacity: 0.6;
}

/* Totals */
.minicart__foot {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 18px 24px 24px;
	border-top: 1px solid var(--line);
}

.minicart__row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 15px;
	color: var(--ink-2);
}

.minicart__row strong {
	color: var(--ink);
}

.minicart__checkout {
	height: 58px;
	margin-top: 4px;
	font-size: 16px;
	font-weight: 700;
}

.minicart__couriers {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 13px;
	color: var(--muted);
}

.minicart__couriers .courier {
	padding: 4px 8px;
	border-radius: 6px;
	background: var(--soft-3);
	color: var(--ink);
	font-size: 12px;
	font-weight: 700;
}

/* Empty */
.minicart__empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px 40px 80px;
	text-align: center;
}

.minicart__empty p {
	margin: 0;
}

.minicart__empty-icon {
	width: 72px;
	height: 72px;
	border-radius: var(--r-pill);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.minicart__empty-title {
	font-size: 20px;
	font-weight: 700;
}

.minicart__empty .btn {
	margin-top: 8px;
}

/* The cart page (/kolichka/): the same rows beside the totals */
.cart-page {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 400px;
	gap: 48px;
	align-items: start;
	padding-bottom: 88px;
}

.cart-page__items {
	border-top: 1px solid var(--line);
}

.cart-page .quantity {
	height: 44px;
	padding: 0 2px;
}

.cart-page .quantity__btn {
	width: 40px;
	height: 40px;
}

.cart-page__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding-top: 20px;
}

/* with the script the cart updates itself as the quantity changes */
.js .cart-page__actions [name="update_cart"] {
	display: none;
}

.cart-page__side {
	position: sticky;
	top: 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.cart-page__totals {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: var(--r-card);
}

.cart-page__totals .minicart__free {
	margin: 0 0 6px;
}

.cart-page .minicart__empty {
	padding: 40px 16px 88px;
}

.cart-page + .minicart__empty,
.shop-page > .woocommerce > .minicart__empty {
	padding: 40px 16px 88px;
}

@media (max-width: 960px) {
	.cart-page {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
	}

	.cart-page__side {
		position: static;
	}
}

@media (max-width: 520px) {
	.minicart {
		width: 100vw;
		box-shadow: none;
	}

	.minicart__head {
		padding: 10px 8px 10px 16px;
	}

	.minicart__title {
		font-size: 20px;
	}

	.minicart__free {
		margin: 0 16px;
		padding: 14px;
		font-size: 14px;
	}

	.minicart__scroll {
		padding: 4px 16px 12px;
	}

	.mc-item {
		gap: 12px;
		padding: 14px 0;
	}

	.mc-item__thumb {
		width: 76px;
		height: 96px;
		border-radius: 14px;
	}

	.mc-item__name,
	.mc-item__price {
		font-size: 14px;
	}

	.minicart__foot {
		gap: 10px;
		padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
	}

	.minicart__checkout {
		height: 54px;
	}
}

/* A phone on its side (390 px high): head, delivery box and totals left the
   list no height at all. The whole drawer scrolls instead, the head stays. */
@media (max-height: 560px) {
	.minicart__content {
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.minicart__head {
		position: sticky;
		top: 0;
		z-index: 1;
		flex: none;
		padding-top: 10px;
		padding-bottom: 8px;
		background: var(--white);
	}

	.minicart__scroll {
		flex: none;
		overflow: visible;
	}

	.minicart__foot {
		flex: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.minicart[open] {
		animation: none;
	}
}

/* Touch screens (main.css, „Touch screens“): the steppers' buttons are 44 px. */
@media (pointer: coarse) {
	.mc-qty,
	.cart-page .quantity {
		height: 48px;
	}

	.mc-qty button,
	.cart-page .quantity__btn {
		width: 44px;
		height: 44px;
	}
}

