/**
 * Cart drawer — right-side slide-out panel over a dimmed overlay, driven
 * entirely by the real WooCommerce cart (Store API) via component.js. No
 * WooCommerce default mini-cart markup is used anywhere here.
 */

.qg-cart-drawer {
	position: fixed;
	inset: 0;
	z-index: 300;
}

.qg-cart-drawer[hidden] {
	display: none;
}

.qg-cart-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 14, 10, 0.5);
	opacity: 0;
	transition: opacity 0.35s var(--qg-ease);
}

.qg-cart-drawer[data-open] .qg-cart-drawer__backdrop {
	opacity: 1;
}

.qg-cart-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(440px, 100%);
	display: flex;
	flex-direction: column;
	background: var(--qg-color-surface);
	box-shadow: -20px 0 60px rgba(16, 14, 10, 0.18);
	transform: translateX(100%);
	transition: transform 0.4s var(--qg-ease);
}

.qg-cart-drawer[data-open] .qg-cart-drawer__panel {
	transform: translateX(0);
}

@media (max-width: 480px) {
	.qg-cart-drawer__panel {
		width: calc(100% - 40px);
	}
}

.qg-cart-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--qg-space-4) var(--qg-space-4) var(--qg-space-3);
	border-bottom: 1px solid var(--qg-color-line);
	flex-shrink: 0;
}

.qg-cart-drawer__title {
	margin: 0;
	font-family: var(--qg-font-body);
	font-size: 0.78rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: var(--qg-tracking-label);
	color: var(--qg-color-ink);
}

.qg-cart-drawer__count {
	margin-left: 0.4rem;
	color: var(--qg-color-muted);
	font-weight: 500;
	text-transform: none;
	letter-spacing: normal;
}

.qg-cart-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: -6px;
	border: 0;
	background: none;
	color: var(--qg-color-ink);
	cursor: pointer;
	transition: opacity 0.2s var(--qg-ease);
}

.qg-cart-drawer__close:hover {
	opacity: 0.6;
}

.qg-cart-drawer__close .qg-icon {
	width: 18px;
	height: 18px;
}

.qg-cart-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: 0 var(--qg-space-4);
}

.qg-cart-drawer__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	min-height: 200px;
}

.qg-spinner {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid var(--qg-color-line);
	border-top-color: var(--qg-color-ink);
	animation: qg-spin 0.7s linear infinite;
}

@keyframes qg-spin {
	to {
		transform: rotate(360deg);
	}
}

.qg-cart-drawer__empty {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	height: 100%;
	min-height: 240px;
	gap: 0.5rem;
}

.qg-cart-drawer__empty-title {
	margin: 0;
	font-family: var(--qg-font-heading);
	font-size: 1.3rem;
	font-weight: 500;
	color: var(--qg-color-ink);
}

.qg-cart-drawer__empty-text {
	margin: 0 0 0.5rem;
	font-size: 0.9rem;
	color: var(--qg-color-ink-soft);
}

.qg-cart-drawer__item {
	position: relative;
	display: grid;
	grid-template-columns: 76px 1fr auto;
	gap: var(--qg-space-3);
	padding-block: var(--qg-space-4);
	border-bottom: 1px solid var(--qg-color-line);
	transition: opacity 0.25s var(--qg-ease), transform 0.25s var(--qg-ease);
	animation: qg-cart-item-in 0.3s var(--qg-ease);
}

@keyframes qg-cart-item-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.qg-cart-drawer__item.is-removing {
	opacity: 0.35;
	pointer-events: none;
}

.qg-cart-drawer__item-media {
	display: block;
	aspect-ratio: 4 / 5;
	background: var(--qg-color-paper);
	overflow: hidden;
}

.qg-cart-drawer__item-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.qg-cart-drawer__item-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.qg-cart-drawer__item-name {
	font-family: var(--qg-font-body);
	font-size: 0.88rem;
	font-weight: 500;
	color: var(--qg-color-ink);
	text-decoration: none;
	line-height: 1.35;
}

.qg-cart-drawer__item-name:hover {
	color: var(--qg-color-ink-soft);
}

.qg-cart-drawer__item-variation {
	margin-top: 0.2rem;
	font-size: 0.76rem;
	color: var(--qg-color-muted);
}

.qg-cart-drawer__item-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: 0.6rem;
	gap: 0.5rem;
}

.qg-cart-drawer__item-price {
	font-family: var(--qg-font-body);
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--qg-color-ink);
	white-space: nowrap;
}

.qg-cart-drawer__item-remove {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	margin: -4px -4px 0 0;
	border: 0;
	background: none;
	color: var(--qg-color-muted);
	cursor: pointer;
	transition: color 0.2s var(--qg-ease);
}

.qg-cart-drawer__item-remove:hover {
	color: var(--qg-color-accent);
}

.qg-cart-drawer__item-remove .qg-icon {
	width: 16px;
	height: 16px;
}

/* Quantity stepper — shared visual language, also used on the cart page. */

.qg-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--qg-color-line);
	height: 32px;
}

.qg-qty__btn {
	width: 30px;
	height: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: none;
	color: var(--qg-color-ink);
	font-size: 0.95rem;
	line-height: 1;
	cursor: pointer;
	transition: opacity 0.2s var(--qg-ease);
}

.qg-qty__btn:hover:not(:disabled) {
	opacity: 0.6;
}

.qg-qty__btn:disabled {
	opacity: 0.3;
	cursor: default;
}

.qg-qty__value {
	min-width: 26px;
	text-align: center;
	font-family: var(--qg-font-body);
	font-size: 0.86rem;
	font-weight: 500;
	color: var(--qg-color-ink);
}

.qg-cart-drawer__foot {
	flex-shrink: 0;
	padding: var(--qg-space-4);
	padding-bottom: max(var(--qg-space-4), env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--qg-color-line);
	background: var(--qg-color-surface);
}

.qg-cart-drawer__foot[hidden] {
	display: none;
}

.qg-cart-drawer__subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.3rem;
	font-family: var(--qg-font-body);
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--qg-color-ink);
}

.qg-cart-drawer__note {
	margin: 0 0 var(--qg-space-3);
	font-size: 0.76rem;
	color: var(--qg-color-muted);
}

.qg-cart-drawer__view,
.qg-cart-drawer__checkout {
	display: flex;
	width: 100%;
	justify-content: center;
	margin-top: 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
	.qg-cart-drawer__backdrop,
	.qg-cart-drawer__panel,
	.qg-cart-drawer__item,
	.qg-spinner {
		transition: none;
		animation: none;
	}
}
