/* WooBricks — Mini Cart Core Styles */

/* =============================================================================
   Cart state visibility helpers
   Add to any element's CSS classes:
     .wbxe-show-cart-empty   → visible only when the cart is empty
     .wbxe-show-cart-filled  → visible only when the cart has items
   Body class (wbxe-cart-is-empty / wbxe-cart-has-items) is set server-side and
   kept live by cart-core.js.

   Scoped with body:not(.wbxe-in-builder) so BOTH states stay visible/editable
   in the Bricks builder canvas (otherwise you couldn't design the "filled"
   content while the cart is empty). The wbxe-in-builder class is added
   server-side via Cart_Fragments::cart_state_body_class().
   ============================================================================= */

body:not(.wbxe-in-builder):not(.wbxe-cart-is-empty) .wbxe-show-cart-empty {
	display: none !important;
}

body:not(.wbxe-in-builder):not(.wbxe-cart-has-items) .wbxe-show-cart-filled {
	display: none !important;
}

/* =============================================================================
   Off-Canvas wrapper
   ============================================================================= */

.wbxe-cart-off-canvas {
	position: relative;
}

/* =============================================================================
   Overlay
   ============================================================================= */

.wbxe-cart-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wbxe-cart-overlay--visible {
	opacity: 1;
	visibility: visible;
}

/* =============================================================================
   Drawer
   ============================================================================= */

.wbxe-cart-drawer {
	--wbxe-drawer-width:  400px;
	--wbxe-drawer-height: 100%;
	--wbxe-transition-dur:  0.35s;
	--wbxe-transition-ease: cubic-bezier(0.4, 0, 0.2, 1);

	position: fixed;
	background: #fff;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	transition: transform var(--wbxe-transition-dur) var(--wbxe-transition-ease);
}

/* Direction variants — left / right */
.wbxe-cart-drawer--left,
.wbxe-cart-drawer--right {
	top: 0;
	bottom: 0;
	width: var(--wbxe-drawer-width);
	max-width: 100vw;
}

.wbxe-cart-drawer--right {
	right: 0;
	transform: translateX(100%);
	box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
}

.wbxe-cart-drawer--left {
	left: 0;
	transform: translateX(-100%);
	box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
}

/* Direction variants — top / bottom */
.wbxe-cart-drawer--top,
.wbxe-cart-drawer--bottom {
	left: 0;
	right: 0;
	width: 100%;
	height: var(--wbxe-drawer-height);
	max-height: 100vh;
	flex-direction: column;
}

.wbxe-cart-drawer--top {
	top: 0;
	transform: translateY(-100%);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.wbxe-cart-drawer--bottom {
	bottom: 0;
	transform: translateY(100%);
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

/* Open state (all directions) */
.wbxe-cart-drawer--open {
	transform: translate(0, 0);
}

/* --- Header --- */

.wbxe-cart-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.wbxe-cart-drawer__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	font-size: 1.1em;
}

.wbxe-cart-drawer__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	background: #333;
	color: #fff;
	border-radius: 11px;
	font-size: 12px;
	font-weight: 700;
}

.wbxe-cart-drawer__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	color: inherit;
	opacity: 0.6;
	transition: opacity 0.2s;
	border-radius: 4px;
}

.wbxe-cart-drawer__close:hover {
	opacity: 1;
}

/* --- Body --- */

.wbxe-cart-drawer__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 20px;
}

/* =============================================================================
   Cart Item Row (Cart Builder wooCart loop item)
   ============================================================================= */

.wbxe-cart-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f0f0f0;
}

.wbxe-cart-item:last-child {
	border-bottom: none;
}

/* =============================================================================
   Empty cart message
   ============================================================================= */

.wbxe-cart-empty {
	text-align: center;
	padding: 32px 16px;
	color: #888;
}

/* =============================================================================
   Body scroll lock when drawer is open
   ============================================================================= */

body.wbxe-cart-open {
	overflow: hidden;
}
