/**
 * Nexio Cart Drawer — slide-out mini-cart sidebar.
 *
 * The drawer body is WooCommerce's own mini-cart widget markup, so the
 * item/total/button rules below target WooCommerce's standard classes.
 */

.nexio-cart-drawer {
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: none;
	visibility: hidden;
	transition: visibility 0s linear 0.28s;
}

.nexio-cart-drawer.is-open {
	pointer-events: auto;
	visibility: visible;
	transition-delay: 0s;
}

.nexio-cart-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 20, 0.45);
	opacity: 0;
	transition: opacity 0.28s ease;
}

.nexio-cart-drawer.is-open .nexio-cart-drawer__overlay {
	opacity: 1;
}

.nexio-cart-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: min(420px, 92vw);
	display: flex;
	flex-direction: column;
	background: #fff;
	color: #111;
	box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
	transform: translateX(100%);
	transition: transform 0.28s ease;
}

.nexio-cart-drawer.is-open .nexio-cart-drawer__panel {
	transform: translateX(0);
}

.nexio-cart-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nexio-cart-drawer__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
}

/* (0,2,1) so kit/theme global button skins can't restyle it. */
.nexio-cart-drawer__header button.nexio-cart-drawer__close {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.05);
	color: inherit;
	cursor: pointer;
	transition: background 0.15s ease;
}

.nexio-cart-drawer__header button.nexio-cart-drawer__close:hover {
	background: rgba(0, 0, 0, 0.1);
}

.nexio-cart-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 22px;
}

/* Scroll lock while open. */
body.nexio-cart-drawer-open {
	overflow: hidden;
}

/* ---- WooCommerce mini-cart inside the drawer ---- */

.nexio-cart-drawer .woocommerce-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* The mini-cart template renders a line one of TWO ways, and the
 * layout has to survive both:
 *
 *   visible product  ->  <a href><img>Name</a>
 *   hidden product   ->  <img>Name          (no link at all)
 *
 * The bundle's container product is deliberately catalog-hidden, so
 * is_visible() is false, WooCommerce leaves the permalink empty, and
 * that second branch is what a bundle line always takes. An earlier
 * version of this file styled only the linked form, which is why the
 * bundle line came out unaligned with its image floated off to the
 * right by WooCommerce's own cart_list CSS.
 *
 * So the image is positioned against the ROW rather than laid out as
 * a flex child of a link that may not exist, and the row is padded to
 * leave space for it. Both branches then render identically. */
.nexio-cart-drawer .woocommerce-mini-cart-item {
	position: relative;
	display: block;
	padding: 14px 28px 14px 68px;
	margin: 0;
	min-height: 56px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	font-size: 14px;
	line-height: 1.45;
	/* The unlinked branch prints the name as a bare text node, so there
	 * is no element to weight — the row carries it, and the meta/qty
	 * rows below reset themselves back to normal. */
	font-weight: 600;
}

.nexio-cart-drawer .woocommerce-mini-cart-item img {
	position: absolute;
	top: 14px;
	left: 0;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 10px;
	/* WooCommerce's own ul.cart_list rule floats these right. */
	float: none;
	margin: 0;
}

/* Keep the link a plain inline box: if it became a positioned or flex
 * container the absolutely-positioned image above would anchor to it
 * instead of to the row. */
.nexio-cart-drawer .woocommerce-mini-cart-item a:not(.remove) {
	position: static;
	display: block;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
}

/* Item meta ("Bundle: Includes 14 products"). WooCommerce emits a
 * <dl class="variation"> with <dt> label and <dd> value, which stack
 * and indent by default — far too heavy for a drawer line. */
.nexio-cart-drawer .woocommerce-mini-cart-item dl.variation {
	display: block;
	margin: 4px 0 0;
	font-size: 13px;
	font-weight: 400;
	opacity: 0.7;
}

.nexio-cart-drawer .woocommerce-mini-cart-item dl.variation dt,
.nexio-cart-drawer .woocommerce-mini-cart-item dl.variation dd {
	display: inline;
	margin: 0;
	padding: 0;
	font-weight: 400;
}

.nexio-cart-drawer .woocommerce-mini-cart-item dl.variation dd p {
	display: inline;
	margin: 0;
}

.nexio-cart-drawer .woocommerce-mini-cart-item dl.variation dd::after {
	content: '';
	display: block;
}

.nexio-cart-drawer .woocommerce-mini-cart-item .quantity {
	display: block;
	margin-top: 4px;
	font-weight: 400;
	opacity: 0.7;
	font-size: 13px;
}

.nexio-cart-drawer .woocommerce-mini-cart-item a.remove {
	position: absolute;
	top: 50%;
	right: 0;
	transform: translateY(-50%);
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.05);
	color: #666 !important;
	font-size: 16px;
	line-height: 1;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.nexio-cart-drawer .woocommerce-mini-cart-item a.remove:hover {
	background: #fee2e2;
	color: #b91c1c !important;
}

.nexio-cart-drawer .woocommerce-mini-cart__total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	margin: 14px 0;
	padding-top: 4px;
	font-size: 15px;
	font-weight: 700;
}

.nexio-cart-drawer .woocommerce-mini-cart__buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
}

/* (0,3,1) beats theme/kit a.button skins. */
.nexio-cart-drawer .woocommerce-mini-cart__buttons a.button {
	display: block;
	width: 100%;
	margin: 0;
	padding: 12px 18px;
	border-radius: 10px;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	background: #f2f2f4;
	color: #111;
	transition: opacity 0.15s ease;
}

.nexio-cart-drawer .woocommerce-mini-cart__buttons a.button:hover {
	opacity: 0.85;
}

.nexio-cart-drawer .woocommerce-mini-cart__buttons a.button.checkout {
	background: #111;
	color: #fff;
}

.nexio-cart-drawer .woocommerce-mini-cart__empty-message {
	margin: 24px 0;
	text-align: center;
	opacity: 0.7;
}

/* ---------------------------------------------------------------
 * Removal loading state
 *
 * While a remove request is in flight WooCommerce blocks the row with
 * jQuery blockUI, passing only { opacity: 0.6 } and no colour — so
 * blockUI falls back to its OWN default of solid black and drops a
 * heavy dark slab over the item. WooCommerce's spinner styling never
 * rescues it either: that CSS is scoped under `.woocommerce`, and this
 * drawer renders the mini cart outside any such wrapper, so the item
 * just goes black with no sign anything is happening.
 *
 * The overlay is styled inline by blockUI, hence !important. Opacity is
 * forced back to 1 and the translucency moved into the background
 * colour instead — otherwise the spinner below would inherit the
 * faded opacity and be barely visible.
 * ------------------------------------------------------------- */
.nexio-cart-drawer .blockUI.blockOverlay {
	background-color: rgba(255, 255, 255, 0.72) !important;
	opacity: 1 !important;
	cursor: default !important;
}

.nexio-cart-drawer .woocommerce-mini-cart-item .blockUI.blockOverlay::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: rgba(0, 0, 0, 0.55);
	border-radius: 50%;
	animation: nexio-cart-drawer-spin 0.7s linear infinite;
}

@keyframes nexio-cart-drawer-spin {
	to {
		transform: rotate(360deg);
	}
}

/* A spinner that cannot spin should not be a frozen ring pretending
   to load — show a steady dimmed row instead. */
@media (prefers-reduced-motion: reduce) {
	.nexio-cart-drawer .woocommerce-mini-cart-item .blockUI.blockOverlay::before {
		animation: none;
		border-top-color: rgba(0, 0, 0, 0.15);
	}
}
