/**
 * Business Explained — Sticky Order Summary CSS (Mobile only, ≤1024px)
 * --------------------------------------------------------------------
 * Shopify-style design.
 * All rules are scoped to viewports ≤1024px so desktop is untouched.
 */

@media (max-width: 1024px) {

	/* ============================================================
	   Page padding adjustment (so sticky bar sits cleanly)
	   ============================================================ */
	.woocommerce-checkout main {
		padding-top: 30px !important;
	}

	/* ============================================================
	   Wrapper — sits below the page title banner, sticks on scroll
	   ============================================================ */
	.be-sticky-summary {
		position: sticky !important;
		top: 0 !important;
		z-index: 100 !important;
		background: #ffffff;
		margin: 0;
		padding: 0;
		border-bottom: 1px solid #e5e7eb;
		font-family: inherit;
		color: #1f2937;
		transform: translateZ(0);
		will-change: transform;
	}

	/* ============================================================
	   Toggle row — "Checkout summary ▼      $197"
	   ============================================================ */
	.be-sticky-summary__toggle {
		display: flex !important;
		width: 100%;
		align-items: center !important;
		justify-content: space-between !important;
		padding: 16px 20px !important;
		background: #ededed !important;
		height: 63px !important;
		border: 0;
		border: none !important;
		cursor: pointer !important;
		font: inherit;
		text-align: left !important;
		-webkit-tap-highlight-color: transparent;
	}

	.be-sticky-summary__toggle:focus-visible {
		outline: 2px solid #6d28d9;
		outline-offset: -2px;
	}

	.be-sticky-summary__label-wrap {
		display: inline-flex;
		align-items: center;
		gap: 9px !important;
	}

	.be-sticky-summary__label {
		font-size: 15px;
		font-weight: 500;
		color: #4f46e5;
		letter-spacing: 0;
	}

	.be-sticky-summary__chevron {
		width: 8px;
		height: 8px;
		border-right: 1.5px solid #4f46e5;
		border-bottom: 1.5px solid #4f46e5;
		transform: rotate(45deg);
		transition: transform 0.2s ease;
		margin-top: -3px;
	}

	.be-sticky-summary.is-expanded .be-sticky-summary__chevron {
		transform: rotate(-135deg);
		margin-top: 3px;
	}

	.be-sticky-summary__total-display {
		font-size: 19px;
		font-weight: 700;
		color: #111827;
		white-space: nowrap;
	}

	.be-sticky-summary__total-display .woocommerce-Price-currencySymbol {
		font-weight: 700;
	}

	/* ============================================================
	   Body — contains the moved WooCommerce summary
	   ============================================================ */
	.be-sticky-summary__body {
		background: #ffffff;
		overflow: hidden;
	}

	.be-sticky-summary.is-collapsed .be-sticky-summary__body {
		display: none !important;
	}

	.be-sticky-summary.is-expanded .be-sticky-summary__body {
		display: block;
		max-height: 60vh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 0;
	}

	/* ============================================================
	   Reset Woodmart table styling inside our sticky body
	   ============================================================ */
	.be-sticky-summary__body .wd-table-wrapper,
	.be-sticky-summary__body .shop_table {
		margin: 0;
		padding: 0;
		border: 0;
		background: transparent;
		width: 100%;
		box-shadow: none;
		border-radius: 0;
	}

	.be-sticky-summary__body table,
	.be-sticky-summary__body thead,
	.be-sticky-summary__body tbody,
	.be-sticky-summary__body tfoot,
	.be-sticky-summary__body tr,
	.be-sticky-summary__body th,
	.be-sticky-summary__body td {
		display: block;
		border: 0;
		background: transparent;
		padding: 0;
		margin: 0;
		text-align: left;
		width: auto;
	}

	.be-sticky-summary__body thead {
		display: none;
	}

	/* ============================================================
	   Product row — image | name | price
	   ============================================================ */
	.be-sticky-summary__body tr.cart_item {
		display: flex;
		align-items: center;
		gap: 14px;
		padding: 16px 20px;
		border-bottom: 1px solid #e5e7eb;
		background: #f6f6f6;
	}

	.be-sticky-summary__body td.wd-checkout-prod {
		display: flex;
		align-items: center;
		gap: 15px !important;
		width: 100%;
	}

	.be-sticky-summary__body .wd-checkout-prod {
		display: block;
		padding: 10px;
		border-bottom: 0px !important;
	}

	/* Product image */
	.be-sticky-summary__body .wd-checkout-prod-img {
		position: relative;
		flex: 0 0 auto;
		width: 55px;
		height: 55px;
		border-radius: 8px;
		overflow: hidden;
		background: #cecece;
		margin: 0;
		text-align: center;
		display: flex;
		justify-content: center;
	}

	.be-sticky-summary__body .wd-checkout-prod-img img {
		width: 55px !important;
		max-width: 55px !important;
		height: 100%;
		display: block !important;
		object-fit: cover;
	}

	/* Right side of the product row (title + price) */
	.be-sticky-summary__body .wd-checkout-prod-cont {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		position: static;
	}

	.be-sticky-summary__body .wd-checkout-prod-img + .wd-checkout-prod-cont .product-quantity {
		display: none;
	}

	.be-sticky-summary__body .wd-checkout-prod-title {
		flex: 1;
		display: block;
		font-size: 14px;
		font-weight: 500;
		color: #111827;
		line-height: 1.4;
	}

	.be-sticky-summary__body .wd-checkout-prod-title .cart-product-label {
		display: block;
		color: #111827;
		font-weight: 500;
	}

	.be-sticky-summary__body .wd-checkout-prod-total {
		flex: 0 0 auto;
		font-size: 14px;
		font-weight: 600;
		color: #111827;
		white-space: nowrap;
	}

	/* ============================================================
	   Subtotal + Total rows — hidden (price is shown in toggle bar)
	   ============================================================ */
	.be-sticky-summary__body tfoot,
	.be-sticky-summary__body tfoot tr.cart-subtotal {
		display: none !important;
	}

	/* ============================================================
	   Update flash — runs when total changes (e.g. upsell added)
	   ============================================================ */
	.be-sticky-summary.is-updated .be-sticky-summary__toggle {
		animation: be-sticky-flash 0.7s ease;
	}

	@keyframes be-sticky-flash {
		0%   { background: #fff5d6; }
		60%  { background: #fff5d6; }
		100% { background: #F5F5F5; }
	}

	/* ============================================================
	   Hide the original WooCommerce "Your order" heading
	   ============================================================ */
	#order_review > #order_review_heading {
		display: none;
	}

	/* ============================================================
	   Mobile tweaks (≤768px refinement within the mobile range)
	   ============================================================ */
	@media (max-width: 768px) {
		.be-sticky-summary__label {
			font-size: 14px;
		}
		.be-sticky-summary__body tr.cart_item {
			padding: 14px 16px;
		}
	}

	/* ============================================================
	   Print
	   ============================================================ */
	@media print {
		.be-sticky-summary {
			position: static !important;
			border: 0;
		}
		.be-sticky-summary__toggle {
			display: none !important;
		}
		.be-sticky-summary.is-collapsed .be-sticky-summary__body {
			display: block !important;
		}
	}

} /* end @media (max-width: 1024px) */
