/*
 * Cart Drawer
 *
 * Slide-in cart panel driven by the custom storefront-child
 * woocommerce/cart/mini-cart.php template. Header/buttons reuse the
 * account/login drawer classes (bm-drawer-header, bm-btn-*) from
 * buymingo.css. Toggled by body.cart-drawer-open (buymingo.js).
 */

.cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	height: 100vh;
	height: 100dvh;
	width: min(400px, 100%);
	background-color: #ffffff;
	z-index: 10000;
	box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	visibility: visible;
}

body.cart-drawer-open .cart-drawer {
	transform: translateX(0);
}

/* ---- Body ---- */
.bm-cart-drawer-body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden !important;
	padding-bottom: 20px !important;
}

/* The drawer content is server-rendered inside .widget_shopping_cart_content
   (fragments still target it for AJAX refresh). Make the chain full-height so
   summary / total / actions pin to the drawer edges while the list scrolls. */
.bm-cart-drawer-body > .widget_shopping_cart_content {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	margin: 0;
}

.bm-cart-list-wrap {
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
	flex: 1 1 auto;
}

/* ---- Summary ---- */
.bm-cart-summary {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding-bottom: 12px;
	border-bottom: 1px solid #f2f2f2;
	font-size: 11px;
	letter-spacing: 1px;
	color: #333;
	font-weight: 600;
	text-transform: uppercase;
	flex: 0 0 auto;
}

.bm-cart-summary-title em {
	font-style: normal;
	color: #999;
}

.bm-cart-summary-total {
	color: var(--bm-olive);
	font-size: 13px;
}

/* ---- Line items ---- */
.bm-cart-drawer-body ul.woocommerce-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	max-height: none;
	flex: 1 1 auto;
	min-height: 0;
}

.bm-cart-drawer-body .woocommerce-mini-cart-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 0;
	border-bottom: 1px solid #f2f2f2;
}

.bm-cart-drawer-body .woocommerce-mini-cart-item a.remove {
	float: none;
	order: 2;
	margin: 2px 0 0 auto;
	color: #999;
	font-size: 18px;
	line-height: 1;
	font-weight: 400;
	text-decoration: none;
	transition: color 0.2s ease;
}

.bm-cart-drawer-body .woocommerce-mini-cart-item a.remove:hover {
	color: var(--bm-accent-terracotta);
	background: none;
}

.bm-mini-cart-item-main {
	flex: 1 1 auto;
	min-width: 0;
}

.bm-mini-cart-item-main > a {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	text-decoration: none;
	color: inherit;
}

.bm-mini-cart-item-img {
	width: 72px;
	height: auto;
	float: none !important;
	margin: 0 !important;
	border-radius: 4px;
}

.bm-mini-cart-item-name {
	font-size: 13px;
	font-weight: 500;
	color: #333;
	line-height: 1.4;
	display: block;
	flex: 1 1 auto;
	min-width: 0;
}

.bm-mini-cart-item-meta {
	margin: 4px 0 0;
	font-size: 12px;
	color: #666;
}

.bm-mini-cart-item-meta .quantity {
	display: block;
	margin-top: 2px;
	color: var(--bm-olive);
	font-weight: 600;
}

.bm-mini-cart-item-meta .variation {
	margin: 0 0 4px !important;
	padding: 0 !important;
	list-style: none;
}

.bm-mini-cart-item-meta .variation dt {
	display: inline;
	font-weight: 600;
}

.bm-mini-cart-item-meta .variation dd {
	display: inline;
	margin: 0 8px 0 0;
}

/* ---- Total ---- */
.bm-cart-total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 14px 0;
	border-top: 1px solid #f2f2f2;
	flex: 0 0 auto;
}

.bm-cart-total-label {
	font-size: 11px;
	letter-spacing: 1px;
	font-weight: 600;
	color: #333;
}

.bm-cart-total-amount {
	font-size: 15px;
	font-weight: 700;
	color: var(--bm-olive);
}

/* ---- Actions ---- */
.bm-cart-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: auto;
	padding-top: 4px;
	flex: 0 0 auto;
}

.bm-cart-actions .bm-btn-primary,
.bm-cart-actions .bm-btn-secondary {
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
	display: block;
	margin: 0;
}

/* ---- Empty state ---- */
.bm-cart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 50vh;
	text-align: center;
	padding: 20px 0;
}

.bm-cart-empty-icon {
	font-size: 34px;
	color: #ccc;
}

.bm-cart-empty .woocommerce-mini-cart__empty-message {
	margin: 0 0 6px;
	font-size: 14px;
	color: #666;
}

.bm-cart-empty .bm-btn-primary {
	width: auto;
	min-width: 200px;
	text-decoration: none;
}

/* ---- Overlay ---- */
.cart-drawer__overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	background-color: rgba(0, 0, 0, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	z-index: 9999;
}

body.cart-drawer-open .cart-drawer__overlay,
.cart-drawer__overlay.active {
	opacity: 1;
	visibility: visible;
}

body.cart-drawer-open {
	overflow: hidden;
}