/* EMS cart drawer: a compact, focused WooCommerce side cart. */
:root {
	--ems-cart-accent: var(--ems-accent, #F6A51C);
	--ems-cart-accent-hover: var(--ems-ui-orange-hover, #D88A08);
	--ems-cart-ink: #17191c;
	--ems-cart-muted: #66707a;
	--ems-cart-border: #e3e6e9;
	--ems-cart-surface: #f7f8f9;
}

body.ems-cart-drawer-open {
	overflow: hidden;
	padding-right: var(--ems-scrollbar-compensation, 0px);
}

/* The backdrop is deliberately separate so clicks close the drawer without
 * affecting the native WooCommerce fragment markup. */
.ems-cart-drawer-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1100;
	background: rgb(0 0 0 / 62%);
	cursor: pointer;
}

.ems-cart-drawer-backdrop[hidden],
.ems-cart-drawer[hidden] {
	display: none !important;
}

.ems-cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 1101;
	display: flex;
	width: min(100vw, 440px);
	height: 100dvh;
	min-width: 0;
	flex-direction: column;
	background: #fff;
	color: var(--ems-cart-ink);
	box-shadow: -18px 0 42px rgb(0 0 0 / 24%);
	overscroll-behavior: contain;
	contain: layout paint;
}

.ems-cart-drawer__header {
	display: flex;
	min-height: 62px;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 20px;
	border-bottom: 1px solid var(--ems-cart-border);
	background: #fff;
}

.ems-cart-drawer__header h2 {
	margin: 0;
	color: var(--ems-cart-ink);
	font-size: 1.05rem;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0;
}

.ems-cart-drawer__close {
	display: inline-grid;
	width: 36px;
	height: 36px;
	flex: 0 0 36px;
	place-items: center;
	padding: 7px;
	border: 1px solid transparent;
	border-radius: 2px;
	background: transparent;
	color: var(--ems-cart-ink);
	cursor: pointer;
}

.ems-cart-drawer__close:hover,
.ems-cart-drawer__close:focus-visible {
	border-color: var(--ems-cart-accent);
	background: color-mix(in srgb, var(--ems-cart-accent) 12%, white);
	color: var(--ems-cart-ink);
}

.ems-cart-drawer__close .ems-shell-icon {
	width: 20px;
	height: 20px;
}

.ems-cart-drawer .widget_shopping_cart_content {
	display: flex;
	min-height: 0;
	flex: 1 1 auto;
	flex-direction: column;
}

.ems-cart-drawer .shopping-cart-widget-body {
	min-height: 0;
	flex: 1 1 auto;
	padding: 0 20px;
	overflow: auto;
	overscroll-behavior: contain;
}

.ems-cart-drawer .shopping-cart-widget-body > .wd-scroll-content {
	padding: 0 !important;
}

.ems-cart-drawer .shopping-cart-widget-footer {
	padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--ems-cart-border);
	background: #fff;
}

/* Filled-cart rows: the native WoodMart/WooCommerce links remain the
 * accessible and AJAX-aware source of truth. */
.ems-cart-drawer .woocommerce-mini-cart {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ems-cart-drawer .woocommerce-mini-cart-item {
	position: relative;
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	column-gap: 12px;
	min-width: 0;
	margin: 0;
	padding: 16px 28px 16px 0;
	border-bottom: 1px solid var(--ems-cart-border);
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-product {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: 72px minmax(0, 1fr);
	column-gap: 12px;
	min-width: 0;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-product-image {
	display: block;
	width: 72px;
	height: 72px;
	min-width: 0;
	border: 1px solid var(--ems-cart-border);
	border-radius: 2px;
	background: var(--ems-cart-surface);
	object-fit: contain;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-product-image img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: contain;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-content {
	min-width: 0;
}

.ems-cart-drawer .woocommerce-mini-cart-item > a:not(.remove) {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: 72px minmax(0, 1fr);
	column-gap: 12px;
	align-items: start;
	min-width: 0;
	color: var(--ems-cart-ink);
	font-size: .87rem;
	font-weight: 700;
	line-height: 1.35;
	text-decoration: none;
}

.ems-cart-drawer .woocommerce-mini-cart-item > .cart-info > a:not(.remove) {
	display: block;
	min-width: 0;
	color: var(--ems-cart-ink);
	font-size: .87rem;
	font-weight: 700;
	line-height: 1.35;
	text-decoration: none;
}

.ems-cart-drawer .woocommerce-mini-cart-item > a:not(.remove) img,
.ems-cart-drawer .woocommerce-mini-cart-item > .cart-info img,
.ems-cart-drawer .woocommerce-mini-cart-item .thumbnail img {
	display: block;
	width: 72px;
	height: 72px;
	margin: 0;
	border: 1px solid var(--ems-cart-border);
	border-radius: 2px;
	background: var(--ems-cart-surface);
	object-fit: contain;
}

.ems-cart-drawer .woocommerce-mini-cart-item .cart-info,
.ems-cart-drawer .woocommerce-mini-cart-item > .cart-info {
	min-width: 0;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-entities-title,
.ems-cart-drawer .woocommerce-mini-cart-item .wd-entities-title a {
	margin: 0;
	color: var(--ems-cart-ink);
	font-size: .87rem;
	font-weight: 700;
	line-height: 1.35;
}

.ems-cart-drawer .woocommerce-mini-cart-item .remove_from_cart_button {
	position: absolute;
	top: 14px;
	right: 0;
	display: inline-grid;
	width: 24px;
	height: 24px;
	place-items: center;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ems-cart-accent) !important;
	font-size: 1.2rem;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
}

/* WoodMart can render a glyph as well as the native ×. Keep only the real
 * remove link text so there is exactly one control per cart item. */
.ems-cart-drawer .woocommerce-mini-cart-item .remove_from_cart_button::before,
.ems-cart-drawer .woocommerce-mini-cart-item .remove_from_cart_button::after {
	display: none !important;
	content: none !important;
}

.ems-cart-drawer .woocommerce-mini-cart-item .remove_from_cart_button:hover,
.ems-cart-drawer .woocommerce-mini-cart-item .remove_from_cart_button:focus-visible {
	background: var(--ems-cart-accent);
	color: var(--ems-cart-ink) !important;
}

.ems-cart-drawer .woocommerce-mini-cart-item .quantity {
	display: none !important;
}

.ems-cart-drawer .ems-mini-cart-line-quantity {
	display: flex;
	grid-column: 1 / -1;
	min-width: 0;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 9px;
}

.ems-cart-drawer .ems-mini-cart-price {
	min-width: 0;
	color: var(--ems-cart-ink);
	font-size: .88rem;
	font-weight: 800;
	line-height: 1.2;
}

.ems-cart-drawer .ems-mini-cart-price .amount,
.ems-cart-drawer .ems-mini-cart-price .woocommerce-Price-amount {
	color: var(--ems-accent, #F6A51C);
	font-weight: 800;
}

.ems-cart-drawer .ems-mini-cart-price del,
.ems-cart-drawer .ems-mini-cart-price del .amount,
.ems-cart-drawer .ems-mini-cart-price del .woocommerce-Price-amount {
	color: #707780;
	font-size: .78rem;
	font-weight: 600;
}

.ems-cart-drawer .ems-mini-cart-quantity {
	display: grid;
	grid-template-columns: 25px 28px 25px;
	width: 78px;
	min-height: 28px;
	flex: 0 0 78px;
	border: 1px solid var(--ems-cart-border);
	border-radius: 2px;
	background: #fff;
	overflow: hidden;
}

.ems-cart-drawer .ems-mini-quantity-button {
	display: grid;
	width: 25px;
	height: 27px;
	place-items: center;
	padding: 0;
	border: 0;
	background: var(--ems-cart-surface);
	color: var(--ems-cart-ink);
	font-size: .92rem;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
}

.ems-cart-drawer .ems-mini-quantity-button:hover:not(:disabled),
.ems-cart-drawer .ems-mini-quantity-button:focus-visible {
	background: var(--ems-cart-accent);
}

.ems-cart-drawer .ems-mini-quantity-button:disabled {
	cursor: not-allowed;
	opacity: .45;
}

.ems-cart-drawer .ems-mini-cart-quantity output {
	display: grid;
	place-items: center;
	color: var(--ems-cart-ink);
	font-size: .78rem;
	font-weight: 800;
}

.ems-cart-drawer .ems-mini-cart-quantity[aria-busy="true"] {
	opacity: .55;
}

.ems-cart-drawer .woocommerce-mini-cart__total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	color: var(--ems-cart-ink);
	font-size: .95rem;
	font-weight: 700;
}

.ems-cart-drawer .woocommerce-mini-cart__total strong {
	font-weight: 700;
}

.ems-cart-drawer .woocommerce-mini-cart__total .amount,
.ems-cart-drawer .woocommerce-mini-cart__total .woocommerce-Price-amount {
	color: var(--ems-cart-accent);
	font-size: 1.05rem;
	font-weight: 800;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 10px;
	margin: 14px 0 0;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .button {
	display: inline-flex;
	min-height: 44px;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--ems-cart-ink);
	border-radius: 2px;
	font-size: .79rem;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: .02em;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .button:not(.checkout) {
	border-color: var(--ems-cart-ink) !important;
	background: #fff !important;
	color: var(--ems-cart-ink) !important;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .button:not(.checkout):hover,
.ems-cart-drawer .woocommerce-mini-cart__buttons .button:not(.checkout):focus-visible {
	border-color: var(--ems-cart-accent) !important;
	background: #fff !important;
	color: var(--ems-cart-accent-hover) !important;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout {
	order: -1;
	border-color: var(--ems-cart-accent) !important;
	background: var(--ems-cart-accent) !important;
	color: var(--ems-cart-ink) !important;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout:hover,
.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout:focus-visible {
	border-color: var(--ems-cart-accent-hover) !important;
	background: var(--ems-cart-accent-hover) !important;
	color: var(--ems-cart-ink) !important;
}

/* JS replaces the theme's oversized empty-cart artwork with this compact
 * state after every WooCommerce fragment refresh. */
.ems-cart-drawer .ems-cart-empty {
	display: flex;
	min-height: min(46vh, 340px);
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 14px;
	padding: 28px 12px;
	text-align: center;
}

.ems-cart-drawer .ems-cart-empty__icon {
	display: grid;
	width: 60px;
	height: 60px;
	place-items: center;
	border: 1px solid #cfd4da;
	border-radius: 50%;
	color: var(--ems-cart-ink);
}

.ems-cart-drawer .ems-cart-empty__icon svg {
	width: 30px;
	height: 30px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ems-cart-drawer .ems-cart-empty__message {
	margin: 0;
	color: var(--ems-cart-ink);
	font-size: .95rem;
	font-weight: 700;
}

.ems-cart-drawer .ems-cart-empty__button {
	display: inline-flex;
	min-height: 44px;
	align-items: center;
	justify-content: center;
	padding: 10px 18px;
	border: 1px solid var(--ems-cart-accent);
	border-radius: 2px;
	background: var(--ems-cart-accent);
	color: var(--ems-cart-ink);
	font-size: .79rem;
	font-weight: 800;
	letter-spacing: .02em;
	text-transform: uppercase;
	text-decoration: none;
}

.ems-cart-drawer .ems-cart-empty__button:hover,
.ems-cart-drawer .ems-cart-empty__button:focus-visible {
	border-color: var(--ems-cart-accent-hover);
	background: var(--ems-cart-accent-hover);
	color: var(--ems-cart-ink);
}

.ems-cart-drawer .ems-mini-cart-error {
	margin: 12px 0 0;
	padding: 9px 10px;
	border-left: 3px solid var(--ems-cart-accent);
	background: #fff8eb;
	color: var(--ems-cart-ink);
	font-size: .82rem;
}

/* The floating Ask AI/chat control must never cover the drawer. */
body.ems-cart-drawer-open .ems-cart-chat-hidden,
body.ems-cart-drawer-open .float-btn__wrapper.chatbot-overwrite,
body.ems-cart-drawer-open [id*="ask-ai"],
body.ems-cart-drawer-open [class*="ask-ai"] {
	display: none !important;
}

.ems-cart-drawer :where(a, button):focus-visible {
	outline: 3px solid var(--ems-cart-accent);
	outline-offset: 3px;
}

@media (max-width: 480px) {
	.ems-cart-drawer {
		width: 100vw;
	}

	.ems-cart-drawer__header {
		min-height: 58px;
		padding-inline: 14px;
	}

	.ems-cart-drawer .shopping-cart-widget-body {
		padding-inline: 14px;
	}

	.ems-cart-drawer .shopping-cart-widget-footer {
		padding-inline: 14px;
	}

	.ems-cart-drawer .woocommerce-mini-cart__buttons {
		grid-template-columns: 1fr;
	}

	.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout {
		order: 0;
	}
}

/* Final side-cart geometry: fixed header/list/footer areas and a full-width
 * information column between the 90px image and the single remove control. */
.ems-cart-drawer .widget_shopping_cart_content {
	min-width: 0;
	min-height: 0;
	height: 100%;
}

.ems-cart-drawer .shopping-cart-widget-body {
	min-width: 0;
	min-height: 0;
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
}

.ems-cart-drawer .shopping-cart-widget-footer {
	position: relative;
	z-index: 2;
	flex: 0 0 auto;
}

.ems-cart-drawer .woocommerce-mini-cart-item {
	display: grid;
	grid-template-columns: 90px minmax(0, 1fr) 28px;
	column-gap: 12px;
	align-items: start;
	min-width: 0;
	padding: 16px 0;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-product {
	display: contents;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-product-image,
.ems-cart-drawer .woocommerce-mini-cart-item .wd-product-image img,
.ems-cart-drawer .woocommerce-mini-cart-item > a:not(.remove_from_cart_button) img,
.ems-cart-drawer .woocommerce-mini-cart-item > .cart-info img,
.ems-cart-drawer .woocommerce-mini-cart-item .thumbnail img {
	width: 90px;
	height: 90px;
	min-width: 0;
	border: 0;
	border-radius: 0;
	background: #fff;
	object-fit: contain;
}

.ems-cart-drawer .woocommerce-mini-cart-item > a:not(.remove_from_cart_button) {
	display: grid;
	grid-column: 1 / 3;
	grid-template-columns: 90px minmax(0, 1fr);
	column-gap: 12px;
	min-width: 0;
	max-width: 100%;
	align-items: start;
	position: relative;
	z-index: 1;
	overflow: hidden;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-product > a:not(.remove_from_cart_button),
.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-product > .thumbnail {
	grid-column: 1;
	grid-row: 1;
	display: block;
	width: 90px;
	height: 90px;
	min-width: 0;
	max-width: 90px;
	overflow: hidden;
}

.ems-cart-drawer .woocommerce-mini-cart-item .cart-info,
.ems-cart-drawer .woocommerce-mini-cart-item > .cart-info,
.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-content {
	grid-column: 2;
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
}

.ems-cart-drawer .woocommerce-mini-cart-item .wd-entities-title,
.ems-cart-drawer .woocommerce-mini-cart-item .wd-entities-title a,
.ems-cart-drawer .woocommerce-mini-cart-item .cart-info > a:not(.remove_from_cart_button),
.ems-cart-drawer .woocommerce-mini-cart-item .wd-mini-cart-content > a:not(.remove_from_cart_button) {
	display: -webkit-box;
	min-width: 0;
	max-width: 100%;
	margin: 0;
	overflow: hidden;
	color: var(--ems-cart-ink);
	font-size: .9rem;
	font-weight: 750;
	line-height: 1.35;
	text-overflow: ellipsis;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	word-break: normal;
	overflow-wrap: normal;
	white-space: normal;
}

.ems-cart-drawer .woocommerce-mini-cart-item .ems-mini-cart-line-quantity {
	grid-column: 2;
	min-width: 0;
	max-width: 100%;
	margin-top: 9px;
	position: relative;
	z-index: 4;
	pointer-events: auto;
}

.ems-cart-drawer .woocommerce-mini-cart-item .remove_from_cart_button {
	position: static;
	grid-column: 3;
	grid-row: 1;
	z-index: 5;
	display: inline-grid;
	width: 28px;
	height: 28px;
	align-self: start;
	justify-self: end;
	place-items: center;
	pointer-events: auto;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin-top: 14px;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .button,
.ems-cart-drawer .woocommerce-mini-cart__buttons .button:not(.checkout),
.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout {
	width: 100%;
	min-height: 48px;
	box-sizing: border-box;
	border: 1px solid var(--ems-cart-accent) !important;
	border-radius: 3px;
	background: var(--ems-cart-accent) !important;
	color: #fff !important;
	font-size: .82rem;
	font-weight: 800;
	letter-spacing: .02em;
	text-align: center;
	text-transform: uppercase;
	order: 0;
}

.ems-cart-drawer .woocommerce-mini-cart__buttons .button:hover,
.ems-cart-drawer .woocommerce-mini-cart__buttons .button:focus-visible,
.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout:hover,
.ems-cart-drawer .woocommerce-mini-cart__buttons .checkout:focus-visible {
	border-color: var(--ems-cart-accent-hover) !important;
	background: var(--ems-cart-accent-hover) !important;
	color: #fff !important;
}

.ems-cart-drawer .ems-cart-empty {
	min-height: 0;
	height: 100%;
	box-sizing: border-box;
	justify-content: center;
}

@media (max-width: 480px) {
	.ems-cart-drawer .woocommerce-mini-cart-item {
		grid-template-columns: 90px minmax(0, 1fr) 28px;
		column-gap: 10px;
	}

	.ems-cart-drawer .woocommerce-mini-cart-item > a:not(.remove_from_cart_button) {
		grid-template-columns: 90px minmax(0, 1fr);
		column-gap: 10px;
	}
}
