/* =============================================================================
   BD Smart Checkout — Checkout Widget Styles (T2.23 – T2.25)
   BEM prefix: .bdsc-checkout
   CSS custom properties set by Elementor controls (T2.24):
     --bdsc-col-gap      Column gap between left / right panels
     --bdsc-btn-bg       Button background colour
     --bdsc-btn-color    Button text colour
     --bdsc-btn-hover-bg Button hover background colour
     --bdsc-btn-radius   Button border radius
   Field width set per-element by class modifier (T2.5 / MASTER_PLAN removal #1):
     --bdsc-field-width  Scoped to each .bdsc-checkout__field via modifier class
   ============================================================================= */

/* --- Root defaults ---------------------------------------------------------- */

.bdsc-checkout {
	--bdsc-col-gap:      24px;
	--bdsc-btn-bg:       #2271b1;
	--bdsc-btn-color:    #ffffff;
	--bdsc-btn-hover-bg: #135e96;
	--bdsc-btn-radius:   4px;

	box-sizing: border-box;
}

/* --- Two-column form layout ------------------------------------------------- */

/*
 * display:flex lives on the <form> element (.bdsc-checkout__form) because the
 * left and right columns are its direct children. Putting flex on the outer
 * .bdsc-checkout wrapper would make the <form> a single flex child, meaning
 * the columns inside it would never be flex items and the two-column layout
 * would not work.
 */
.bdsc-checkout__form {
	display: flex;
	gap: var( --bdsc-col-gap );
	align-items: flex-start;
}

/* --- Columns --------------------------------------------------------------- */

.bdsc-checkout__left,
.bdsc-checkout__right {
	flex: 1 1 0;
	min-width: 0; /* prevent flex overflow from long words */
	box-sizing: border-box;
}

.bdsc-checkout__right {
	position: sticky;
	top: 20px;
}

/* --- Field grid ------------------------------------------------------------ */

.bdsc-checkout__fields {
	display: flex;
	flex-wrap: wrap;
	margin-inline: calc( var( --bdsc-col-gap ) / -2 );
}

/*
 * Base field — width driven by the --bdsc-field-width custom property which
 * is scoped to each element by its modifier class below (T2.24, removal #1).
 */
.bdsc-checkout__field {
	width: var( --bdsc-field-width, 100% );
	padding-inline: calc( var( --bdsc-col-gap ) / 2 );
	margin-bottom: 16px;
	box-sizing: border-box;
}

/* Width modifiers — class applied by widget render, never inline style (T2.5) */
.bdsc-checkout__field--w25  { --bdsc-field-width: 25%; }
.bdsc-checkout__field--w50  { --bdsc-field-width: 50%; }
.bdsc-checkout__field--w75  { --bdsc-field-width: 75%; }
.bdsc-checkout__field--w100 { --bdsc-field-width: 100%; }

.bdsc-checkout__field label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	font-size: 0.875em;
	color: #333;
}

.bdsc-checkout__field .bdsc-required {
	color: #d63638;
	margin-inline-start: 2px;
}

.bdsc-checkout__field input,
.bdsc-checkout__field select,
.bdsc-checkout__field textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-size: 0.9375em;
	line-height: 1.4;
	color: #1e1e1e;
	background: #fff;
	box-sizing: border-box;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.bdsc-checkout__field input:focus,
.bdsc-checkout__field select:focus,
.bdsc-checkout__field textarea:focus {
	outline: none;
	border-color: var( --bdsc-btn-bg );
	box-shadow: 0 0 0 2px color-mix( in srgb, var( --bdsc-btn-bg ) 20%, transparent );
}

/* Custom dropdown arrow — removes the native OS arrow and injects a consistent
   chevron SVG so the select matches the text inputs visually. */
.bdsc-checkout__field select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 38px;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px 16px;
	cursor: pointer;
}

.bdsc-checkout__field-error {
	display: block;
	margin-top: 4px;
	font-size: 0.8em;
	color: #d63638;
	min-height: 1em;
}

/* --- Shipping section ------------------------------------------------------- */

.bdsc-checkout__shipping {
	margin-top: 8px;
	padding-top: 16px;
	border-top: 1px solid #e8e8e8;
}

.bdsc-checkout__shipping-label {
	font-weight: 600;
	font-size: 0.875em;
	margin: 0 0 10px;
	color: #333;
}

.bdsc-checkout__shipping-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bdsc-checkout__shipping-item {
	margin-bottom: 8px;
}

.bdsc-checkout__shipping-item label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 0.9375em;
}

.bdsc-checkout__shipping-item input[type="radio"] {
	margin: 0;
	flex-shrink: 0;
	accent-color: var( --bdsc-btn-bg );
}

/* --- Right column — product summary ---------------------------------------- */

.bdsc-checkout__summary {
	background: #f8f8f8;
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	padding: 18px 20px;
	margin-bottom: 16px;
}

/* Hide items list when no product is selected yet */
.bdsc-checkout__summary--empty .bdsc-checkout__items {
	display: none;
}

.bdsc-checkout__no-product {
	margin: 0;
	font-style: italic;
	color: #999;
	text-align: center;
	font-size: 0.9em;
}

/* Hide the placeholder once a product is selected */
.bdsc-checkout__summary:not( .bdsc-checkout__summary--empty ) .bdsc-checkout__no-product {
	display: none;
}

/* --- Items list (multi-product) -------------------------------------------- */

.bdsc-checkout__items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bdsc-checkout__item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 8px 0;
	border-bottom: 1px solid #e8e8e8;
	font-size: 0.9em;
	flex-wrap: wrap;
}

.bdsc-checkout__item:last-child {
	border-bottom: none;
}

/* Name + variation attributes block — grows to fill available space */
.bdsc-checkout__item-info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bdsc-checkout__item-name {
	font-weight: 600;
	color: #1e1e1e;
	word-break: break-word;
}

/* Variation attribute line: "Size: Large, Color: Red" */
.bdsc-checkout__item-attrs {
	display: block;
	font-size: 0.82em;
	color: #777;
	line-height: 1.4;
	word-break: break-word;
}

.bdsc-checkout__item-meta {
	flex-shrink: 0;
	color: #555;
	white-space: nowrap;
}

.bdsc-checkout__item-remove {
	flex-shrink: 0;
	background: none;
	border: 1px solid #d63638;
	border-radius: 3px;
	color: #d63638;
	font-size: 0.75em;
	padding: 2px 7px;
	cursor: pointer;
	line-height: 1.4;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.bdsc-checkout__item-remove:hover,
.bdsc-checkout__item-remove:focus-visible {
	background: #d63638;
	color: #fff;
	outline: none;
}

/* --- Payment Methods ------------------------------------------------------- */

/*
 * Uses WC-standard class names (wc_payment_methods, wc_payment_method,
 * payment_box, input-radio) so any gateway-bundled CSS (bKash, Nagad, etc.)
 * applies automatically without overrides.
 *
 * Scoped to .bdsc-checkout to avoid collisions with the real WC checkout page.
 */

.bdsc-checkout__payment {
	margin-bottom: 16px;
}

.bdsc-checkout__payment-title {
	font-size: 0.875em;
	font-weight: 600;
	color: #333;
	margin: 0 0 10px;
}

/* Gateway list */
.bdsc-checkout .wc_payment_methods {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	overflow: hidden;
}

/* Individual gateway row */
.bdsc-checkout .wc_payment_method {
	padding: 12px 14px;
	border-bottom: 1px solid #e8e8e8;
	background: #fff;
}

.bdsc-checkout .wc_payment_method:last-child {
	border-bottom: none;
}

/* Label row — radio + title + icon */
.bdsc-checkout .wc_payment_method > label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-size: 0.9375em;
	font-weight: 500;
	color: #1e1e1e;
	margin: 0;
	user-select: none;
}

/* Radio button */
.bdsc-checkout .wc_payment_method .input-radio {
	margin: 0;
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	accent-color: var( --bdsc-btn-bg );
	cursor: pointer;
}

/* Gateway icon images (output by gateway->get_icon()) */
.bdsc-checkout .wc_payment_method img {
	height: 24px;
	width: auto;
	max-width: 52px;
	vertical-align: middle;
	display: inline-block;
}

/*
 * payment_box — gateway description / custom fields area (e.g. bKash note,
 * BACS bank details). Shown/hidden by JS (slideDown / slideUp).
 */
.bdsc-checkout .payment_box {
	margin: 10px 0 4px 26px;
	padding: 10px 12px;
	background: #f8f8f8;
	border: 1px solid #e8e8e8;
	border-radius: 4px;
	font-size: 0.875em;
	color: #555;
	line-height: 1.55;
}

.bdsc-checkout .payment_box p {
	margin: 0 0 6px;
}

.bdsc-checkout .payment_box p:last-child {
	margin-bottom: 0;
}

/* Any form elements gateway outputs inside the payment_box (e.g. account input) */
.bdsc-checkout .payment_box input[type="text"],
.bdsc-checkout .payment_box input[type="tel"],
.bdsc-checkout .payment_box input[type="number"],
.bdsc-checkout .payment_box select {
	width: 100%;
	max-width: 320px;
	padding: 8px 12px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-size: 1em;
	margin-top: 6px;
	box-sizing: border-box;
}

/* --- Totals ----------------------------------------------------------------- */

.bdsc-checkout__totals {
	margin-bottom: 16px;
}

.bdsc-checkout__total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 9px 0;
	border-bottom: 1px solid #eee;
	font-size: 0.9375em;
	color: #444;
}

.bdsc-checkout__total:last-child {
	border-bottom: none;
}

.bdsc-checkout__total--grand {
	font-weight: 700;
	font-size: 1.05em;
	color: #1e1e1e;
	padding-top: 12px;
}

/* --- Messages --------------------------------------------------------------- */

.bdsc-checkout__message {
	padding: 11px 15px;
	border-radius: 4px;
	margin-bottom: 12px;
	font-size: 0.9em;
	line-height: 1.5;
}

.bdsc-checkout__message--success {
	background: #d1e7dd;
	color: #0a3622;
	border: 1px solid #badbcc;
}

.bdsc-checkout__message--error {
	background: #f8d7da;
	color: #58151c;
	border: 1px solid #f1aeb5;
}

/* --- Button ----------------------------------------------------------------- */

.bdsc-checkout__btn {
	display: inline-block;
	padding: 13px 22px;
	background: var( --bdsc-btn-bg );
	color: var( --bdsc-btn-color );
	border: none;
	border-radius: var( --bdsc-btn-radius );
	font-size: 1em;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.18s ease, opacity 0.18s ease;
	-webkit-appearance: none;
}

.bdsc-checkout__btn--full {
	display: block;
	width: 100%;
}

.bdsc-checkout__btn:hover:not( :disabled ) {
	background: var( --bdsc-btn-hover-bg );
}

.bdsc-checkout__btn--disabled,
.bdsc-checkout__btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* --- Responsive — single column below 768 px (T2.25) ----------------------- */

@media ( max-width: 767px ) {

	.bdsc-checkout__form {
		flex-direction: column;
	}

	.bdsc-checkout__right {
		position: static;
		width: 100%;
	}

	/* Collapse all partial widths to full width on mobile */
	.bdsc-checkout__field--w25,
	.bdsc-checkout__field--w50,
	.bdsc-checkout__field--w75 {
		--bdsc-field-width: 100%;
	}

	.bdsc-checkout__fields {
		margin-inline: 0;
	}

	.bdsc-checkout__field {
		padding-inline: 0;
	}
}
