/*
 * Mustafa WP — Checkout trust layer (Checkout Block).
 * Compact order summary, trust panel, savings pill, remove buttons,
 * payment-method label polish and secure pay button.
 * Uses the same --mwp-commerce-* tokens as mwp-woocommerce-commerce.css;
 * `body` prefixes out-rank the base checkout rules without touching that file.
 */

/* Checkout-only payment and currency notice; not part of the dynamic payment form. */
.mwp-commerce-page--checkout .mwp-checkout-payment-notice {
	display: grid;
	gap: 8px;
	margin-block: 0 20px;
	padding: 16px 20px;
	border: 1px solid var(--mwp-commerce-border);
	border-inline-start: 3px solid var(--mwp-commerce-accent);
	border-radius: var(--mwp-commerce-radius, 10px);
	background: var(--mwp-commerce-surface);
	color: var(--mwp-commerce-text);
	line-height: 1.7;
}
.mwp-checkout-payment-notice h2 {
	margin: 0;
	color: inherit;
	font-size: 1rem;
	font-weight: 800;
	line-height: 1.5;
}
.mwp-checkout-payment-notice p {
	margin: 0;
	color: inherit;
	font-size: .88rem;
}
.mwp-checkout-payment-notice__currency {
	padding-block-start: 9px;
	border-block-start: 1px solid var(--mwp-commerce-border);
	color: var(--mwp-commerce-muted) !important;
}
.mwp-checkout-payment-notice__currency strong {
	color: var(--mwp-commerce-text);
}
@media (max-width: 600px) {
	.mwp-commerce-page--checkout .mwp-checkout-payment-notice {
		padding: 14px;
	}
}

/* ---------- Trust panel (ExperimentalOrderMeta slot) ---------- */
/* Borderless section under the total: one green "secure" strip as the
 * only accent, then logos, a single-column guarantee list and a fee note. */
.mwp-checkout-trust {
	box-sizing: border-box;
	display: grid;
	gap: 12px;
	inline-size: auto;
	max-inline-size: calc(100% - 32px);
	min-inline-size: 0;
	margin: 14px 16px 4px;
	padding: 0;
	overflow-wrap: anywhere;
	border: 0;
	background: none;
	color: var(--mwp-commerce-text);
	font-size: .82rem;
	line-height: 1.55;
}

.mwp-checkout-trust p {
	max-inline-size: none;
	margin: 0;
}

.mwp-checkout-trust__secure {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: var(--mwp-commerce-radius);
	background: color-mix(in srgb, #16a34a 9%, var(--mwp-commerce-surface));
}

.mwp-checkout-trust__secure-icon {
	display: inline-grid;
	place-items: center;
	flex: 0 0 32px;
	inline-size: 32px;
	block-size: 32px;
	border-radius: var(--radius-pill);
	background: #16a34a;
	color: #fff;
}

.mwp-checkout-trust__secure-text strong {
	display: block;
	font-size: .86rem;
	font-weight: 800;
	line-height: 1.4;
}

.mwp-checkout-trust__secure-text small {
	display: block;
	color: var(--mwp-commerce-muted);
	font-size: var(--font-size-xs);
}

.mwp-checkout-trust__logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mwp-checkout-trust__logos li {
	display: inline-grid;
	place-items: center;
	block-size: 26px;
	padding: 2px 7px;
	border: 1px solid color-mix(in srgb, var(--mwp-commerce-border) 70%, transparent);
	border-radius: 6px;
	background: #fff;
}

.mwp-checkout-trust__logos img {
	display: block;
	inline-size: auto;
	max-inline-size: 48px;
	block-size: 16px;
	object-fit: contain;
}

.mwp-checkout-trust__chips {
	display: grid;
	gap: 7px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mwp-checkout-trust__chips li {
	display: flex;
	align-items: center;
	gap: 8px;
	min-inline-size: 0;
	font-size: var(--font-size-xs);
	font-weight: 600;
	line-height: 1.5;
}

.mwp-checkout-trust__check {
	display: inline-grid;
	place-items: center;
	flex: 0 0 18px;
	inline-size: 18px;
	block-size: 18px;
	border-radius: var(--radius-pill);
	background: var(--mwp-commerce-accent-soft);
	color: var(--mwp-commerce-accent);
}

.mwp-checkout-trust a {
	color: var(--mwp-commerce-accent);
	font-weight: 700;
	text-decoration: none;
}

.mwp-checkout-trust a:hover,
.mwp-checkout-trust a:focus-visible {
	color: var(--mwp-commerce-accent-hover);
	text-decoration: underline;
	text-decoration-skip-ink: none;
	text-underline-offset: 3px;
}

.mwp-checkout-trust__fee {
	padding-block-start: 10px;
	border-block-start: 1px dashed var(--mwp-commerce-border);
	color: var(--mwp-commerce-muted);
	font-size: var(--font-size-xs);
	line-height: 1.6;
}

/* ---------- Single summary card ----------
 * The theme already draws the sidebar card; WooCommerce's own bordered
 * order-summary box inside it produced a box-in-a-box. */
body .mwp-commerce-page--checkout .wc-block-checkout__sidebar :is(
	.wp-block-woocommerce-checkout-order-summary-block,
	.wc-block-components-checkout-order-summary
) {
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}

/* WooCommerce already separates the total with its own divider. */
body .mwp-commerce-page--checkout .wc-block-components-totals-footer-item {
	margin-block-start: 0 !important;
	border-block-start: 0 !important;
}

/* ---------- Scrollable item list ----------
 * Long carts scroll inside the summary so totals, trust panel and the pay
 * button stay in reach. The local/scroll gradient pairs draw top/bottom
 * shadows only while there is more content to scroll to. */
body .mwp-commerce-page--checkout .wp-block-woocommerce-checkout-order-summary-cart-items-block {
	max-block-size: min(340px, 50vh) !important;
	overflow-x: hidden !important;
	overflow-y: auto !important;
	overscroll-behavior: contain;
	padding-inline-end: 6px;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--mwp-commerce-muted) 45%, transparent) transparent;
	background:
		linear-gradient(var(--mwp-commerce-surface) 30%, transparent) center top / 100% 28px no-repeat local,
		linear-gradient(transparent, var(--mwp-commerce-surface) 70%) center bottom / 100% 28px no-repeat local,
		radial-gradient(farthest-side at 50% 0, rgba(15, 23, 42, .14), transparent) center top / 100% 10px no-repeat scroll,
		radial-gradient(farthest-side at 50% 100%, rgba(15, 23, 42, .14), transparent) center bottom / 100% 10px no-repeat scroll;
}

body .mwp-commerce-page--checkout .wp-block-woocommerce-checkout-order-summary-cart-items-block::-webkit-scrollbar {
	inline-size: 6px;
	width: 6px;
}

body .mwp-commerce-page--checkout .wp-block-woocommerce-checkout-order-summary-cart-items-block::-webkit-scrollbar-thumb {
	border-radius: var(--radius-pill);
	background: color-mix(in srgb, var(--mwp-commerce-muted) 45%, transparent);
}

@media (max-width: 520px) {
	body .mwp-commerce-page--checkout .wp-block-woocommerce-checkout-order-summary-cart-items-block {
		max-block-size: min(300px, 45vh) !important;
	}
}

/* ---------- Compact order summary rows ---------- */
body .mwp-commerce-page--checkout .wc-block-components-order-summary-item .wc-block-components-product-metadata__description {
	display: none !important;
}

/* With quantity 1 the line total repeats the unit price under the name
 * (data-mwp-qty is set by checkout-trust.js from the cart store). */
body .mwp-commerce-page--checkout .wc-block-components-order-summary-item[data-mwp-qty="1"] .wc-block-components-order-summary-item__total-price {
	display: none !important;
}

/* Amounts never break mid-number; old and sale prices may wrap as units. */
body .mwp-commerce-page--checkout .wc-block-components-order-summary-item :is(
	.wc-block-formatted-money-amount,
	.wc-block-components-formatted-money-amount,
	.wc-block-components-product-price__regular,
	.wc-block-components-product-price__value
) {
	white-space: nowrap !important;
	overflow-wrap: normal !important;
	word-break: normal !important;
}

body .mwp-commerce-page--checkout .wc-block-components-order-summary-item .wc-block-components-product-price {
	display: inline-flex !important;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 8px;
	overflow-wrap: normal !important;
}

body .mwp-commerce-page--checkout .wc-block-components-order-summary-item .wc-block-components-product-price__regular {
	color: var(--mwp-commerce-muted);
	font-size: .82em;
	font-weight: 600;
}

@container (min-width: 821px) {
	/* Two columns: the line total (shown only when qty > 1) sits under the
	 * details instead of stealing width from the product name. */
	body .mwp-commerce-page--checkout .wc-block-checkout__sidebar .wc-block-components-order-summary-item {
		grid-template-columns: 46px minmax(0, 1fr) !important;
		row-gap: 4px !important;
		padding-block: 10px !important;
	}

	body .mwp-commerce-page--checkout .wc-block-checkout__sidebar .wc-block-components-order-summary-item__total-price {
		grid-column: 2 !important;
		grid-row: 2 !important;
		justify-self: start !important;
		text-align: start !important;
	}

	body .mwp-commerce-page--checkout .wc-block-checkout__sidebar .wc-block-components-order-summary-item__image {
		inline-size: 46px !important;
		width: 46px !important;
		min-inline-size: 46px !important;
	}

	body .mwp-commerce-page--checkout .wc-block-checkout__sidebar .wc-block-components-order-summary-item__image img {
		inline-size: 46px !important;
		width: 46px !important;
		block-size: 46px !important;
		height: 46px !important;
	}

	body .mwp-commerce-page--checkout .wc-block-checkout__sidebar .wc-block-components-product-name {
		font-size: .86rem !important;
		line-height: 1.5 !important;
	}
}

@container (max-width: 520px) {
	body .mwp-commerce-page--checkout .wc-block-components-order-summary-item {
		grid-template-columns: 46px minmax(0, 1fr) !important;
		row-gap: 4px !important;
		padding-block: 10px !important;
	}

	body .mwp-commerce-page--checkout .wc-block-components-order-summary-item__image {
		inline-size: 46px !important;
		width: 46px !important;
		min-inline-size: 46px !important;
	}

	body .mwp-commerce-page--checkout .wc-block-components-order-summary-item__image img {
		inline-size: 46px !important;
		width: 46px !important;
		block-size: 46px !important;
		height: 46px !important;
	}
}

/* ---------- Savings pill (replaces the bordered "Save" label) ---------- */
body .mwp-commerce-page--checkout .wc-block-components-sale-badge {
	position: static !important;
	display: inline-flex !important;
	align-items: center;
	gap: 4px;
	margin: 4px 0 0 !important;
	padding: 2px 8px !important;
	border: 0 !important;
	border-radius: var(--radius-pill) !important;
	background: color-mix(in srgb, #16a34a 13%, transparent) !important;
	box-shadow: none !important;
	color: #15803d !important;
	font-size: 0 !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	white-space: nowrap;
}

body .mwp-commerce-page--checkout .wc-block-components-sale-badge::before {
	content: "وفّرت";
	font-size: var(--font-size-xs);
	font-weight: 700;
	line-height: 1.5;
}

body .mwp-commerce-page--checkout .wc-block-components-sale-badge :where(
	.wc-block-formatted-money-amount,
	.wc-block-components-formatted-money-amount
) {
	color: inherit !important;
	font-size: var(--font-size-xs) !important;
	font-weight: 800 !important;
	line-height: 1.5;
}

/* ---------- Remove item button (added by checkout-trust.js) ---------- */
.mwp-summary-remove {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-block-size: 28px;
	margin-block-start: 4px;
	padding: 2px 0;
	border: 0;
	background: none;
	color: var(--mwp-commerce-muted);
	font: inherit;
	font-size: var(--font-size-xs);
	font-weight: 700;
	cursor: pointer;
	transition: color var(--motion-duration-fast) var(--motion-ease-standard);
}

.mwp-summary-remove::before {
	content: "";
	flex: 0 0 14px;
	inline-size: 14px;
	block-size: 14px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.mwp-summary-remove:hover:not(:disabled),
.mwp-summary-remove:focus-visible {
	color: #dc2626;
}

.mwp-summary-remove:disabled {
	cursor: progress;
	opacity: .7;
}

/* ---------- Kashier payment-method labels ----------
 * Kashier's block script renders icons with inline LTR spacing
 * (margin-left / padding-top), which misaligns them in RTL. */
.mwp-commerce-page--checkout div:has(> div > img[id^="kashier-icon-"]) {
	flex-wrap: wrap;
	gap: 8px 12px;
}

.mwp-commerce-page--checkout div:has(> img[id^="kashier-icon-"]) {
	flex-wrap: wrap;
	gap: 6px;
	margin-inline-start: auto;
}

.mwp-commerce-page--checkout img[id^="kashier-icon-"] {
	inline-size: auto !important;
	max-inline-size: 52px !important;
	block-size: 22px !important;
	margin: 0 !important;
	padding: 0 !important;
	object-fit: contain;
}

.mwp-commerce-page--checkout #secured-by-kashier-container {
	display: grid;
	gap: 8px;
}

.mwp-commerce-page--checkout #secured-by-kashier-container img {
	max-inline-size: 150px;
	block-size: auto;
}

/* ---------- Secure pay button ---------- */
.mwp-commerce-page--checkout .wc-block-components-checkout-place-order-button .wc-block-components-button__text {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.mwp-commerce-page--checkout .wc-block-components-checkout-place-order-button .wc-block-components-button__text::before {
	content: "";
	flex: 0 0 18px;
	inline-size: 18px;
	block-size: 18px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The spinner replaces the label while the order is submitting. */
.mwp-commerce-page--checkout .wc-block-components-checkout-place-order-button.wc-block-components-button--loading .wc-block-components-button__text::before {
	display: none;
}

/* ---------- Classic Cart ---------- */
.mwp-commerce-page--cart .mwp-checkout-trust--cart {
	max-inline-size: 100%;
	margin: 16px 0 0;
}

.mwp-commerce-page--cart .mwp-checkout-trust__check svg {
	inline-size: 12px;
	block-size: 12px;
}

/* Regular price struck through beside the sale price. */
.mwp-commerce-page--cart td.product-price del {
	margin-inline-end: 6px;
	color: var(--mwp-commerce-muted);
	font-size: .85em;
	font-weight: 600;
	opacity: 1;
}

.mwp-commerce-page--cart td.product-price ins {
	color: var(--mwp-commerce-text);
	font-weight: 800;
	text-decoration: none;
}

.mwp-commerce-page--cart .wc-proceed-to-checkout .checkout-button {
	gap: 8px;
}

.mwp-commerce-page--cart .wc-proceed-to-checkout .checkout-button::before {
	content: "";
	flex: 0 0 18px;
	inline-size: 18px;
	block-size: 18px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* No cross-sells: keep the totals card in the narrow end column. */
@media (min-width: 821px) {
	.mwp-commerce-page--cart .cart-collaterals:not(:has(.cross-sells)) .cart_totals {
		grid-column: 2;
	}
}

/* ---------- Small screens ---------- */
@media (max-width: 380px) {
	.mwp-checkout-trust__chips {
		grid-template-columns: minmax(0, 1fr);
	}
}
