/*
 * Cellpept conversion - basket (plan 1.7, 1.8, 2.7). Static file, the same for every visitor.
 * EUR 100 progress (side cart, cart page), sticky checkout bar on phones (cart page),
 * and a clear bottom of the screen on phones (product, shop, category and cart pages).
 * Colours follow the Woodmart theme variables, with the shop's own values as fallbacks.
 */
:root {
	--cp-bk-accent: var(--wd-primary-color, rgb(12, 93, 216));
	--cp-bk-card: #f3f7fd;
	--cp-bk-line: #d7e3f6;
	--cp-bk-track: #dde6f3;
	--cp-bk-text: #1f2937;
	--cp-bk-muted: #4b5563;
}

/* ---- EUR 100 progress --------------------------------------------------------------------- */
.cp-minbar {
	padding: 12px 14px;
	border: 1px solid var(--cp-bk-line);
	border-radius: 10px;
	background: var(--cp-bk-card);
	color: var(--cp-bk-text);
}

.cp-minbar__text {
	margin: 0 0 8px;
	color: var(--cp-bk-text);
	font-size: 14px;
	line-height: 1.4;
}

.cp-minbar__text strong,
.cp-minbar__text strong .amount {
	color: var(--cp-bk-text);
	font-weight: 700;
}

.cp-minbar__min,
.cp-minbar__min .amount {
	color: var(--cp-bk-muted);
	font-weight: 400;
	white-space: nowrap;
}

.cp-minbar__track {
	height: 8px;
	border-radius: 8px;
	background: var(--cp-bk-track);
	overflow: hidden;
}

.cp-minbar__fill {
	display: block;
	min-width: 6px;
	max-width: 100%;
	height: 100%;
	border-radius: 8px;
	background: var(--cp-bk-accent);
	transition: width .4s ease;
}

/* Side cart: between the subtotal and the buttons. */
.widget_shopping_cart .shopping-cart-widget-footer > .cp-minbar {
	margin: 0 15px 10px;
	padding: 10px 12px;
}

.widget_shopping_cart .cp-minbar__text {
	font-size: 13px;
}

/* "Continue shopping" (side cart, cart totals, sticky bar): the theme's accent button. */
a.button.cp-continue-shopping {
	border-radius: var(--btn-accented-brd-radius, 5px);
	background-color: var(--btn-accented-bgcolor, var(--cp-bk-accent));
	box-shadow: var(--btn-accented-box-shadow, none);
	color: var(--btn-accented-color, #fff);
	font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600));
	text-transform: var(--btn-accented-transform, var(--btn-transform, uppercase));
}

a.button.cp-continue-shopping:hover,
a.button.cp-continue-shopping:focus-visible {
	background-color: var(--btn-accented-bgcolor-hover, #000);
	box-shadow: var(--btn-accented-box-shadow-hover, none);
	color: var(--btn-accented-color-hover, #fff);
}

.wc-proceed-to-checkout a.cp-continue-shopping--totals {
	align-self: var(--wd-btn-align, stretch);
	min-height: 48px;
}

/* ---- Cart page: progress at the top, joined with the minimum-order notice ----------------- */
.cp-basket-src {
	display: none !important;
}

.cp-minslot > .cp-minbar {
	margin-bottom: 20px;
}

/* The slot sits in Woodmart's "woocommerce_before_cart" hook widget, which Elementor leaves out when it prints
   nothing. Over the minimum the slot is empty: take the widget out of the layout again (no extra flex gap) while
   the empty slot is all it holds. Browsers without :has() simply keep the small gap. */
.elementor-widget-wd_wc_hook:has(> .elementor-widget-container > .cp-minslot:only-child:empty),
.elementor-widget-wd_wc_hook:has(> .cp-minslot:only-child:empty) {
	display: none;
}

.cp-minslot.is-joined > .cp-minbar {
	margin-bottom: 0;
	padding-bottom: 6px;
	border-bottom: 0;
	border-radius: 10px 10px 0 0;
}

.woocommerce-cart ul.woocommerce-error.cp-min-notice {
	margin-top: 0;
	padding: 4px 14px 12px !important;
	border: 1px solid var(--cp-bk-line);
	border-top: 0;
	border-radius: 0 0 10px 10px;
	background: var(--cp-bk-card);
	color: var(--cp-bk-muted);
	font-size: 13px;
	line-height: 1.45;
}

.woocommerce-cart ul.woocommerce-error.cp-min-notice::before {
	content: none;
}

.woocommerce-cart ul.woocommerce-error.cp-min-notice .amount {
	color: inherit;
}

/* ---- Cart page: sticky bar on phones ------------------------------------------------------ */
.cp-cartbar {
	display: none;
}

@media (max-width: 768.98px) {
	body.woocommerce-cart .cp-cartbar:not([data-cp-state="empty"]) {
		position: fixed;
		right: 0;
		bottom: var(--cp-toolbar-h, 0px);
		left: 0;
		z-index: 340;
		display: block;
		padding: 8px 12px;
		background: var(--bgcolor-white, #fff);
		box-shadow: 0 -2px 12px rgba(0, 0, 0, .12);
	}

	body.woocommerce-cart.sticky-toolbar-on .cp-cartbar:not([data-cp-state="empty"]) {
		bottom: var(--cp-toolbar-h, 55px);
	}

	body.woocommerce-cart.cp-cartbar-on {
		padding-bottom: calc(var(--cp-toolbar-h, 0px) + var(--cp-cartbar-h, 64px));
	}

	body.woocommerce-cart.sticky-toolbar-on.cp-cartbar-on {
		padding-bottom: calc(var(--cp-toolbar-h, 55px) + var(--cp-cartbar-h, 64px));
	}

	.cp-cartbar__inner {
		display: flex;
		align-items: center;
		gap: 10px;
	}

	.cp-cartbar a.cp-cartbar__checkout {
		flex: 1 1 auto;
		gap: 8px;
		width: 100%;
		min-height: 46px;
		border-radius: var(--btn-accented-brd-radius, 5px);
		background-color: var(--btn-accented-bgcolor, var(--cp-bk-accent));
		box-shadow: var(--btn-accented-box-shadow, none);
		color: var(--btn-accented-color, #fff);
		font-size: 15px;
		font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600));
		text-transform: none;
	}

	.cp-cartbar a.cp-cartbar__checkout:hover,
	.cp-cartbar a.cp-cartbar__checkout:focus-visible {
		background-color: var(--btn-accented-bgcolor-hover, #000);
		color: var(--btn-accented-color-hover, #fff);
	}

	.cp-cartbar a.cp-cartbar__checkout .amount,
	.cp-cartbar a.cp-cartbar__checkout bdi {
		color: inherit;
	}

	.cp-cartbar .cp-minbar {
		flex: 1 1 auto;
		min-width: 0;
		padding: 0;
		border: 0;
		background: none;
	}

	.cp-cartbar .cp-minbar__text {
		margin-bottom: 6px;
		font-size: 13px;
		line-height: 1.3;
	}

	.cp-cartbar .cp-minbar__track {
		height: 6px;
	}

	.cp-cartbar a.cp-continue-shopping {
		flex: 0 0 auto;
		min-height: 42px;
		padding: 0 12px;
		font-size: 12px;
	}

	/* ---- Clear bottom of the screen: no Telegram or scroll-to-top button over the sticky
	        add-to-cart (product pages) or checkout bar (cart page). Help stays in the chat panel. ---- */
	body.single-product #cellpept-telegram-btn,
	body.single-product .scrollToTop,
	body.post-type-archive-product #cellpept-telegram-btn,
	body.post-type-archive-product .scrollToTop,
	body.tax-product_cat #cellpept-telegram-btn,
	body.tax-product_cat .scrollToTop,
	body.woocommerce-cart #cellpept-telegram-btn,
	body.woocommerce-cart .scrollToTop {
		display: none !important;
	}
}
