/**
 * Business Explained — Sticky Order Summary CSS v4 (Mobile only, ≤1024px)
 * -----------------------------------------------------------------------
 * v4 = v3 (Shopify-style summary) + Express Checkout skeleton loader.
 *
 * All v3 rules preserved unchanged.
 * NEW in v4: skeleton styles at the bottom, before the print block.
 */

@media (max-width: 1024px) {

	.be-express-skeleton__or {
		display: flex;
		align-items: center;
		gap: 12px;
		margin: 24px 0 !important;
		color: #6b7280;
		font-size: 14px;
		font-weight: 400;
		text-align: center;
	}

	.be-express-skeleton__or::before,
	.be-express-skeleton__or::after {
		content: "";
		flex: 1;
		height: 1px;
		background: #d1d5db;
		display: block;
	}

	/* ============================================================
	   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: #F5F5F5 !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;
	}

	/* ============================================================
	   NEW in v4 — Express Checkout skeleton loader
	   Shown while Stripe's wallet buttons are loading (~2.2s).
	   Auto-hidden by JS when Stripe removes display:none from
	   its container. See be-sticky-summary-v4.js
	   ============================================================ */
	.be-express-skeleton {
		margin: 24px 0 0 0;
		padding: 0;
		opacity: 1;
		transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.4s ease;
		max-height: 200px;
		overflow: hidden;
	}

	.be-express-skeleton.is-loaded {
		opacity: 0;
		max-height: 0;
		margin: 0;
		pointer-events: none;
	}

	.be-express-skeleton__title {
		text-align: center;
		font-size: 15px;
		color: #707070;
		margin-bottom: 11px;
		font-weight: 400;
	}

	.be-express-skeleton__row {
		display: flex;
		gap: 8px;
		width: 100%;
	}

	.be-express-skeleton__button {
		flex: 1;
		height: 55px;
		border-radius: 6px;
		background: linear-gradient(
			90deg,
			#e5e7eb 0%,
			#e5e7eb 40%,
			#f3f4f6 50%,
			#e5e7eb 60%,
			#e5e7eb 100%
		);
		background-size: 200% 100%;
		animation: be-skeleton-shimmer 1.6s ease-in-out infinite;
	}

	@keyframes be-skeleton-shimmer {
		0%   { background-position: 100% 0; }
		100% { background-position: -100% 0; }
	}

	/* ============================================================
	   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;
		}
		.be-express-skeleton {
			display: none !important;
		}
	}

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