/*
 * WyCart Builder — Side Cart (off-canvas drawer).
 *
 * @package Wycan\WYCB
 * @since   1.0.0
 */

.wycb-side-cart {
	--wycb-side-cart-width: 420px;
	position: fixed;
	inset: 0;
	z-index: 99999;
	visibility: hidden;
	pointer-events: none;
	/* Delay hiding until the slide-out finishes, so the panel (and any composited
	   child, e.g. a dark button) stays painted through the animation instead of
	   leaving a ghost layer behind. */
	transition: visibility 0s linear 0.3s;
}

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

/* ── Overlay ──────────────────────────────────────────────── */

.wycb-side-cart__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.wycb-side-cart.is-open .wycb-side-cart__overlay {
	opacity: 1;
}

/* ── Panel ────────────────────────────────────────────────── */

.wycb-side-cart__panel {
	position: absolute;
	top: 0;
	height: var(--wycb-side-cart-height, 100%);
	width: min(var(--wycb-side-cart-width), 100vw);
	max-width: 100%;
	background: #fff;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
	transition: transform 0.3s ease;
}

.wycb-side-cart[data-wycb-side="right"] .wycb-side-cart__panel {
	right: 0;
	transform: translateX(100%);
}

.wycb-side-cart[data-wycb-side="left"] .wycb-side-cart__panel {
	left: 0;
	transform: translateX(-100%);
}

.wycb-side-cart.is-open .wycb-side-cart__panel {
	transform: translateX(0);
}

.wycb-side-cart__panel:focus {
	outline: none;
}

/* ── Close button ─────────────────────────────────────────── */

.wycb-side-cart__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	background: transparent;
	color: inherit;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	z-index: 1;
}

.wycb-side-cart[data-wycb-side="left"] .wycb-side-cart__close {
	right: auto;
	left: 12px;
}

.wycb-side-cart__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ── Content ──────────────────────────────────────────────── */

.wycb-side-cart__content {
	flex: 1;
}

.wycb-side-cart__content.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.wycb-side-cart__empty {
	padding: 2em 1.5em;
	text-align: center;
}

/* ── Reduced motion ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.wycb-side-cart,
	.wycb-side-cart__overlay,
	.wycb-side-cart__panel {
		transition: none;
	}
}
