/*
 * KC PET SEARCH & RESCUE - SECURE CHECKOUT
 *
 * Every rule is scoped under body.kcpsr-checkout so nothing reaches the rest of
 * the site. The palette below is not invented: each value was sampled from the
 * live KCPSR site before this file was written.
 *
 * GRADIENTS CARRY !important. Elementor lazy-loading ships
 * ".e-con.e-parent:not(.e-lazyloaded) * { background-image: none !important }",
 * which kills every gradient on the page regardless of selector specificity -
 * !important beats specificity. Solid background-colors are unaffected, which
 * is why only the gradient rules need it.
 */

body.kcpsr-checkout {
	--kcpsr-bg:            #0B1220;  /* deep navy-charcoal, already in use */
	--kcpsr-panel-solid:   #141A26;
	--kcpsr-panel-raised:  #1B2230;
	--kcpsr-panel-sunk:    rgba(0, 0, 0, .28);
	--kcpsr-line:          rgba(255, 255, 255, 0.10);
	--kcpsr-line-strong:   rgba(255, 255, 255, 0.20);
	--kcpsr-text:          #FFFFFF;
	--kcpsr-muted:         #C9D6E4;  /* sampled light grey */
	--kcpsr-dim:           #9AA4B2;  /* sampled secondary grey */
	--kcpsr-orange:        #FF7A1A;  /* sampled thermal orange */
	--kcpsr-amber:         #FFB347;  /* sampled thermal amber */
	--kcpsr-yellow:        #FFD35A;  /* sampled thermal yellow */
	--kcpsr-glow:          rgba(255, 138, 0, 0.35);
	--kcpsr-link:          #7DB8FF;
	--kcpsr-radius:        12px;
	--kcpsr-radius-sm:     10px;

	/*
	 * THE COOL END OF THE THERMAL RAMP.
	 *
	 * These are not decorative brand colours picked to add interest. A thermal
	 * image ramps black -> violet -> magenta -> orange -> amber -> yellow ->
	 * white, and the checkout already uses the warm half of exactly that ramp.
	 * Violet and magenta are the two stops immediately BELOW orange, so they
	 * belong to the same physical gradient rather than being imported from
	 * somewhere else. They are used only in the final confirmation card, which
	 * is why the rest of the page stays charcoal + orange/amber.
	 */
	--kcpsr-violet:        #7C4DFF;
	--kcpsr-magenta:       #FF3D8B;
	--kcpsr-magenta-soft:  #FF9CC4;
	--kcpsr-violet-line:   rgba(124, 77, 255, .30);
	--kcpsr-magenta-line:  rgba(255, 61, 139, .22);
}

/*
 * Charcoal ground rather than flat pure black. !important because the theme
 * paints the body black from its own stylesheet; this is scoped to the checkout
 * body class, so no other page is affected.
 */
html body.kcpsr-checkout { background-color: var(--kcpsr-bg) !important; color: var(--kcpsr-text); }
body.kcpsr-checkout .woocommerce { background-color: transparent; }

/* ------------------------------------------------------------------ *
 * NAVIGATION
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .kcpsr-co-nav {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	margin: 0 0 18px; padding: 10px 4px;
	border-bottom: 1px solid var(--kcpsr-line);
}
/*
 * SPECIFICITY NOTE — why [href] is on these selectors.
 *
 * Elementor's lazy-background optimisation ships
 *   .e-con.e-parent:nth-of-type(n+2):not(.e-lazyloaded):not(.e-no-lazyload) *
 *   { background: none !important; }
 * and that trailing universal selector matches every descendant of an
 * unloaded container — including this nav. Its specificity is (0,5,0), so a
 * plain class rule loses no matter how many !importants it carries. Adding the
 * [href] attribute selector lifts this to (0,5,2) and wins honestly.
 */
body.kcpsr-checkout nav.kcpsr-co-nav.kcpsr-co-nav--v2 a.kcpsr-co-nav__btn[href] {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 9px 15px; border-radius: 999px !important;
	background: linear-gradient(180deg, var(--kcpsr-orange), #E9650C) !important;
	color: #16100A !important; font-weight: 800; font-size: 13.5px;
	text-decoration: none !important; border: 1px solid rgba(255,255,255,.14);
	transition: filter .15s ease, transform .15s ease;
}
body.kcpsr-checkout .kcpsr-co-nav__btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
body.kcpsr-checkout nav.kcpsr-co-nav.kcpsr-co-nav--v2 a.kcpsr-co-nav__btn--ghost[href] {
	background: transparent !important; color: var(--kcpsr-muted) !important;
	border: 1px solid var(--kcpsr-line-strong); font-weight: 700;
}
body.kcpsr-checkout .kcpsr-co-nav__btn--ghost:hover { color: #fff; border-color: var(--kcpsr-amber); }
body.kcpsr-checkout .kcpsr-co-nav__btn:focus-visible,
body.kcpsr-checkout a:focus-visible,
body.kcpsr-checkout button:focus-visible,
body.kcpsr-checkout input:focus-visible,
body.kcpsr-checkout select:focus-visible,
body.kcpsr-checkout textarea:focus-visible {
	outline: 2px solid var(--kcpsr-amber); outline-offset: 2px;
}
body.kcpsr-checkout .kcpsr-co-nav__trust {
	margin-left: auto; font-size: 12px; color: var(--kcpsr-dim); letter-spacing: .02em;
}
body.kcpsr-checkout .kcpsr-co-nav__dot { margin: 0 6px; opacity: .5; }

/*
 * One navigation, not two.
 *
 * The page already carries a custom bar (.cnav-in) holding a breadcrumb, a
 * "Secure checkout" line and the card-brand logos. That row is KEPT - the
 * logos are exactly the trust signals worth having, and they are never
 * restyled. Only its Back-to-Cart button is hidden, because this plugin now
 * renders that control, and two of them a few pixels apart is the duplicate
 * navigation the redesign was asked to remove.
 */
body.kcpsr-checkout .return-to-cart,
body.kcpsr-checkout .cnav-in a.cbtn-back { display: none !important; }

/* ------------------------------------------------------------------ *
 * HEADER - tightened. The thermal artwork stays; it just stops owning
 * half the fold.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .entry-content > p > img,
body.kcpsr-checkout .elementor-widget-image img { max-height: 132px; width: auto; }

/* ------------------------------------------------------------------ *
 * TWO-COLUMN LAYOUT - 57 / 43
 *
 * THE RIGHT-COLUMN GAP FIX (0.3.0).
 *
 * Measured on production at 1420px before this release:
 *
 *     grid-template-rows:    0px 1127.47px 1340.7px 0px
 *     #order_review_heading  column 2, top 742, height 16
 *     #order_review          column 2, top 1896
 *
 * a 1138px hole between the heading and the card. The two were SEPARATE grid
 * items, each given `grid-column: 2` but an automatic row. Auto-placement put
 * the heading in the same row as the 1127px-tall billing column, then had
 * nowhere left for #order_review but the following row — which cannot start
 * until the billing column has finished. The grid was behaving correctly; it
 * was being asked to hold two right-hand items in a two-row structure whose
 * first row was sized by the left column.
 *
 * The plugin now wraps both in a single .kcpsr-co-right, so column 2 holds ONE
 * item. Its children stack in a flex column and are no longer subject to the
 * left column's row heights at all.
 * ------------------------------------------------------------------ */
@media (min-width: 981px) {
	body.kcpsr-checkout form.checkout.woocommerce-checkout {
		display: grid;
		grid-template-columns: minmax(0, 57fr) minmax(0, 43fr);
		gap: 26px; align-items: start;
	}
	body.kcpsr-checkout form.checkout > #customer_details { grid-column: 1; margin: 0; }

	body.kcpsr-checkout form.checkout > .kcpsr-co-right {
		grid-column: 2;
		display: flex; flex-direction: column;
		min-width: 0; width: 100%;
	}

	body.kcpsr-checkout form.checkout > .woocommerce-NoticeGroup { grid-column: 1 / -1; }
	body.kcpsr-checkout #customer_details .col-1,
	body.kcpsr-checkout #customer_details .col-2 { float: none; width: 100%; }
	/* Grid items must fill their tracks: WooCommerce floats .col2-set children
	   at ~47% and the theme constrains #order_review, which left the right
	   column 174px wide inside a 522px track. */
	body.kcpsr-checkout form.checkout > #customer_details,
	body.kcpsr-checkout form.checkout > .kcpsr-co-right > #order_review { width: 100% !important; max-width: none !important; float: none !important; }

	/*
	 * FALLBACK — only if the wrapper is absent.
	 *
	 * The wrapper is emitted from WooCommerce's own template actions. If a theme
	 * ever ships a form-checkout.php override that drops them, the heading and
	 * the card become direct children again and the 1138px gap would return.
	 * These rules pin them to explicit rows so that case degrades to "correct
	 * but unwrapped" instead of "broken". Row 2 is `1fr`, which per CSS Grid
	 * §12.5 excludes the row-spanning #customer_details from sizing row 1 —
	 * otherwise the spanning item would inflate row 1 and reopen the gap.
	 */
	body.kcpsr-checkout form.checkout:not(:has(> .kcpsr-co-right)) { grid-template-rows: auto 1fr; }
	body.kcpsr-checkout form.checkout:not(:has(> .kcpsr-co-right)) > #customer_details { grid-row: 1 / span 2; }
	body.kcpsr-checkout form.checkout:not(:has(> .kcpsr-co-right)) > h3#order_review_heading { grid-column: 2; grid-row: 1; }
	body.kcpsr-checkout form.checkout:not(:has(> .kcpsr-co-right)) > #order_review {
		grid-column: 2; grid-row: 2; align-self: start;
		width: 100% !important; max-width: none !important; float: none !important;
	}
}

/* ------------------------------------------------------------------ *
 * CARDS
 * ------------------------------------------------------------------ */
body.kcpsr-checkout #customer_details .col-1,
body.kcpsr-checkout #customer_details .col-2,
body.kcpsr-checkout #order_review {
	background: var(--kcpsr-panel-solid);
	border: 1px solid var(--kcpsr-line);
	border-radius: var(--kcpsr-radius);
	padding: 20px 20px 16px;
	margin-bottom: 18px;
}

body.kcpsr-checkout h3,
body.kcpsr-checkout #order_review_heading {
	font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
	color: var(--kcpsr-amber); margin: 0 0 14px;
}
/* Inside the wrapper the heading is a flex item, so it fills the track and no
   longer needs to fight the theme's width constraint. */
body.kcpsr-checkout .kcpsr-co-right > #order_review_heading { margin: 0 0 12px; width: auto; }

/* ------------------------------------------------------------------ *
 * FORM FIELDS - dark surfaces, generous padding, thermal focus.
 * Autofill is explicitly handled: Chrome paints its own background over
 * inputs, which on a dark field renders unreadable.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .woocommerce form .form-row label,
body.kcpsr-checkout .woocommerce-billing-fields label {
	display: block; margin-bottom: 6px;
	font-size: 13px; font-weight: 600; color: var(--kcpsr-muted);
}
body.kcpsr-checkout .required { color: var(--kcpsr-orange); text-decoration: none; }

body.kcpsr-checkout .woocommerce form .form-row input.input-text,
body.kcpsr-checkout .woocommerce form .form-row textarea,
body.kcpsr-checkout .woocommerce form .form-row select,
body.kcpsr-checkout .select2-container--default .select2-selection--single {
	width: 100%;
	background: var(--kcpsr-panel-raised) !important;
	color: var(--kcpsr-text) !important;
	border: 1px solid var(--kcpsr-line-strong) !important;
	border-radius: var(--kcpsr-radius-sm) !important;
	padding: 13px 14px !important;
	height: auto !important;
	font-size: 15px; line-height: 1.35;
	transition: border-color .15s ease, box-shadow .15s ease;
}
body.kcpsr-checkout .woocommerce form .form-row input.input-text::placeholder,
body.kcpsr-checkout .woocommerce form .form-row textarea::placeholder { color: #8894A5; }

body.kcpsr-checkout .woocommerce form .form-row input.input-text:focus,
body.kcpsr-checkout .woocommerce form .form-row textarea:focus,
body.kcpsr-checkout .woocommerce form .form-row select:focus {
	border-color: var(--kcpsr-amber) !important;
	box-shadow: 0 0 0 3px var(--kcpsr-glow) !important;
	outline: none;
}

/* Chrome autofill would otherwise repaint these fields unreadable. */
body.kcpsr-checkout input:-webkit-autofill,
body.kcpsr-checkout input:-webkit-autofill:hover,
body.kcpsr-checkout input:-webkit-autofill:focus,
body.kcpsr-checkout textarea:-webkit-autofill,
body.kcpsr-checkout select:-webkit-autofill {
	-webkit-text-fill-color: var(--kcpsr-text) !important;
	-webkit-box-shadow: 0 0 0 1000px var(--kcpsr-panel-raised) inset !important;
	caret-color: var(--kcpsr-text);
}

/* Paired fields. Kept above 600px so nothing becomes a narrow sliver. */
@media (min-width: 601px) {
	body.kcpsr-checkout #billing_first_name_field,
	body.kcpsr-checkout #billing_last_name_field,
	body.kcpsr-checkout #billing_city_field,
	body.kcpsr-checkout #billing_state_field { width: 48.5%; float: left; }
	body.kcpsr-checkout #billing_last_name_field,
	body.kcpsr-checkout #billing_state_field { float: right; }
}

/* Order notes: present, functional, visually quieter. */
body.kcpsr-checkout .woocommerce-additional-fields {
	background: rgba(255,255,255,.03);
	border: 1px dashed var(--kcpsr-line-strong);
	border-radius: var(--kcpsr-radius-sm);
	padding: 14px 16px; margin-top: 14px;
}
body.kcpsr-checkout .woocommerce-additional-fields h3 { color: var(--kcpsr-dim); margin-bottom: 8px; }
body.kcpsr-checkout .woocommerce-additional-fields textarea { min-height: 76px; }

/* ------------------------------------------------------------------ *
 * COUPON - a quiet affordance, not a system notice.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .woocommerce-form-coupon-toggle .woocommerce-info {
	background: rgba(255,255,255,.04) !important;
	border: 1px solid var(--kcpsr-line-strong) !important;
	border-left: 3px solid var(--kcpsr-amber) !important;
	border-radius: var(--kcpsr-radius-sm) !important;
	color: var(--kcpsr-muted) !important;
	padding: 12px 15px !important; font-size: 13.5px;
}
body.kcpsr-checkout .woocommerce-form-coupon-toggle .woocommerce-info::before { display: none !important; }
body.kcpsr-checkout .woocommerce-form-coupon-toggle a { color: var(--kcpsr-yellow); font-weight: 700; }
body.kcpsr-checkout form.checkout_coupon {
	background: var(--kcpsr-panel-raised); border: 1px solid var(--kcpsr-line-strong);
	border-radius: var(--kcpsr-radius-sm); padding: 14px 16px;
}

/* ------------------------------------------------------------------ *
 * ORDER SUMMARY
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .woocommerce-checkout-review-order-table {
	width: 100%; border-collapse: collapse; margin-bottom: 6px;
}
body.kcpsr-checkout .woocommerce-checkout-review-order-table th,
body.kcpsr-checkout .woocommerce-checkout-review-order-table td {
	padding: 9px 0; border: 0; border-bottom: 1px solid var(--kcpsr-line);
	font-size: 14px; color: var(--kcpsr-muted); text-align: left;
}
body.kcpsr-checkout .woocommerce-checkout-review-order-table td { text-align: right; color: var(--kcpsr-text); }
body.kcpsr-checkout .woocommerce-checkout-review-order-table thead th {
	font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--kcpsr-dim);
}
body.kcpsr-checkout .cart-discount th,
body.kcpsr-checkout .cart-discount td { color: var(--kcpsr-yellow) !important; font-weight: 700; }
body.kcpsr-checkout .order-total th,
body.kcpsr-checkout .order-total td {
	border-bottom: 0; padding-top: 14px;
	font-size: 20px; font-weight: 800; color: var(--kcpsr-text) !important;
}
body.kcpsr-checkout .order-total td .amount { font-size: 26px; color: var(--kcpsr-amber) !important; }
body.kcpsr-checkout .order-total th { letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }

/* ------------------------------------------------------------------ *
 * PAYMENT ACCORDION
 *
 * THE VERTICAL WALL FIX. All three panels were rendering at once because an
 * !important rule in a cross-origin stylesheet beat WooCommerce's inline
 * display:none. Visibility is keyed to the RADIO'S OWN :checked state, so
 * WooCommerce and WooPayments remain the only things deciding what is
 * selected - there is no parallel selector and no JS toggling here.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout ul.wc_payment_methods { list-style: none; margin: 0; padding: 0; }

body.kcpsr-checkout ul.wc_payment_methods li.wc_payment_method {
	background: var(--kcpsr-panel-raised);
	border: 1px solid var(--kcpsr-line-strong);
	border-radius: var(--kcpsr-radius);
	margin: 0 0 10px; padding: 12px 14px;
	transition: border-color .15s ease, background .15s ease;
}
body.kcpsr-checkout ul.wc_payment_methods li.wc_payment_method:hover { border-color: rgba(255,179,71,.45); }

body.kcpsr-checkout ul.wc_payment_methods li.wc_payment_method > label {
	display: flex; align-items: center; gap: 10px;
	font-size: 15px; font-weight: 700; color: var(--kcpsr-text); margin: 0; cursor: pointer;
}
body.kcpsr-checkout ul.wc_payment_methods li.wc_payment_method > label img {
	margin-left: auto; max-height: 24px; width: auto;
}
body.kcpsr-checkout ul.wc_payment_methods input[type="radio"] { accent-color: var(--kcpsr-orange); width: 17px; height: 17px; }

/* Selected: thermal accent, raised. Unselected stays compact. */
body.kcpsr-checkout ul.wc_payment_methods li.wc_payment_method.kcpsr-selected {
	border-color: var(--kcpsr-orange);
	background: linear-gradient(180deg, rgba(255,122,26,.09), rgba(255,122,26,.02)) !important;
	box-shadow: 0 0 0 1px rgba(255,122,26,.25);
}

/*
 * SPECIFICITY NOTE — why these selectors carry #payment.
 *
 * An inline <style> block on the checkout page (pre-existing, not shipped by
 * this plugin) contains:
 *
 *   .woocommerce-checkout #payment .payment_box { display: block !important; }
 *   .woocommerce-checkout #payment .payment_method_woocommerce_payments { display: block !important; }
 *
 * That is what forced all three panels open at once. Because it carries an ID
 * and !important, a class-only rule cannot beat it however many classes it
 * stacks. Including #payment here raises this rule above it honestly, rather
 * than resorting to a JS toggle that would fight WooCommerce for control of
 * payment state.
 *
 * The inline block should be removed at source when someone can find where it
 * is authored (Customizer / Elementor custom CSS / a snippet). Until then this
 * override is the safe correction.
 */
body.kcpsr-checkout #payment ul.wc_payment_methods li.wc_payment_method > .payment_box { display: none !important; }
body.kcpsr-checkout #payment ul.wc_payment_methods li.wc_payment_method input[name="payment_method"]:checked ~ .payment_box {
	display: block !important;
	margin: 12px 0 2px; padding: 14px;
	background: rgba(0,0,0,.28);
	border: 1px solid var(--kcpsr-line);
	border-radius: var(--kcpsr-radius-sm);
}
body.kcpsr-checkout .payment_box::before { display: none !important; }

/*
 * THE CONTRAST FIX - carried forward from 0.1.0 and still the reason the
 * iframe text is legible. WooPayments samples this colour to build Stripe's
 * appearance; correcting it here is what changes what renders INSIDE the
 * cross-origin frame. Do not remove.
 */
body.kcpsr-checkout #payment div.payment_box[class*="payment_method_woocommerce_payments"],
body.kcpsr-checkout #payment div.payment_box[class*="payment_method_woocommerce_payments"] .wcpay-upe-form,
body.kcpsr-checkout #payment div.payment_box[class*="payment_method_woocommerce_payments"] fieldset.wc-payment-form {
	color: #ffffff;
}

/* ------------------------------------------------------------------ *
 * BNPL SUMMARY BLOCKS
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .kcpsr-bnpl {
	margin: 0 0 12px; padding: 14px 16px;
	border: 1px solid rgba(255,179,71,.32);
	border-radius: var(--kcpsr-radius-sm);
	background: linear-gradient(180deg, rgba(255,179,71,.08), rgba(255,179,71,.02)) !important;
	line-height: 1.45;
}
body.kcpsr-checkout .kcpsr-bnpl__eyebrow {
	margin: 0 0 2px; font-size: 11px; font-weight: 800;
	letter-spacing: .11em; text-transform: uppercase; color: var(--kcpsr-amber);
}
body.kcpsr-checkout .kcpsr-bnpl__amount {
	margin: 2px 0 4px; font-size: clamp(26px, 5.6vw, 33px); font-weight: 800;
	line-height: 1.08; color: #fff; font-variant-numeric: tabular-nums;
}
body.kcpsr-checkout .kcpsr-bnpl__qualifier { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #fff; }
body.kcpsr-checkout .kcpsr-bnpl__detail { margin: 0 0 5px; font-size: 13px; color: var(--kcpsr-muted); }
body.kcpsr-checkout .kcpsr-bnpl__headline {
	margin: 2px 0 6px; font-size: clamp(16px, 3.2vw, 19px); font-weight: 800; line-height: 1.25; color: #fff;
}
body.kcpsr-checkout .kcpsr-bnpl__total {
	margin: 9px 0 0; padding-top: 9px; border-top: 1px solid var(--kcpsr-line-strong);
	font-size: 13.5px; color: #fff;
}
body.kcpsr-checkout .kcpsr-bnpl a { color: var(--kcpsr-link); text-decoration: underline; }
/* Provider marks are never restyled. */
body.kcpsr-checkout .kcpsr-bnpl img, body.kcpsr-checkout .kcpsr-bnpl svg { filter: none !important; }

/* ================================================================== *
 * FINAL CONFIRMATION CARD  (0.3.0)
 *
 * .form-row.place-order is WooCommerce's own container for everything after
 * the order summary: privacy notice, terms box, terms checkbox, any extra
 * acknowledgement checkbox, the cancellation-policy panel, the button. It is
 * already the right box — it simply had no styling and, worse, two uncleared
 * floats inside it.
 *
 * THE TWO FLOATS, both measured on production before this release:
 *
 *   #place_order            computed float: right
 *       The trust row is inserted immediately after the button. Beside a
 *       full-width right float there is no room left on the line, so the flex
 *       container resolved to WIDTH 0 and each label wrapped onto its own line
 *       — three items measured 46px, 53px and 46px wide at three different
 *       vertical positions. That is the "weak vertical stack floating off to
 *       the side of the button".
 *
 *   .form-row.terms         computed float: left
 *       The acknowledgement checkbox row floats and the cancellation-policy
 *       panel that follows it does not clear, so the panel slid UNDER the
 *       checkbox: row top 3045 + height 58 = 3103, panel top 3061, a 42px
 *       overlap. That is the "crowded and awkward jammed line above a white
 *       box".
 *
 * Making .place-order a flex column fixes both at the source rather than
 * papering over them: float is ignored on flex items, so neither element can
 * float and nothing needs clearing. It also gives the section a real container
 * to be styled as one confirmation card.
 * ================================================================== */
/*
 * SPECIFICITY NOTE — why the card selector carries #payment.
 *
 * Measured after the first 0.3.0 deploy: display:flex and the border applied,
 * but padding computed to the theme's `25px 0 0` and background-image computed
 * to `none`. Two different losses, both honest:
 *
 *   padding    the theme ships `#payment .form-row.place-order { padding: 25px 0 0 }`
 *              at (1,2,0), which beats a plain (0,3,1) class rule.
 *   gradient   Elementor's lazy-background rule
 *              `.e-con.e-parent…:not(.e-lazyloaded) * { background-image: none !important }`
 *              is (0,5,0) WITH !important. Between two !important declarations
 *              the more specific one wins, so !important alone was never going
 *              to be enough here.
 *
 * .place-order only ever exists inside #payment in WooCommerce's payment.php,
 * so adding the ID is accurate rather than defensive padding. It lifts this to
 * (1,4,1), and an id outranks any number of classes — this wins both contests
 * on specificity instead of escalating !important further.
 */
body.kcpsr-checkout .form-row.place-order,
body.kcpsr-checkout #payment .form-row.place-order {
	display: flex; flex-direction: column;
	margin: 18px 0 6px; padding: 16px 18px 18px;
	background: linear-gradient(180deg, rgba(124,77,255,.10), rgba(255,61,139,.05) 42%, rgba(255,255,255,.02) 100%) !important;
	border: 1px solid var(--kcpsr-violet-line);
	border-radius: var(--kcpsr-radius);
	box-shadow: 0 0 0 1px var(--kcpsr-magenta-line), 0 12px 30px rgba(0,0,0,.30);
}

/* Section label. Generated content so no markup is added and nothing in
   WooCommerce's DOM has to move. */
body.kcpsr-checkout .form-row.place-order::before,
body.kcpsr-checkout #payment .form-row.place-order::before {
	content: "Secure checkout";
	display: block; margin: 0 0 12px; padding: 0 0 10px;
	font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
	color: var(--kcpsr-magenta-soft);
	border-bottom: 1px solid var(--kcpsr-violet-line);
}

/* Neutralise the floats explicitly as well as structurally, so the intent is
   readable and a future change of display cannot silently reintroduce them. */
body.kcpsr-checkout .form-row.place-order > *,
body.kcpsr-checkout .form-row.place-order #place_order { float: none !important; }

/* ---- The two acknowledgement rows -------------------------------- */
body.kcpsr-checkout .woocommerce-terms-and-conditions-wrapper,
body.kcpsr-checkout .form-row.place-order > p.form-row {
	background: rgba(255,255,255,.035);
	border: 1px solid var(--kcpsr-line-strong);
	border-radius: var(--kcpsr-radius-sm);
	padding: 13px 15px;
	margin: 0 0 12px;
	width: 100% !important;
}

/*
 * Each checkbox becomes a hanging-indent row: control in the left gutter, the
 * sentence flowing normally beside it.
 *
 * NOT flex, and that is the whole point. 0.3.1 used `display:flex` on the
 * label and it broke the second acknowledgement, because flex makes every
 * child - INCLUDING each bare text node - its own flex item. The cat-recovery
 * label's children were measured as:
 *
 *     INPUT.input-checkbox | TEXT "I acknowledge and agree to the"
 *     A "Limited-Scope ..." | TEXT "." | SPAN.required
 *
 * i.e. five items, so the sentence was chopped into columns and the trailing
 * "." and "*" were flung to the far right. WooCommerce's own terms label
 * happened to survive only because it wraps its text in a single
 * <span class="woocommerce-terms-and-conditions-checkbox-text">.
 *
 * Absolute-positioning the checkbox inside a padded block keeps all the inline
 * content in one normal text flow, so any label shape wraps correctly -
 * including labels this plugin does not control, which is the case that
 * matters since the second one comes from a site Code Snippet.
 */
body.kcpsr-checkout .woocommerce-terms-and-conditions-wrapper label,
body.kcpsr-checkout .form-row.place-order > p.form-row label,
body.kcpsr-checkout #payment .form-row.place-order > p.form-row label {
	display: block; position: relative;
	padding-left: 29px; margin: 0; cursor: pointer;
	font-size: 13.5px; line-height: 1.55; font-weight: 500;
	color: var(--kcpsr-text);
}
body.kcpsr-checkout .woocommerce-terms-and-conditions-wrapper label input[type="checkbox"],
body.kcpsr-checkout .form-row.place-order > p.form-row label input[type="checkbox"],
body.kcpsr-checkout #payment .form-row.place-order > p.form-row label input[type="checkbox"] {
	position: absolute; left: 0; top: 2px;
	width: 18px; height: 18px; margin: 0;
	accent-color: var(--kcpsr-magenta); cursor: pointer;
}
body.kcpsr-checkout .woocommerce-terms-and-conditions-checkbox-text { color: var(--kcpsr-text); font-size: 13.5px; }
body.kcpsr-checkout .form-row.place-order .required,
body.kcpsr-checkout .form-row.place-order abbr.required {
	color: var(--kcpsr-magenta) !important; text-decoration: none; border: 0; font-weight: 800;
}
body.kcpsr-checkout .woocommerce-terms-and-conditions-wrapper a,
body.kcpsr-checkout .form-row.place-order > p.form-row a {
	color: var(--kcpsr-magenta-soft); text-decoration: underline; text-underline-offset: 2px;
}
body.kcpsr-checkout .woocommerce-terms-and-conditions-wrapper a:hover,
body.kcpsr-checkout .form-row.place-order > p.form-row a:hover { color: #fff; }
/* Validation state stays visible against the new panel. */
body.kcpsr-checkout .form-row.place-order .woocommerce-invalid input[type="checkbox"] { outline: 2px solid var(--kcpsr-orange); outline-offset: 2px; }

/* ---- Privacy notice + WooCommerce's own inline terms box ---------- */
body.kcpsr-checkout .woocommerce-privacy-policy-text {
	background: transparent; border: 0; border-radius: 0;
	padding: 0; margin: 0 0 12px;
}
body.kcpsr-checkout .woocommerce-privacy-policy-text p { font-size: 12.5px; color: var(--kcpsr-dim); margin: 0 0 8px; line-height: 1.55; }
body.kcpsr-checkout .woocommerce-privacy-policy-text a { color: var(--kcpsr-link); }

body.kcpsr-checkout .woocommerce-terms-and-conditions {
	background: var(--kcpsr-panel-sunk) !important;
	border: 1px solid var(--kcpsr-line) !important;
	border-radius: var(--kcpsr-radius-sm) !important;
	box-shadow: none !important;
	padding: 14px 16px !important;
	margin: 0 0 12px !important;
	max-height: 220px; overflow-y: auto;
}
body.kcpsr-checkout .woocommerce-terms-and-conditions h2,
body.kcpsr-checkout .woocommerce-terms-and-conditions h3,
body.kcpsr-checkout .woocommerce-terms-and-conditions h4 {
	color: var(--kcpsr-amber); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 12px 0 6px;
}
body.kcpsr-checkout .woocommerce-terms-and-conditions p,
body.kcpsr-checkout .woocommerce-terms-and-conditions li { color: var(--kcpsr-muted); font-size: 13px; line-height: 1.55; }

/* ---- The agreement / cancellation-policy panel -------------------- *
 *
 * This is the white rectangle. It is emitted by a site Code Snippet on
 * woocommerce_review_order_before_submit with its colours written as INLINE
 * style attributes:
 *
 *     <div class="kcav-cancellation-policy"
 *          style="… border:1px solid #d9d9d9; background:#fafafa; color:#000;">
 *
 * and every <p>, <li> and <strong> inside it carries its own inline
 * `color:#000`. An inline declaration outranks any external stylesheet rule
 * regardless of selector specificity, so !important is not decoration here —
 * it is the only thing that can win. The snippet itself is deliberately NOT
 * edited: this plugin is presentation, and the legal wording, the amounts and
 * the rate-aware logic stay exactly where they are maintained.
 *
 * Legal content is neither hidden nor shortened. The panel is given the same
 * bounded scroll WooCommerce already uses for its own terms box (220px) so a
 * 303px policy cannot dominate the confirmation card.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .kcav-cancellation-policy,
body.kcpsr-checkout .kcpsr-cancellation-policy,
body.kcpsr-checkout .kcpsr-action-refund {
	background: var(--kcpsr-panel-sunk) !important;
	border: 1px solid var(--kcpsr-violet-line) !important;
	border-radius: var(--kcpsr-radius-sm) !important;
	box-shadow: none !important;
	color: var(--kcpsr-muted) !important;
	padding: 15px 17px !important;
	margin: 0 0 14px !important;
	font-size: 13px !important;
	line-height: 1.6 !important;
	max-height: 240px; overflow-y: auto;
}
/* The inline color:#000 is on the descendants too, so they each need answering. */
body.kcpsr-checkout .kcav-cancellation-policy *,
body.kcpsr-checkout .kcpsr-cancellation-policy *,
body.kcpsr-checkout .kcpsr-action-refund * { color: var(--kcpsr-muted) !important; }
body.kcpsr-checkout .kcav-cancellation-policy strong,
body.kcpsr-checkout .kcpsr-cancellation-policy strong,
body.kcpsr-checkout .kcpsr-action-refund strong { color: var(--kcpsr-text) !important; font-weight: 700; }
/* The snippet's leading <strong> is the panel's title. */
body.kcpsr-checkout .kcav-cancellation-policy > strong:first-child,
body.kcpsr-checkout .kcpsr-cancellation-policy > strong:first-child,
body.kcpsr-checkout .kcpsr-action-refund > strong:first-child {
	color: var(--kcpsr-magenta-soft) !important;
	font-size: 11.5px !important; font-weight: 800;
	letter-spacing: .12em; text-transform: uppercase;
	margin: 0 0 10px !important; padding-bottom: 8px;
	border-bottom: 1px solid var(--kcpsr-violet-line);
}
body.kcpsr-checkout .kcav-cancellation-policy ul,
body.kcpsr-checkout .kcpsr-cancellation-policy ul,
body.kcpsr-checkout .kcpsr-action-refund ul { margin: 0 0 10px 18px !important; padding: 0 !important; list-style: disc; }
body.kcpsr-checkout .kcav-cancellation-policy li::marker,
body.kcpsr-checkout .kcpsr-cancellation-policy li::marker,
body.kcpsr-checkout .kcpsr-action-refund li::marker { color: var(--kcpsr-violet); }
body.kcpsr-checkout .kcav-cancellation-policy a,
body.kcpsr-checkout .kcpsr-cancellation-policy a,
body.kcpsr-checkout .kcpsr-action-refund a { color: var(--kcpsr-magenta-soft) !important; text-decoration: underline; }

/* Scrollbars on the dark bounded panels, so they read as intentional. */
body.kcpsr-checkout .woocommerce-terms-and-conditions,
body.kcpsr-checkout .kcav-cancellation-policy,
body.kcpsr-checkout .kcpsr-cancellation-policy,
body.kcpsr-checkout .kcpsr-action-refund { scrollbar-width: thin; scrollbar-color: var(--kcpsr-violet) transparent; }
body.kcpsr-checkout .woocommerce-terms-and-conditions::-webkit-scrollbar,
body.kcpsr-checkout .kcav-cancellation-policy::-webkit-scrollbar,
body.kcpsr-checkout .kcpsr-cancellation-policy::-webkit-scrollbar,
body.kcpsr-checkout .kcpsr-action-refund::-webkit-scrollbar { width: 8px; }
body.kcpsr-checkout .woocommerce-terms-and-conditions::-webkit-scrollbar-thumb,
body.kcpsr-checkout .kcav-cancellation-policy::-webkit-scrollbar-thumb,
body.kcpsr-checkout .kcpsr-cancellation-policy::-webkit-scrollbar-thumb,
body.kcpsr-checkout .kcpsr-action-refund::-webkit-scrollbar-thumb {
	background: rgba(124,77,255,.55); border-radius: 999px;
}

/* ---- Place Order ------------------------------------------------- *
 * The label reads PLACE ORDER through text-transform. The button's `value`
 * attribute is left exactly as WooCommerce and the gateways expect it —
 * appearance is not worth a payment-compatibility risk.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout #place_order {
	display: block; width: 100%; min-height: 56px;
	margin: 6px 0 0; padding: 15px 20px;
	border: 0; border-radius: var(--kcpsr-radius);
	background: linear-gradient(180deg, var(--kcpsr-orange), #E0600A) !important;
	color: #16100A; font-size: 16px; font-weight: 900;
	letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
	box-shadow: 0 6px 18px rgba(255,122,26,.22);
	transition: filter .15s ease, transform .12s ease, box-shadow .15s ease;
}
body.kcpsr-checkout #place_order:hover { filter: brightness(1.07); box-shadow: 0 8px 22px rgba(255,122,26,.3); }
body.kcpsr-checkout #place_order:active { transform: translateY(1px); box-shadow: 0 3px 12px rgba(255,122,26,.24); }

/* ---- Trust signals ----------------------------------------------- *
 * A three-up row inside the card, below the CTA. Plain descriptive labels —
 * these are statements about how the checkout works, not certification marks,
 * and no badge or seal is implied.
 * ------------------------------------------------------------------ */
body.kcpsr-checkout .kcpsr-co-trust {
	/* auto columns, not three equal thirds: an equal-thirds track forced
	   "Multiple payment options" onto a second line while the other two sat on
	   one, which read as a broken row. Content-sized tracks measured
	   102 + 121 + 150 = 373px inside 444px, so all three fit on one line. */
	display: grid; grid-template-columns: repeat(3, auto);
	justify-content: space-between;
	gap: 6px 10px; width: 100%;
	margin: 14px 0 0; padding: 13px 0 0;
	border-top: 1px solid var(--kcpsr-violet-line);
	font-size: 11.5px; color: var(--kcpsr-dim);
}
body.kcpsr-checkout .kcpsr-co-trust__item {
	display: flex; align-items: center; justify-content: center; gap: 6px;
	text-align: center; line-height: 1.3;
}
body.kcpsr-checkout .kcpsr-co-trust__icon {
	flex: 0 0 auto; width: 14px; height: 14px; color: var(--kcpsr-magenta);
}
body.kcpsr-checkout .kcpsr-co-trust__icon svg { width: 100%; height: 100%; display: block; }

/* Sticky right column. The JS removes this class whenever the column is taller
   than the viewport, so Place Order can never be pushed out of reach. */
@media (min-width: 981px) {
	body.kcpsr-checkout.kcpsr-sticky-ok form.checkout > .kcpsr-co-right { position: sticky; top: 18px; }
	body.kcpsr-checkout.kcpsr-sticky-ok form.checkout > #order_review { position: sticky; top: 18px; }
}

/* ------------------------------------------------------------------ *
 * MOBILE - single column, full width, nothing side by side.
 * ------------------------------------------------------------------ */
@media (max-width: 980px) {
	body.kcpsr-checkout #customer_details .col-1,
	body.kcpsr-checkout #customer_details .col-2,
	body.kcpsr-checkout #order_review { padding: 16px 15px; }
	body.kcpsr-checkout .kcpsr-co-nav__trust { margin-left: 0; width: 100%; }
}
@media (max-width: 600px) {
	body.kcpsr-checkout #billing_first_name_field,
	body.kcpsr-checkout #billing_last_name_field,
	body.kcpsr-checkout #billing_city_field,
	body.kcpsr-checkout #billing_state_field { width: 100%; float: none; }
	body.kcpsr-checkout .order-total td .amount { font-size: 23px; }
	body.kcpsr-checkout #place_order { font-size: 15px; }
	body.kcpsr-checkout .form-row.place-order { padding: 14px 14px 16px; }
	/* A neat vertical stack rather than three cramped columns. */
	body.kcpsr-checkout .kcpsr-co-trust { grid-template-columns: 1fr; justify-content: start; gap: 9px; }
	body.kcpsr-checkout .kcpsr-co-trust__item { justify-content: flex-start; text-align: left; }
}
body.kcpsr-checkout { overflow-x: hidden; }

@media (prefers-reduced-motion: reduce) {
	body.kcpsr-checkout * { transition: none !important; }
}
