:root {
	--bwoif-border: #e2e8f0;
	--bwoif-border-strong: #cbd5e1;
	--bwoif-text: #0f172a;
	--bwoif-muted: #64748b;
	--bwoif-soft: #f8fafc;
	--bwoif-accent: #2563eb;
	--bwoif-accent-soft: #eff6ff;
	--bwoif-success: #334155;
	--bwoif-radius: 16px;
}

.bwoif-purchase-box,
.bwoif-checkout-selector,
.bwoif-split-notice,
.bwoif-linked-order-info {
	font-family: Vazirmatn, IRANSans, Tahoma, sans-serif;
	box-sizing: border-box;
}

.bwoif-purchase-box *,
.bwoif-checkout-selector *,
.bwoif-split-notice *,
.bwoif-linked-order-info * {
	box-sizing: border-box;
}

/* Product purchase box. Intentionally does not restyle WooCommerce's native add-to-cart button. */
.bwoif-purchase-box {
	direction: rtl;
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--bwoif-border);
	border-radius: 18px;
	background: #fff;
	padding: 18px;
	margin: 18px 0;
	box-shadow: 0 8px 28px rgba(15, 23, 42, .055);
	overflow: visible;
}

.bwoif-box-title {
	font-size: 15px;
	line-height: 1.7;
	font-weight: 800;
	color: var(--bwoif-text);
	margin: 0 0 12px;
}

.bwoif-purchase-types {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin: 0 0 12px;
}

.bwoif-type-card {
	appearance: none !important;
	-webkit-appearance: none !important;
	width: 100%;
	min-width: 0;
	min-height: 74px;
	border: 1px solid var(--bwoif-border) !important;
	border-radius: 14px !important;
	background: #fff !important;
	color: var(--bwoif-text) !important;
	padding: 12px 14px !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: flex-start !important;
	justify-content: center !important;
	gap: 3px !important;
	cursor: pointer !important;
	box-shadow: none !important;
	text-align: right !important;
	font-family: inherit !important;
	line-height: 1.6 !important;
	transform: none !important;
	transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease !important;
}

.bwoif-type-card::before,
.bwoif-type-card::after,
.bwoif-installment-method::before,
.bwoif-installment-method::after {
	content: none !important;
	display: none !important;
}

.bwoif-type-card:hover,
.bwoif-type-card:focus-visible {
	border-color: var(--bwoif-border-strong) !important;
}

.bwoif-type-card.is-active {
	border-color: var(--bwoif-accent) !important;
	background: var(--bwoif-accent-soft) !important;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, .08) !important;
}

.bwoif-type-name {
	font-size: 14px;
	font-weight: 800;
	color: var(--bwoif-text);
}

.bwoif-type-price {
	font-size: 15px;
	font-weight: 800;
	color: #334155;
	white-space: normal;
}

.bwoif-type-caption {
	font-size: 12px;
	color: var(--bwoif-muted);
}

.bwoif-method-panel[hidden] {
	display: none !important;
}

.bwoif-method-panel {
	margin: 10px 0;
}

.bwoif-installment-panel {
	background: linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
	border: 1px solid #e6eefc;
	border-radius: 16px;
	padding: 12px;
}

.bwoif-method-label {
	font-size: 13px;
	font-weight: 800;
	color: var(--bwoif-text);
	margin: 0 0 10px;
}

.bwoif-method-card,
.bwoif-installment-method {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--bwoif-border);
	border-radius: 14px;
	background: var(--bwoif-soft);
	padding: 13px 14px;
	text-align: right;
	color: var(--bwoif-text);
	font-family: inherit;
}

.bwoif-method-main {
	font-weight: 800;
	font-size: 14px;
	line-height: 1.8;
	margin: 0 0 3px;
}

.bwoif-method-sub {
	font-size: 12px;
	line-height: 1.8;
	color: var(--bwoif-muted);
}

.bwoif-installment-methods {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.bwoif-installment-method {
	appearance: none !important;
	-webkit-appearance: none !important;
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px !important;
	cursor: pointer !important;
	background: #fff !important;
	border-color: #dbe7fb;
	box-shadow: 0 6px 18px rgba(15, 23, 42, .04) !important;
	font-family: inherit !important;
	line-height: 1.7 !important;
	transform: none !important;
	padding: 14px !important;
}

.bwoif-installment-method:hover,
.bwoif-installment-method:focus-visible {
	border-color: #bfd3fb;
	box-shadow: 0 10px 26px rgba(37, 99, 235, .08) !important;
}

.bwoif-installment-method.is-active {
	border-color: var(--bwoif-accent);
	background: linear-gradient(180deg, #fafdff 0%, #f2f7ff 100%) !important;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, .08), 0 12px 28px rgba(37, 99, 235, .08) !important;
}

.bwoif-method-name {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-width: 0;
	font-size: 14px;
	font-weight: 800;
	grid-column: 1 / -1;
	padding-bottom: 10px;
	margin-bottom: 2px;
	border-bottom: 1px solid #ecf2fd;
}

.bwoif-method-name img {
	max-width: 68px !important;
	max-height: 30px !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain;
	flex: 0 0 auto;
	padding: 6px 8px;
	border-radius: 10px;
	background: #fff;
	border: 1px solid #edf2fb;
}

.bwoif-method-installments,
.bwoif-method-total {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 58px;
	font-size: 11px;
	line-height: 1.8;
	color: var(--bwoif-muted);
	overflow-wrap: anywhere;
	background: #f8fbff;
	border: 1px solid #e4eefc;
	border-radius: 12px;
	padding: 10px 12px;
}

.bwoif-method-installments {
	order: 2;
}

.bwoif-method-total {
	order: 1;
}

.bwoif-method-total strong,
.bwoif-method-installments {
	font-size: 13px;
	font-weight: 700;
}

.bwoif-method-total strong {
	color: #334155;
	margin-top: 2px;
}

.bwoif-general-note {
	font-size: 12px;
	line-height: 1.9;
	color: #5f6b7a;
	background: #fafafa;
	border: 1px dashed #d9dee6;
	border-radius: 12px;
	padding: 10px 12px;
	margin: 12px 0;
}

/* Hide the placeholder if a custom theme does not expose an adjacent cart form.
 * Never open a PHP wrapper around the native form; this prevents content
 * leaking into the theme's separate sticky/mobile add-to-cart bar.
 */
.bwoif-cart-form-wrap:empty {
    display: none;
}

/* Keep the native theme/WooCommerce cart form and add-to-cart button visually untouched. */
.bwoif-cart-form-wrap {
	width: 100%;
	max-width: 100%;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid #edf0f4;
}

.bwoif-cart-form-wrap form.cart {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	max-width: 100%;
}

/* Checkout selector */
.bwoif-checkout-selector {
	direction: rtl;
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--bwoif-border);
	border-radius: 16px;
	background: #fff;
	padding: 15px;
	margin: 0 0 16px;
	box-shadow: 0 5px 18px rgba(15, 23, 42, .035);
}

.bwoif-checkout-selector .bwoif-purchase-types {
	margin-bottom: 0;
}

/* Split-payment notice */
.bwoif-split-notice {
	direction: rtl;
	width: 100%;
	max-width: 100%;
	border: 1px solid #efd18d;
	background: #fffbeb;
	border-radius: 14px;
	padding: 14px 15px;
	margin: 0 0 16px;
	color: #4d3b11;
}

.bwoif-split-notice > strong {
	display: block;
	font-size: 14px;
	line-height: 1.8;
}

.bwoif-split-notice p {
	font-size: 12px;
	line-height: 1.9;
	margin: 6px 0 9px;
}

.bwoif-split-notice ul {
	list-style: none;
	margin: 0 0 10px;
	padding: 0;
	display: grid;
	gap: 7px;
}

.bwoif-split-notice li,
.bwoif-split-totals > div {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 12px;
	align-items: center;
	font-size: 12px;
	line-height: 1.7;
}

.bwoif-split-notice li > :last-child,
.bwoif-split-totals > div > :last-child {
	white-space: nowrap;
}

.bwoif-split-totals {
	border-top: 1px dashed #dfbd71;
	padding-top: 9px;
	display: grid;
	gap: 7px;
}

.bwoif-split-totals strong {
	font-size: 13px;
}

.bwoif-split-notice small {
	display: block;
	margin-top: 10px;
	line-height: 1.8;
	color: #715b24;
}

.bwoif-linked-order-info {
	direction: rtl;
	margin: 16px 0;
	padding: 12px 14px;
	border-radius: 12px;
	background: #f5f7fb;
	border: 1px solid #e0e5ec;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* Checkout responsiveness. Scope these rules to checkout only. */
.woocommerce-checkout .woocommerce-checkout-review-order,
.woocommerce-checkout #payment {
	box-sizing: border-box;
	max-width: 100%;
}

.woocommerce-checkout-review-order-table {
	width: 100%;
	max-width: 100%;
	table-layout: auto;
}

.woocommerce-checkout-review-order-table td,
.woocommerce-checkout-review-order-table th {
	word-break: normal;
	overflow-wrap: anywhere;
	vertical-align: middle;
}

.woocommerce-checkout .form-row input.input-text,
.woocommerce-checkout .form-row textarea,
.woocommerce-checkout .select2-container {
	max-width: 100% !important;
	width: 100% !important;
	box-sizing: border-box;
}

/* Mini-cart: only layout safety; keep theme colors/typography/buttons intact. */
.widget_shopping_cart_content,
.woocommerce-mini-cart {
	box-sizing: border-box;
	max-width: 100%;
}

.woocommerce-mini-cart-item {
	position: relative;
	min-width: 0;
}

.woocommerce-mini-cart-item img {
	max-width: 64px !important;
	height: auto !important;
	object-fit: cover;
}

@media (max-width: 991px) {
	.bwoif-purchase-box {
		padding: 16px;
		border-radius: 16px;
	}

	.bwoif-checkout-selector {
		padding: 14px;
	}

	.woocommerce-checkout form.checkout {
		max-width: 100%;
	}
}

@media (max-width: 768px) {
	.bwoif-purchase-box {
		padding: 13px;
		margin: 14px 0;
		border-radius: 14px;
		box-shadow: 0 4px 18px rgba(15, 23, 42, .045);
	}

	.bwoif-box-title {
		font-size: 14px;
		margin-bottom: 10px;
	}

	.bwoif-purchase-types {
		gap: 8px;
	}

	.bwoif-type-card {
		min-height: 66px;
		padding: 9px 10px !important;
	}

	.bwoif-type-name {
		font-size: 13px;
	}

	.bwoif-type-price {
		font-size: 13px;
	}

	.bwoif-method-card,
	.bwoif-installment-method {
		padding: 11px 12px;
	}

	.bwoif-general-note {
		padding: 9px 10px;
		margin: 10px 0;
	}

	.bwoif-cart-form-wrap {
		margin-top: 12px;
		padding-top: 12px;
	}

	.bwoif-split-notice li,
	.bwoif-split-totals > div {
		align-items: start;
	}

	.woocommerce-checkout form.checkout {
		display: block !important;
	}

	.woocommerce-checkout #customer_details,
	.woocommerce-checkout #order_review,
	.woocommerce-checkout #order_review_heading {
		width: 100% !important;
		float: none !important;
		max-width: none !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	.woocommerce-checkout-review-order-table th.product-name {
		width: auto;
	}

	.woocommerce-checkout-review-order-table th.product-total {
		width: 36%;
	}

	.widget_shopping_cart_content {
		max-width: 100vw;
		overflow-x: hidden;
	}
}

@media (max-width: 480px) {
	.bwoif-purchase-box {
		padding: 11px;
		margin: 12px 0;
	}

	/* Keep cash/installment side-by-side where possible, instead of creating an excessively tall box. */
	.bwoif-purchase-types {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 7px;
	}

	.bwoif-type-card {
		min-height: 62px;
		padding: 8px !important;
	}

	.bwoif-type-price,
	.bwoif-type-caption {
		font-size: 11px;
	}

	.bwoif-method-name,
	.bwoif-method-main {
		font-size: 13px;
	}

	.bwoif-method-installments,
	.bwoif-method-total,
	.bwoif-method-sub,
	.bwoif-general-note {
		font-size: 11px;
	}

	.bwoif-split-notice {
		padding: 12px;
	}

	.bwoif-split-notice li,
	.bwoif-split-totals > div {
		grid-template-columns: 1fr;
		gap: 2px;
	}

	.bwoif-split-notice li > :last-child,
	.bwoif-split-totals > div > :last-child {
		white-space: normal;
		font-weight: 700;
	}

	.woocommerce-checkout-review-order-table {
		font-size: 12px;
	}

	.woocommerce-checkout-review-order-table td,
	.woocommerce-checkout-review-order-table th {
		padding-left: 6px !important;
		padding-right: 6px !important;
	}

	.woocommerce-checkout-review-order-table .product-name img {
		max-width: 42px !important;
		height: auto !important;
	}
}

@media (max-width: 360px) {
	.bwoif-purchase-types {
		grid-template-columns: 1fr;
	}

	.bwoif-type-card {
		min-height: 56px;
	}
}


@media (max-width: 640px) {
	.bwoif-installment-panel {
		padding: 10px;
	}

	.bwoif-installment-method {
		grid-template-columns: 1fr;
		gap: 8px !important;
		padding: 12px !important;
	}

	.bwoif-method-name {
		font-size: 13px;
		padding-bottom: 8px;
	}

	.bwoif-method-name img {
		max-width: 60px !important;
		max-height: 26px !important;
	}

	.bwoif-method-installments,
	.bwoif-method-total {
		min-height: 0;
		padding: 9px 10px;
	}
}
