/* ==========================================================================
   Healthcare DME — Side cart drawer
   --------------------------------------------------------------------------
   Replaces the side-cart-woocommerce (xoo-wsc) plugin.

   Avada's own WooCommerce options do not include a slide-out cart — they give a
   hover dropdown in the nav (woocommerce_cart_link_main_nav /
   woocommerce_cart_counter) and nothing more. Avada's Off Canvas feature could
   host one, but no off-canvas object exists on this site. So the drawer is
   built here, owned by the theme, with no plugin behind it.
   ========================================================================== */

.hdme-drawer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	visibility: hidden;
	pointer-events: none;
}
.hdme-drawer.is-open {
	visibility: visible;
	pointer-events: auto;
}

.hdme-drawer__scrim {
	position: absolute;
	inset: 0;
	background: rgba(20, 26, 31, 0.5);
	opacity: 0;
	transition: opacity 240ms ease;
}
.hdme-drawer.is-open .hdme-drawer__scrim { opacity: 1; }

.hdme-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 100%);
	display: flex;
	flex-direction: column;
	background: var(--hdme-surface);
	box-shadow: var(--hdme-shadow-lg);
	transform: translateX(100%);
	transition: transform 280ms cubic-bezier(0.2, 0, 0.2, 1);
}
.hdme-drawer.is-open .hdme-drawer__panel { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
	.hdme-drawer__panel,
	.hdme-drawer__scrim { transition: none; }
}

/* ---- Header ------------------------------------------------------------- */

.hdme-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--hdme-space-3);
	padding: var(--hdme-space-4) var(--hdme-space-5);
	border-bottom: 1px solid var(--hdme-border);
	flex: 0 0 auto;
}
.hdme-drawer__title {
	margin: 0;
	font-size: var(--hdme-text-lg);
	font-weight: var(--hdme-weight-bold);
	color: var(--hdme-grey-900);
}
.hdme-drawer__count {
	margin-left: var(--hdme-space-2);
	padding: 1px var(--hdme-space-2);
	border-radius: var(--hdme-radius-pill);
	background: var(--hdme-blue-50);
	color: var(--hdme-blue-700);
	font-size: var(--hdme-text-xs);
	font-weight: var(--hdme-weight-semi);
}
.hdme-drawer__close {
	width: var(--hdme-tap-min);
	height: var(--hdme-tap-min);
	display: grid;
	place-items: center;
	border: 1px solid var(--hdme-border);
	border-radius: 50%;
	background: var(--hdme-surface);
	color: var(--hdme-grey-600);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	flex: 0 0 auto;
}
.hdme-drawer__close:hover { background: var(--hdme-grey-50); color: var(--hdme-grey-900); }

/* ---- Body --------------------------------------------------------------- */

.hdme-drawer__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: var(--hdme-space-4) var(--hdme-space-5);
	-webkit-overflow-scrolling: touch;
}

.hdme-cartline {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	gap: var(--hdme-space-3);
	padding: var(--hdme-space-4) 0;
	border-bottom: 1px solid var(--hdme-border);
	align-items: start;
}
.hdme-cartline__thumb img {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border: 1px solid var(--hdme-border);
	border-radius: var(--hdme-radius);
	background: var(--hdme-grey-25);
	mix-blend-mode: multiply;
}
.hdme-cartline__name {
	font-size: var(--hdme-text-sm);
	font-weight: var(--hdme-weight-medium);
	line-height: var(--hdme-leading-snug);
	color: var(--hdme-grey-800);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.hdme-cartline__name:hover { color: var(--hdme-blue-700); }
.hdme-cartline__meta {
	margin-top: var(--hdme-space-1);
	font-size: var(--hdme-text-xs);
	color: var(--hdme-text-muted);
}
.hdme-cartline__price {
	font-weight: var(--hdme-weight-bold);
	color: var(--hdme-grey-900);
	font-size: 1.05rem !important;
	line-height: 1.25;
	white-space: nowrap;
}
.hdme-cartline__price .amount { font-size: inherit !important; }

/* Quantity stepper */
.hdme-qty {
	display: inline-flex;
	align-items: center;
	width: auto !important;
	max-width: 102px;
	margin-top: var(--hdme-space-2);
	border: 1px solid var(--hdme-border-strong);
	border-radius: var(--hdme-radius);
	overflow: hidden;
}
.hdme-qty__btn {
	flex: 0 0 30px;
	width: 30px !important;
	min-width: 30px !important;
	height: 32px !important;
	min-height: 32px !important;
	padding: 0 !important;
	margin: 0 !important;
	display: grid;
	place-items: center;
	border: 0;
	background: var(--hdme-grey-25);
	color: var(--hdme-grey-700);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	position: relative;
}
.hdme-qty__btn::after {
	content: "";
	position: absolute;
	top: 50%; left: 50%;
	width: var(--hdme-tap-min); height: var(--hdme-tap-min);
	transform: translate(-50%, -50%);
}
.hdme-qty__btn:hover { background: var(--hdme-blue-50); color: var(--hdme-blue-700); }
.hdme-qty__btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.hdme-drawer .hdme-qty__input[type="number"] {
	flex: 0 0 40px !important;
	width: 40px !important;
	min-width: 40px !important;
	max-width: 40px !important;
	height: 32px !important;
	min-height: 32px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0;
	border-inline: 1px solid var(--hdme-border-strong);
	text-align: center;
	font-size: max(16px, var(--hdme-text-sm));
	background: var(--hdme-surface);
	-moz-appearance: textfield;
}
.hdme-qty__input::-webkit-outer-spin-button,
.hdme-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.hdme-cartline__remove {
	display: inline-flex;
	align-items: center;
	margin-top: var(--hdme-space-2);
	margin-left: var(--hdme-space-3);
	background: none;
	border: 0;
	padding: 0;
	font-size: var(--hdme-text-xs);
	color: var(--hdme-text-muted);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	min-height: 36px;
}
.hdme-cartline__remove:hover { color: var(--hdme-danger); }

/* ---- Empty state -------------------------------------------------------- */

.hdme-drawer__empty {
	text-align: center;
	padding: var(--hdme-space-9) var(--hdme-space-4);
	color: var(--hdme-grey-600);
}
.hdme-drawer__empty p { margin: 0 0 var(--hdme-space-5); font-size: var(--hdme-text-base); }

/* ---- Footer ------------------------------------------------------------- */

.hdme-drawer__foot {
	flex: 0 0 auto;
	padding: var(--hdme-space-4) var(--hdme-space-5) var(--hdme-space-5);
	border-top: 1px solid var(--hdme-border);
	background: var(--hdme-grey-25);
}
.hdme-drawer__subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: var(--hdme-space-2);
	font-size: 1.05rem;
	font-weight: var(--hdme-weight-bold);
	color: var(--hdme-grey-900);
}
.hdme-drawer__subtotal .amount { font-size: inherit !important; }
.hdme-drawer__note {
	margin: 0 0 var(--hdme-space-4);
	font-size: var(--hdme-text-xs);
	color: var(--hdme-text-muted);
}
.hdme-drawer__actions { display: flex; flex-direction: column; gap: var(--hdme-space-2); }
.hdme-drawer__actions .hdme-btn { justify-content: center; }

/* ---- Busy state --------------------------------------------------------- */

.hdme-drawer__body.is-busy { opacity: 0.55; pointer-events: none; }

/* ==========================================================================
   Add-to-cart button loading state
   ========================================================================== */

.hdme-btn.is-loading,
.single_add_to_cart_button.is-loading,
.hdme-pcard__add.is-loading {
	position: relative;
	color: transparent !important;
	pointer-events: none;
}
.hdme-btn.is-loading::after,
.single_add_to_cart_button.is-loading::after,
.hdme-pcard__add.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	color: #fff;
	animation: hdme-spin 640ms linear infinite;
}
.hdme-btn--secondary.is-loading::after,
.hdme-btn--ghost.is-loading::after { color: var(--hdme-blue-600); }

@keyframes hdme-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.hdme-btn.is-loading::after,
	.single_add_to_cart_button.is-loading::after { animation-duration: 2s; }
}

/* The plugin's own drawer, in case it is still active during rollout. */
.xoo-wsc-modal,
.xoo-wsc-basket { display: none !important; }


/* ==========================================================================
   Loaders
   --------------------------------------------------------------------------
   A skeleton while the drawer fetches, rather than an empty panel. The panel
   opens the instant the button is clicked, so something has to occupy it.
   ========================================================================== */

.hdme-skeleton { padding: var(--hdme-space-2) 0; }
.hdme-skeleton__line {
	height: 64px;
	margin-bottom: var(--hdme-space-4);
	border-radius: var(--hdme-radius);
	background: linear-gradient(90deg, var(--hdme-grey-50) 25%, var(--hdme-grey-100) 37%, var(--hdme-grey-50) 63%);
	background-size: 400% 100%;
	animation: hdme-shimmer 1.3s ease-in-out infinite;
}
.hdme-skeleton__line:nth-child(2) { opacity: 0.75; }
.hdme-skeleton__line:nth-child(3) { opacity: 0.5; }

@keyframes hdme-shimmer {
	0%   { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
	.hdme-skeleton__line { animation: none; background: var(--hdme-grey-50); }
}

/* Busy state on the drawer body while a quantity change is in flight. */
.hdme-drawer__body.is-busy { position: relative; }
.hdme-drawer__body.is-busy::after {
	content: "";
	position: absolute;
	top: 50%; left: 50%;
	width: 28px; height: 28px;
	margin: -14px 0 0 -14px;
	border: 3px solid var(--hdme-blue-200);
	border-top-color: var(--hdme-blue-600);
	border-radius: 50%;
	animation: hdme-spin 640ms linear infinite;
}

/* Quick-view dialog while it loads. */
.hdme-quickview__loading::before {
	content: "";
	display: block;
	width: 28px; height: 28px;
	margin: 0 auto var(--hdme-space-3);
	border: 3px solid var(--hdme-blue-200);
	border-top-color: var(--hdme-blue-600);
	border-radius: 50%;
	animation: hdme-spin 640ms linear infinite;
}

/* WooCommerce prints .loading on buttons mid-AJAX; give it the same treatment. */
.hdme-scope .button.loading,
.hdme-scope a.loading,
.hdme-scope button.loading {
	position: relative;
	color: transparent !important;
	pointer-events: none;
}
.hdme-scope .button.loading::after,
.hdme-scope a.loading::after,
.hdme-scope button.loading::after {
	content: "";
	position: absolute;
	top: 50%; left: 50%;
	width: 18px; height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	color: #fff;
	animation: hdme-spin 640ms linear infinite;
	opacity: 1;
}
/* WooCommerce also drops a tick glyph in; hide it. */
.hdme-scope .added_to_cart { display: none !important; }

/* Checkout blocking overlay — WooCommerce adds .blockUI, which Avada styles
   barely visibly. */
.hdme-scope .blockUI.blockOverlay {
	position: relative;
	background: rgba(255,255,255,0.72) !important;
	opacity: 1 !important;
}
.hdme-scope .blockUI.blockOverlay::after {
	content: "";
	position: absolute;
	top: 50%; left: 50%;
	width: 34px; height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid var(--hdme-blue-200);
	border-top-color: var(--hdme-blue-600);
	border-radius: 50%;
	animation: hdme-spin 700ms linear infinite;
}

/* Buy Now / Rent Now (direct-checkout plugin) and Place order share the same spinner. */
.pisol_buy_now_button.is-loading,
#place_order.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.pisol_buy_now_button.is-loading::after,
#place_order.is-loading::after {
	content: ""; position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
	border: 2px solid #fff; border-top-color: transparent; border-radius: 50%;
	animation: hdme-spin 640ms linear infinite;
}
/* Checkout: keep WooCommerce's overlay (it prevents double submission) but drop its
   centre-of-page spinner, and lift the Place order button above the overlay. */
form.checkout.processing .blockUI.blockOverlay { background: transparent !important; opacity: 1 !important; cursor: progress !important; }
form.checkout.processing .blockUI.blockOverlay::before,
form.checkout.processing .blockUI.blockMsg { display: none !important; }
#place_order.is-loading { z-index: 1002; }
@media (prefers-reduced-motion: reduce) {
	.pisol_buy_now_button.is-loading::after, #place_order.is-loading::after { animation-duration: 2s; }
}
.hdme-scope.woocommerce-checkout #place_order.is-loading,
.hdme-scope #place_order.is-loading { color: transparent !important; opacity: 1 !important; }
.hdme-scope .pisol_buy_now_button.is-loading,
.hdme-scope .single_add_to_cart_button.is-loading { color: transparent !important; opacity: 1 !important; }
/* WooCommerce fades the whole form to 60% while processing; the Place order spinner is the feedback instead. */
form.checkout.processing { opacity: 1 !important; }
