/**
 * Number Plate Maker - Cart Drawer
 * Slide-out basket. Own file (per site optimisation conventions) enqueued
 * only when WooCommerce is active.
 */

.npm-drawer-overlay {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(16, 27, 51, 0.55);
	opacity: 0;
	transition: opacity var(--npm-slow) var(--npm-ease);
}

.npm-drawer-overlay.is-open {
	opacity: 1;
}

.npm-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 201;
	width: min(420px, 100vw);
	display: flex;
	flex-direction: column;
	background: var(--npm-white);
	box-shadow: var(--npm-shadow-lg);
	transform: translateX(105%);
	transition: transform var(--npm-slow) var(--npm-ease);
	visibility: hidden;
}

.npm-drawer.is-open {
	transform: translateX(0);
	visibility: visible;
}

.npm-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--npm-space-4) var(--npm-space-5);
	border-bottom: 4px solid var(--npm-yellow);
	background: var(--npm-navy);
}

.npm-drawer__title {
	margin: 0;
	font-size: var(--npm-text-lg);
	color: var(--npm-white);
}

.npm-drawer__close {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: var(--npm-radius-sm);
	color: var(--npm-white);
	font-size: 20px;
	line-height: 1;
}

.npm-drawer__close:hover {
	background: rgba(255, 255, 255, 0.12);
}

.npm-drawer-body {
	flex: 1;
	overflow-y: auto;
	padding: var(--npm-space-4) var(--npm-space-5);
}

.npm-drawer__foot {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--npm-space-3);
	padding: var(--npm-space-4) var(--npm-space-5);
	border-top: 1px solid var(--npm-border);
	background: var(--npm-surface-alt);
}

/* ── Mini cart contents (WooCommerce widget markup) ──── */
.npm-drawer .woocommerce-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
}

.npm-drawer .woocommerce-mini-cart-item {
	position: relative;
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: var(--npm-space-3);
	align-items: start;
	padding: var(--npm-space-3) 0;
	padding-right: 34px;
	border-bottom: 1px solid var(--npm-border);
}

.npm-drawer .woocommerce-mini-cart-item img {
	width: 64px;
	height: 48px;
	object-fit: contain;
	border: 1px solid var(--npm-border);
	border-radius: var(--npm-radius-sm);
	background: var(--npm-white);
	float: none;
	margin: 0;
}

.npm-drawer .woocommerce-mini-cart-item a:not(.remove_from_cart_button) {
	font-weight: var(--npm-weight-semibold);
	font-size: var(--npm-text-sm);
	color: var(--npm-navy);
	text-decoration: none;
}

.npm-drawer .woocommerce-mini-cart-item .quantity {
	display: block;
	font-size: var(--npm-text-sm);
	color: var(--npm-text-muted);
	margin-top: 2px;
}

/* Plate options list (variation-style data from the builder) */
.npm-drawer .woocommerce-mini-cart-item dl.variation {
	margin: var(--npm-space-1) 0 0;
	font-size: var(--npm-text-xs);
	color: var(--npm-text-muted);
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0 6px;
}

.npm-drawer .woocommerce-mini-cart-item dl.variation dt,
.npm-drawer .woocommerce-mini-cart-item dl.variation dd {
	margin: 0;
	padding: 0;
}

.npm-drawer .woocommerce-mini-cart-item dl.variation dt {
	font-weight: var(--npm-weight-semibold);
}

.npm-drawer .remove_from_cart_button {
	position: absolute;
	top: var(--npm-space-3);
	right: 0;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	line-height: 1;
	color: var(--npm-danger);
	text-decoration: none;
	border: 1px solid var(--npm-border);
	border-radius: var(--npm-radius-sm);
	background: var(--npm-white);
}

.npm-drawer .remove_from_cart_button:hover {
	background: var(--npm-danger-soft);
	border-color: var(--npm-danger);
	color: var(--npm-danger);
}

.npm-drawer .woocommerce-mini-cart__total {
	display: flex;
	justify-content: space-between;
	padding: var(--npm-space-4) 0 0;
	margin: 0;
	font-size: var(--npm-text-base);
	color: var(--npm-navy);
}

/* The widget's own buttons are replaced by the drawer footer. */
.npm-drawer .woocommerce-mini-cart__buttons {
	display: none;
}

.npm-drawer .woocommerce-mini-cart__empty-message {
	margin: var(--npm-space-6) 0;
	text-align: center;
	color: var(--npm-text-muted);
}

/* Loading state while fragments refresh */
.npm-drawer.is-busy .npm-drawer-body {
	opacity: 0.5;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.npm-drawer,
	.npm-drawer-overlay {
		transition: none;
	}
}
