/*
 * EDD Checkout Block: keeps the shortcode checkout's look (core.css "EDD Checkout")
 * on the block's markup, plus the 2026-11 design fixes. Loaded only on pages with
 * the block (inc/checkout-block.php). Layout breakpoint matches core-responsive.css.
 *
 * Selectors start with #edd_checkout_form_wrap.edd-blocks__checkout (and another
 * ID where needed) so they outrank EDD's block styles, which use
 * ".wp-block-edd-checkout #edd_purchase_form ..." and ".edd-blocks-form__cart #edd_checkout_cart".
 */

/* ---------- Layout: form on the left, grey cart panel on the right ---------- */

body.edd-checkout .inside-article {
	position: relative;
	background: linear-gradient(90deg, rgb(255, 255, 255) 68%, rgb(250, 250, 250) 70%);
}

/* Empty cart: the block prints only a message, so drop the split background (it left an empty grey strip). */
body.edd-checkout .inside-article:not(:has(.edd-blocks__checkout)) {
	background: #fff;
}

#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-columns {
	display: block;
	margin: 0;
}

#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-main {
	flex-basis: auto !important;
	width: 100%;
	display: flex;
	flex-direction: column;
}

#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-side {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 40%;
	margin: 0;
	padding: 35px 150px 0 50px;
	background-color: #f9f9f9;
	border-left: 1px solid #e1e1e1;
	color: #000;
}

/* The old rule pins the shortcode's cart form to the page edge; in the block it lives in the panel. */
#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart_form {
	position: static;
	width: auto;
	top: auto;
	bottom: auto;
	padding: 0;
	background: transparent;
	border: 0;
}

/* ---------- Cart ---------- */

#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-items-heading {
	margin: 12px 0 20px;
	padding-bottom: 10px;
	border-bottom: 1px solid #ccc;
	font-family: inherit;
	font-size: 20px;
	font-weight: bold;
	text-transform: none;
	letter-spacing: 0;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart {
	display: block;
	border: 0;
	background: transparent;
	padding: 0;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__items {
	border: 0;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__row-item {
	display: grid;
	grid-template-columns: 1fr auto;
	column-gap: 16px;
	row-gap: 6px;
	align-items: baseline;
	padding: 0 0 20px;
	border: 0;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__row-item .edd_cart_item_name {
	display: block;
	grid-column: 1;
	grid-row: 1;
	padding: 0 !important;
}

/* Price on the right of the item name, Remove link under the name. */
#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__row-item .edd_cart_item_price {
	display: contents;
	font-size: 16px;
	color: #444;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__row-item .edd_cart_actions {
	display: block;
	grid-column: 1;
	grid-row: 2;
	text-align: left; /* EDD right-aligns the row's last cell, which this sits in. */
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd_checkout_cart_item_title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: bold;
	color: #000;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .eddr-cart-item-notice {
	margin: 4px 0 0;
	font-size: 14px;
	color: #555;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart a.edd-blocks-cart__action-remove {
	display: inline;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0;
	background: none;
	opacity: 1;
	color: #000;
	font-size: 14px;
	text-decoration: underline;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart a.edd-blocks-cart__action-remove svg {
	display: none;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart a.edd-blocks-cart__action-remove .screen-reader-text {
	position: static !important;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	overflow: visible !important;
	clip: auto !important;
	clip-path: none !important;
	white-space: normal !important;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__row-footer {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 12px;
	padding: 0;
	border: 0;
	text-align: left;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__row-footer > div {
	flex: none;
	text-align: left;
}

/* Discount: a plain text link above the total. */
#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd-blocks-cart__discount {
	order: 1;
	width: 100%;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart button.edd_discount_link {
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: #000;
	font-size: 15px;
	font-weight: normal;
	text-decoration: underline;
	cursor: pointer;
	transform: none;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd_cart_total {
	order: 2;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	width: 100%;
	margin: 0 !important;
	padding: 12px 0 !important;
	border-top: 1px solid #ccc !important;
	border-bottom: 1px solid #ccc;
	color: #000 !important;
	font-size: 20px;
	font-weight: bold;
	text-align: left !important;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_checkout_cart .edd_cart_total .edd_cart_amount {
	float: none;
	margin-left: auto;
}

/* Renewals: a small link instead of a full-width black bar. */
#edd_checkout_form_wrap.edd-blocks__checkout .edd-renewal-form--legacy,
#edd_checkout_form_wrap.edd-blocks__checkout .edd-sl-license-renewal-block {
	margin: 18px 0 0;
	padding: 0;
	border: 0;
}

#edd_checkout_form_wrap.edd-blocks__checkout .edd-sl-show-renewal-form.edd-submit.button {
	width: auto;
	margin: 0;
	padding: 0;
	border: 0 !important;
	background: none !important;
	box-shadow: none;
	color: #000 !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: normal;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: underline;
	transform: none;
}

/* The opened renewal form: label above the field (not a floating label), no box. */
#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form .edd-sl-renewal-form-fields .edd-blocks-form {
	display: block;
	margin: 0;
	padding: 14px 0 0;
	border: 0;
	background: transparent;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form .edd-sl-renewal-form-fields .edd-license-key-container > label {
	position: static;
	display: block;
	margin: 0 0 6px !important;
	color: #333;
	font-size: 14px;
	font-weight: normal;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form .edd-sl-renewal-form-fields input.edd-input {
	width: 100%;
	padding: 0.8rem 1rem;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form .edd-sl-renewal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form .edd-sl-renewal-actions .button {
	width: auto;
	margin: 0;
	padding: 10px 16px;
	font-size: 14px;
	letter-spacing: 0;
	white-space: nowrap;
}

#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-whys {
	margin-top: 40px;
}

/* ---------- Form fields ---------- */

/* Billing country + ZIP: two floating-label fields side by side, no box around them. */
#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 4%;
	row-gap: 15px;
	margin: 0 0 25px;
	padding: 0;
	border: 0;
	background: transparent;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address .edd-blocks-form__group {
	position: relative;
	grid-column: auto;
	width: auto !important;
	margin: 0 !important;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address .edd-blocks-form__group > label {
	position: absolute;
	top: 0;
	left: 0;
	margin: 8px 0 0 17px !important;
	font-size: 13px;
	font-weight: normal;
	color: #515151;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address select,
#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address input.edd-input {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	padding: 28px 1rem 0.825rem;
	border: 1px solid #d9d9d9;
	border-radius: 5px;
	background-color: transparent;
	font-size: 0.95rem;
	line-height: normal;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address select {
	padding-right: 2.5rem;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 0.8rem center;
	background-size: 1em;
	-webkit-appearance: none;
	appearance: none;
}

/* "Are you from an Agency?": keep Yes / No on one line. */
#edd_checkout_form_wrap.edd-blocks__checkout ul.cfm-checkbox-checklist li label {
	white-space: nowrap;
}

/* Payment method pills, as in the shortcode checkout (radio visible, light grey). */
#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd-payment-mode-wrap {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 15px;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd-payment-mode-wrap label.edd-gateway-option {
	flex: 0 0 auto;
	justify-content: flex-start;
	gap: 10px;
	width: auto;
	margin: 0 !important;
	padding: 15px 20px;
	border: 1px solid transparent;
	border-radius: 8px;
	background-color: #f7f7f7;
	color: #000;
	font-size: 15px;
	white-space: nowrap;
	transform: none;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd-payment-mode-wrap label.edd-gateway-option-selected {
	border-color: #000;
}

#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd-payment-mode-wrap input.edd-gateway {
	position: static;
	opacity: 1;
	width: 18px;
	height: 18px;
	margin: 0;
}

/* ---------- Agreement and purchase button ---------- */

/* One checkbox with linked Terms and Privacy Policy (label set in EDD settings); the long terms box is not shown. */
.edd-checkout #edd_show_terms,
.edd-checkout #edd_terms {
	display: none !important;
}

.edd-checkout #edd_purchase_submit label a {
	color: #000;
	text-decoration: underline;
}

/* Stripe keeps the button disabled until the card details are complete. Keep it
   looking like the real button and say what's missing, instead of a faded grey. */
.edd-checkout #edd-purchase-button[disabled] {
	opacity: 1 !important;
	background-color: #000 !important;
	color: #fff !important;
	cursor: not-allowed;
}

.edd-checkout #edd_purchase_submit:has(#edd-purchase-button[data-edd-button-state="disabled"])::after {
	content: "Enter your card details above to continue.";
	display: block;
	order: 7;
	margin-top: 10px;
	color: #555;
	font-size: 14px;
	text-align: center;
}

/* ---------- Tablet and mobile ---------- */

@media (max-width: 890px) {
	/* No grey split background once the columns stack (it showed as a band down the right). */
	body.edd-checkout .inside-article,
	body.page-checkout .inside-article {
		background: #fff;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout {
		display: block;
		width: 100%;
	}

	/* Order on small screens: items and total first, then the form, then the trust column. */
	#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-columns {
		display: flex;
		flex-direction: column;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-side {
		display: contents;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-items-heading {
		order: 1;
		margin-top: 0;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-side .edd-blocks__cart {
		order: 2;
		margin-bottom: 30px;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-main {
		order: 3;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout .tribe-checkout-whys {
		order: 4;
		margin-top: 40px;
	}
}

@media (max-width: 767px) {
	#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd_cc_address {
		grid-template-columns: 1fr;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd-payment-mode-wrap label.edd-gateway-option {
		flex: 1 1 0;
	}

	#edd_checkout_form_wrap.edd-blocks__checkout #edd_purchase_form #edd-payment-mode-wrap .edd-payment-icons {
		display: none;
	}
}
