:root {
	--bwoif-border: #e2e8f0;
	--bwoif-border-strong: #cbd5e1;
	--bwoif-text: #1f2937;
	--bwoif-muted: #6b7280;
	--bwoif-soft: #f8fafc;
	--bwoif-accent: #0ea5b7;
	--bwoif-accent-soft: #effbfd;
	--bwoif-price: #374151;
	--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. Native WooCommerce add-to-cart button stays theme-owned. */
.bwoif-purchase-box {
	direction: rtl;
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--bwoif-border);
	border-radius: 18px;
	background: #fff;
	padding: 16px;
	margin: 18px 0;
	box-shadow: 0 8px 28px rgba(15,23,42,.045);
	overflow: visible;
}
.bwoif-purchase-box.bwoif-single-mode { padding-top: 14px; }
.bwoif-box-title { margin: 0 0 12px; color: var(--bwoif-text); font-size: 15px; line-height: 1.7; font-weight: 800; }
.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: 82px;
	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.55 !important; transform: none !important;
	transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease !important;
}
/* Accessible, 1.8.x-inspired two-choice purchase selector. */
.bwoif-purchase-box .bwoif-purchase-types { gap: 10px; }
.bwoif-purchase-box .bwoif-type-card { position: relative; padding: 15px 15px 15px 38px !important; min-height: 90px; }
.bwoif-purchase-box .bwoif-type-name { display: flex; align-items: center; gap: 8px; }
.bwoif-purchase-box .bwoif-type-name::before {
    content: ""; display: inline-block; width: 15px; height: 15px;
    border-radius: 50%; border: 1.5px solid #b1bccb; background: #fff;
    box-shadow: inset 0 0 0 3px #fff; flex: 0 0 15px;
}
.bwoif-purchase-box .bwoif-type-card.is-active .bwoif-type-name::before { background: var(--bwoif-accent); border-color: var(--bwoif-accent); }
.bwoif-purchase-box .bwoif-type-card:focus-visible,
.bwoif-purchase-box .bwoif-installment-method:focus-visible {
    outline: 2px solid var(--bwoif-accent) !important; outline-offset: 2px;
}
.bwoif-purchase-box .bwoif-type-price { color: var(--bwoif-price); font-size: 15px; font-variant-numeric: tabular-nums; }
.bwoif-purchase-box .bwoif-method-installments { font-variant-numeric: tabular-nums; }
.bwoif-purchase-box .bwoif-general-note { margin: 12px 0 0; background: #f8fafc; border: 1px solid #e6ebf1; }
.bwoif-purchase-box .bwoif-general-note-title { display: block; font-size: 12px; font-weight: 800; color: #344054; margin-bottom: 4px; }
.bwoif-purchase-box .bwoif-general-note-small { display: block; color: #7b8797; font-size: 10px; margin-top: 6px; }
@media (max-width: 640px) {
  .bwoif-purchase-box .bwoif-type-card { min-height: 82px; padding: 12px !important; }
  .bwoif-purchase-box .bwoif-type-price { font-size: 13px; }
}

.bwoif-type-card[hidden], .bwoif-single-type-marker { display: none !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(14,165,183,.07) !important; }
.bwoif-type-name { font-size: 14px; font-weight: 800; color: var(--bwoif-text); }
.bwoif-type-price { font-size: 15px; font-weight: 800; color: var(--bwoif-price); white-space: normal; }
.bwoif-type-caption { font-size: 11px; color: var(--bwoif-muted); }

.bwoif-method-panel[hidden] { display: none !important; }
.bwoif-method-panel { margin: 10px 0; }
.bwoif-single-mode .bwoif-method-panel { margin-top: 0; }
.bwoif-method-card {
	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-card-cash { background: #f8fafc; }
.bwoif-method-main { font-weight: 800; font-size: 13px; line-height: 1.8; margin: 0 0 2px; }
.bwoif-method-sub { font-size: 11px; line-height: 1.8; color: var(--bwoif-muted); }

/* Read-only gateway-price comparison is visible even while cash is selected.
 * Cash-only product overrides render NONE of this markup. */
.bwoif-gateway-price-preview {
	margin-top: 11px; padding: 12px; background: #fbfcfe;
	border: 1px solid #e4e9f0; border-radius: 13px;
}
.bwoif-gateway-price-preview-title { color: #475569; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.bwoif-gateway-price-preview-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 9px 2px; border-top: 1px solid #edf1f6; line-height: 1.8; }
.bwoif-gateway-price-preview-row span { color: #5e6a7c; font-size: 12px; min-width: 0; overflow-wrap: anywhere; }
.bwoif-gateway-price-preview-row strong { color: var(--bwoif-price); font-weight: 800; font-size: 13px; text-align: left; direction: rtl; }
.bwoif-gateway-price-preview-hint { margin-top: 6px; color: #718096; font-size: 10px; line-height: 1.8; }

.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-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;
	width: 100%; max-width: 100%; cursor: pointer !important; padding: 14px !important;
	background: #fff !important; border: 1px solid #dbe7fb !important; border-radius: 14px !important;
	box-shadow: 0 6px 18px rgba(15,23,42,.04) !important; color: var(--bwoif-text) !important;
	font-family: inherit !important; line-height: 1.7 !important; text-align: right !important; transform: none !important;
}
.bwoif-installment-method:hover,.bwoif-installment-method:focus-visible { border-color: #bfd3fb !important; box-shadow: 0 10px 24px rgba(37,99,235,.07) !important; }
.bwoif-installment-method.is-active { border-color: var(--bwoif-accent) !important; background: linear-gradient(180deg,#fbfeff,#f3fbfc) !important; box-shadow: 0 0 0 2px rgba(14,165,183,.07),0 10px 24px rgba(14,165,183,.06) !important; }
.bwoif-method-name { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; grid-column: 1/-1; padding-bottom: 9px; border-bottom: 1px solid #edf2f7; font-size: 13px; font-weight: 800; }
.bwoif-method-name > span { min-width: 0; overflow-wrap: anywhere; }
.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: 5px 7px; border-radius: 9px; background: #fff; }
.bwoif-method-installments,.bwoif-method-total { display: flex; flex-direction: column; justify-content: center; min-height: 56px; background: #f8fafc; border: 1px solid #e7edf4; border-radius: 11px; padding: 9px 11px; color: var(--bwoif-muted); font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.bwoif-method-total strong { display: block; margin-top: 1px; color: var(--bwoif-price); font-size: 13px; font-weight: 800; }
.bwoif-method-installments { color: #4b5563; font-size: 12px; font-weight: 650; }
.bwoif-general-note { font-size: 11px; line-height: 1.9; color: #667085; background: #fafafa; border: 1px dashed #d9dee6; border-radius: 12px; padding: 10px 12px; margin: 12px 0; }
.bwoif-method-unavailable { padding: 12px 14px; border-radius: 12px; border: 1px solid #fed7aa; background: #fff7ed; color: #9a3412; font-size: 12px; line-height: 1.8; }
.bwoif-cart-form-wrap:empty { display: none; }
.bwoif-cart-form-wrap[hidden] { display: none !important; }
.bwoif-cart-form-wrap { margin-top: 12px; }
.bwoif-cart-form-wrap form.cart { margin-bottom: 0 !important; }

/* Checkout selector. */
.bwoif-checkout-selector { direction: rtl; margin: 0 0 14px; }
.bwoif-checkout-selector.bwoif-checkout-single { margin-bottom: 0; }
.bwoif-checkout-types { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0 0 12px; }
.bwoif-checkout-type-card {
	appearance: none; width: 100%; border: 1px solid #dfe3e8; border-radius: 14px; background: #fff; padding: 13px 14px;
	display: flex; align-items: center; gap: 10px; color: #20242a; text-align: right; font-family: inherit; cursor: pointer;
	transition: .18s ease;
}
.bwoif-checkout-type-card:hover { border-color: #bcc5cf; }
.bwoif-checkout-type-card.is-active { border-color: var(--bwoif-accent); background: #f2fbfc; box-shadow: 0 0 0 2px rgba(14,165,183,.06); }
.bwoif-checkout-type-card > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.bwoif-checkout-type-card strong { font-size: 13px; color: #20242a; }
.bwoif-checkout-type-card small { font-size: 10px; color: #8a919b; }
.bwoif-checkout-radio { width: 19px; height: 19px; border: 1.5px solid #aeb6c0; border-radius: 50%; flex: 0 0 19px; position: relative; }
.bwoif-checkout-type-card.is-active .bwoif-checkout-radio { border-color: var(--bwoif-accent); }
.bwoif-checkout-type-card.is-active .bwoif-checkout-radio::after { content:""; position:absolute; inset:4px; border-radius:50%; background:var(--bwoif-accent); }

.bwoif-split-notice { direction: rtl; display: flex; align-items: flex-start; gap: 11px; margin: 12px 0; padding: 13px; border: 1px solid #fde2a7; border-radius: 14px; background: #fffbeb; color: #4b5563; }
.bwoif-split-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #f59e0b; color: #fff; font-weight: 900; flex: 0 0 24px; }
.bwoif-split-notice strong { color: #3f3f46; font-size: 12px; }
.bwoif-split-notice p { margin: 4px 0 8px; font-size: 10px; line-height: 1.8; color: #71717a; }
.bwoif-split-notice ul { margin: 0; padding: 0; list-style: none; border-top: 1px solid #f1e5bf; }
.bwoif-split-notice li,.bwoif-split-total { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:7px 0; font-size:11px; border-bottom:1px solid #f1e5bf; }
.bwoif-split-notice li b,.bwoif-split-total strong { color: var(--bwoif-price); white-space: nowrap; }
.bwoif-split-total { border-bottom: 0; font-weight: 800; }
.bwoif-linked-order-info { direction: rtl; padding: 10px 12px; margin: 12px 0; border-radius: 10px; background: #f8fafc; border: 1px solid #e5e7eb; }

/* Keep payment methods visually aligned with the plugin cards without replacing gateway branding. */
.woocommerce-checkout #payment ul.payment_methods { padding: 0 !important; margin: 0 !important; list-style: none !important; }
.woocommerce-checkout #payment ul.payment_methods > li { margin: 0 0 8px !important; padding: 12px 13px !important; border: 1px solid #e2e8f0; border-radius: 13px; background: #fff; }
.woocommerce-checkout #payment ul.payment_methods > li:has(input:checked) { border-color: var(--bwoif-accent); background: #f7fcfd; }
.woocommerce-checkout #payment ul.payment_methods label { font-family: Vazirmatn,IRANSans,Tahoma,sans-serif; }

/* Mobile checkout layout repair, scoped to checkout only. */
@media (max-width: 900px) {
	.woocommerce-checkout .col2-set,
	.woocommerce-checkout #order_review,
	.woocommerce-checkout #customer_details { width: 100% !important; float: none !important; max-width: 100% !important; }
	.woocommerce-checkout .col2-set .col-1,
	.woocommerce-checkout .col2-set .col-2 { width: 100% !important; float: none !important; }
	.woocommerce-checkout .form-row-first,
	.woocommerce-checkout .form-row-last { width: 100% !important; float: none !important; }
}

@media (max-width: 640px) {
	.bwoif-purchase-box { padding: 13px; border-radius: 15px; margin: 14px 0; }
	.bwoif-purchase-types { gap: 8px; }
	.bwoif-type-card { min-height: 76px; padding: 10px 11px !important; }
	.bwoif-type-name { font-size: 13px; }
	.bwoif-type-price { font-size: 13px; }
	.bwoif-installment-panel { padding: 9px; }
	.bwoif-installment-method { grid-template-columns: 1fr !important; gap: 7px !important; padding: 11px !important; }
	.bwoif-method-name { font-size: 12px; padding-bottom: 7px; }
	.bwoif-method-name img { max-width: 58px !important; max-height: 25px !important; }
	.bwoif-method-installments,.bwoif-method-total { min-height: 0; padding: 8px 9px; }
	.bwoif-checkout-types { gap: 8px; }
	.bwoif-checkout-type-card { padding: 11px; }
	.bwoif-split-notice { padding: 11px; }
}

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

/* Terms are relevant only after the customer selects installment; the link
 * lives inside the hidden/unhidden installment panel, never the cash panel. */
.bwoif-purchase-box .bwoif-installment-terms-link {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-height: 36px;
	margin-top: 10px;
	padding: 7px 12px;
	border: 1px solid #d9e3f0;
	border-radius: 10px;
	background: #ffffff;
	color: #245b8d;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.9;
	text-decoration: none;
	white-space: normal;
}
.bwoif-purchase-box .bwoif-installment-terms-link:hover,
.bwoif-purchase-box .bwoif-installment-terms-link:focus-visible {
	border-color: #92badc;
	color: #124c7b;
	background: #f4f9ff;
	text-decoration: none;
}
.bwoif-purchase-box .bwoif-installment-terms-link:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

/* 1.10.7: consistent RTL gateway branding for cash SEP and installment DigiPay.
   Keep icon and name in ONE inner flex child so older cached CSS (which spaced
   direct children apart) cannot separate them across the card. */
.bwoif-purchase-box .bwoif-method-name {
    justify-content: flex-start;
    direction: rtl;
    text-align: right;
}
.bwoif-purchase-box .bwoif-gateway-brand {
    display: inline-flex;
    flex-direction: row;
    direction: rtl;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: auto;
    max-width: 100%;
    min-width: 0;
    text-align: right;
}
.bwoif-purchase-box .bwoif-gateway-title {
    min-width: 0;
    flex: 1 1 auto;
    color: var(--bwoif-text);
    font-weight: 800;
    font-size: 13px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
.bwoif-purchase-box .bwoif-gateway-logo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    min-height: 35px;
    max-width: 78px;
    padding: 4px 6px;
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 10px;
    overflow: hidden;
}
.bwoif-purchase-box .bwoif-gateway-logo img,
.bwoif-purchase-box .bwoif-method-name .bwoif-gateway-logo img {
    display: block !important;
    float: none !important;
    width: auto !important;
    height: auto !important;
    max-width: 62px !important;
    max-height: 26px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    object-fit: contain;
}
.bwoif-purchase-box .bwoif-gateway-logo-fallback {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    min-height: 25px;
    color: #28577d;
    font-weight: 900;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}
.bwoif-purchase-box .bwoif-gateway-logo-fallback.is-sep { color: #0079ae; }
.bwoif-purchase-box .bwoif-gateway-logo-fallback.is-digipay { color: #1743eb; font-family: Arial, sans-serif; }
.bwoif-purchase-box .bwoif-cash-gateway-heading {
    margin-bottom: 10px;
}
.bwoif-purchase-box .bwoif-method-card-cash .bwoif-method-main {
    font-weight: 650;
    font-size: 12px;
    color: #455569;
}
@media (max-width: 640px) {
    .bwoif-purchase-box .bwoif-gateway-logo { min-width: 32px; min-height: 32px; padding: 3px 5px; }
    .bwoif-purchase-box .bwoif-method-name .bwoif-gateway-logo img { max-width: 54px !important; max-height: 23px !important; }
    .bwoif-purchase-box .bwoif-gateway-title { font-size: 12px; }
}
