/**
 * lavtheme — EDD purchase-flow styling (checkout, cart, receipt, purchase
 * history, confirmation, failed transaction). EDD ships its own minimal markup
 * with no theme integration; this maps EDD's legacy (shortcode) + block classes
 * onto the theme's Liquid-Glass tokens so the buy flow matches the rest of the
 * site. Scoped to EDD's own IDs/classes — never bleeds into other content.
 * Enqueued only on EDD pages via lavtheme_is_edd_flow() in inc/enqueue.php.
 */

/* Dark UA form controls (date/select pickers, autofill) on these pages. */
#edd_checkout_wrap,
.edd_purchase_history,
#edd_purchase_receipt,
.edd-blocks-cart,
.wp-block-edd-checkout { color-scheme: dark; }

/* ---------- layout (centred, focused single column) ---------- */
#edd_checkout_wrap { display: flex; flex-direction: column; gap: var(--s5); max-width: 860px; margin: 0 auto; }
#edd_checkout_cart_wrap, #edd_checkout_form_wrap { min-width: 0; }
#edd_checkout_form_wrap { display: flex; flex-direction: column; gap: var(--s5); }

/* ---------- checkout header + steps (lavtheme) ---------- */
.lav-co-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 6px; }
.lav-co-titles { display: flex; flex-direction: column; gap: 6px; }
.lav-co-h1 { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 3vw, 34px); letter-spacing: .3px; color: #fff; margin: 0; padding: 0; }
.lav-co-secure { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--green, #a3e635); }
.lav-co-lock { width: 14px; height: 14px; background-color: var(--green, #a3e635); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center/contain no-repeat; }
.lav-co-steps { display: flex; align-items: center; gap: 10px; list-style: none; margin: 0; padding: 0; }
.lav-co-steps li { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lav-co-steps li + li::before { content: ""; width: 22px; height: 1px; background: var(--stroke-soft); margin-right: 2px; }
.lav-co-steps li span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--glass-1); border: 1px solid var(--stroke-soft); color: var(--muted); }
.lav-co-steps li.active { color: #fff; }
.lav-co-steps li.active span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(124,131,255,.4); }
.lav-co-steps li.done span { background: rgba(163,230,53,.16); border-color: rgba(163,230,53,.5); color: var(--green, #a3e635); }

/* ---------- trust badges (lavtheme) ---------- */
.lav-co-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: var(--s4); }
.lav-co-badge { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--glass-1); border: 1px solid var(--stroke-soft); }
.lav-co-bico { flex: 0 0 22px; width: 22px; height: 22px; background-color: var(--accent); }
.lav-co-bico.bolt { background-color: var(--gold, #e8c547); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M13 2 3 14h7l-1 8 10-12h-7z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M13 2 3 14h7l-1 8 10-12h-7z'/%3E%3C/svg%3E") center/contain no-repeat; }
.lav-co-bico.shield { background-color: var(--accent-2, #22d3ee); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E") center/contain no-repeat; }
.lav-co-bico.refund { background-color: var(--green, #a3e635); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E") center/contain no-repeat; }
.lav-co-btext { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.lav-co-btext b { font-size: 13.5px; font-weight: 700; color: var(--text); }
.lav-co-btext i { font-size: 11.5px; font-style: normal; color: var(--muted); }

/* ---------- empty cart state (lavtheme) ---------- */
.lav-empty-cart { text-align: center; max-width: 680px; margin: 10px auto; padding: clamp(32px, 5vw, 56px) 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; border-radius: var(--r-lg); background: var(--glass-1); border: 1px solid var(--stroke-soft); }
.lav-ec-ico { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(124,131,255,.28), rgba(124,131,255,.06)); border: 1px solid rgba(124,131,255,.35); position: relative; }
.lav-ec-ico::after { content: ""; position: absolute; width: 40px; height: 40px; background-color: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E") center/contain no-repeat; }
.lav-ec-title { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 3vw, 30px); color: #fff; margin: 0; padding: 0; }
.lav-ec-text { color: var(--text-3); font-size: 15px; line-height: 1.6; max-width: 46ch; margin: 0; }
.lav-ec-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 6px; }
.lav-ec-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px; border-radius: var(--r-md); font-weight: 700; font-size: 14.5px; text-decoration: none; transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease); }
.lav-ec-btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 12px 28px rgba(124,131,255,.35); }
.lav-ec-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(124,131,255,.45); }
.lav-ec-btn.ghost { background: var(--glass-1); border: 1px solid var(--stroke); color: var(--text-2); }
.lav-ec-btn.ghost:hover { background: var(--glass-2); color: #fff; transform: translateY(-2px); }
.lav-ec-pop { width: 100%; margin-top: 18px; padding-top: 22px; border-top: 1px solid var(--stroke-soft); }
.lav-ec-pop-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.lav-ec-pop-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lav-ec-prod { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--glass-1); border: 1px solid var(--stroke-soft); text-decoration: none; transition: transform .16s var(--ease), border-color .16s var(--ease); }
.lav-ec-prod:hover { transform: translateY(-3px); border-color: rgba(124,131,255,.45); }
.lav-ec-prod-thumb { aspect-ratio: 16/10; border-radius: var(--r-sm); overflow: hidden; background: var(--glass-2); }
.lav-ec-prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lav-ec-prod-name { font-size: 13px; font-weight: 600; color: var(--text-2); line-height: 1.35; }
.lav-ec-prod-price { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--accent); }

/* ---------- cart / order summary tables ---------- */
#edd_checkout_cart,
.edd_cart,
.edd_purchase_history,
#edd_purchase_receipt table {
	width: 100%;
	border-collapse: collapse;
	background: var(--glass-1);
	border: 1px solid var(--stroke-soft);
	border-radius: var(--r-md);
	overflow: hidden;
	color: var(--text-2);
	font-family: var(--sans);
}
#edd_checkout_cart th, .edd_cart th,
.edd_purchase_history th, #edd_purchase_receipt th {
	text-align: start;
	font-family: var(--display);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: var(--text-3);
	padding: 14px 16px;
	background: var(--glass-2);
	border-bottom: 1px solid var(--stroke-soft);
}
#edd_checkout_cart td, .edd_cart td,
.edd_purchase_history td, #edd_purchase_receipt td {
	padding: 14px 16px;
	border-bottom: 1px solid var(--stroke-soft);
	font-size: 14px;
	vertical-align: middle;
}
#edd_checkout_cart tr:last-child td, .edd_purchase_history tr:last-child td { border-bottom: none; }
.edd_cart_item_name a, .edd_purchase_history a { color: var(--text); text-decoration: none; }
.edd_cart_item_name a:hover, .edd_purchase_history a:hover { color: var(--accent); }
.edd_cart_actions a, .edd_cart_remove a { color: var(--muted); }
.edd_cart_actions a:hover, .edd_cart_remove a:hover { color: var(--danger); }
.edd_cart_total, .edd_cart_amount { font-family: var(--display); font-weight: 700; color: var(--text); }

/* ---------- discount / coupon ---------- */
#edd-discount-code-wrap label, #edd_show_discount { color: var(--text-3); }
.edd-apply-discount, #edd-discount-button {
	background: var(--glass-2);
	color: var(--text);
	border: 1px solid var(--stroke);
	border-radius: var(--r-sm);
	padding: 0 16px;
	min-height: 44px;
	font-weight: 600;
	cursor: pointer;
}
.edd-apply-discount:hover { background: var(--glass-3); }

/* ---------- form fields ---------- */
#edd_checkout_form_wrap fieldset {
	border: 1px solid var(--stroke-soft);
	border-radius: var(--r-md);
	background: var(--glass-1);
	padding: var(--s5);
	margin: 0 0 var(--s4);
}
#edd_checkout_form_wrap legend,
#edd_checkout_form_wrap .edd-payment-icons + legend,
.edd-blocks__form-group-legend {
	font-family: var(--display);
	font-weight: 600;
	font-size: 18px;
	color: var(--text);
	padding: 0 0 var(--s3);
	width: 100%;
}
#edd_checkout_form_wrap label,
.edd-blocks-form__group label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-3);
	margin-bottom: 6px;
}
#edd_checkout_form_wrap input[type="text"],
#edd_checkout_form_wrap input[type="email"],
#edd_checkout_form_wrap input[type="tel"],
#edd_checkout_form_wrap input[type="password"],
#edd_checkout_form_wrap input[type="number"],
#edd_checkout_form_wrap select,
#edd_checkout_form_wrap textarea,
.edd-blocks-form__group input,
.edd-blocks-form__group select {
	width: 100%;
	min-height: 48px;
	padding: 0 14px;
	border-radius: var(--r-sm);
	background: var(--glass-1);
	border: 1px solid var(--stroke);
	color: var(--text);
	font-family: var(--sans);
	font-size: 15px;
	transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
#edd_checkout_form_wrap textarea { min-height: 110px; padding: 12px 14px; }
#edd_checkout_form_wrap input::placeholder,
.edd-blocks-form__group input::placeholder { color: var(--muted); }
#edd_checkout_form_wrap input:focus,
#edd_checkout_form_wrap select:focus,
#edd_checkout_form_wrap textarea:focus,
.edd-blocks-form__group input:focus {
	outline: 0;
	border-color: rgba(124, 131, 255, .55);
	box-shadow: var(--focus);
}
#edd_checkout_form_wrap .edd-description,
#edd_checkout_form_wrap .edd_purchase_submit_wrapper span.edd-description { color: var(--muted); font-size: 12px; }

/* ---------- primary submit (brand CTA) ---------- */
#edd_purchase_button,
#edd-purchase-button,
.edd-submit.button,
.edd-submit,
input[type="submit"].edd-submit,
.edd-blocks__checkout-submit button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 52px;
	padding: 0 32px;
	border: none;
	border-radius: var(--r-md);
	background: var(--cta);
	color: var(--cta-ink);
	font-family: var(--sans);
	font-weight: 700;
	font-size: 16px;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(245, 197, 24, .28);
	transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease);
}
#edd_purchase_button:hover,
.edd-submit:hover,
.edd-blocks__checkout-submit button:hover { transform: translateY(-2px); filter: brightness(1.03); }
#edd_purchase_button:focus-visible,
.edd-submit:focus-visible { outline: 0; box-shadow: var(--focus); }
.edd-loading, #edd-purchase-button[data-edd-loading] { opacity: .6; pointer-events: none; }

/* secondary buttons (e.g. "Go to checkout", "Continue shopping") */
.edd_checkout_cart .edd-submit.gray,
.edd-submit.gray,
.button.gray {
	background: var(--glass-2);
	color: var(--text);
	border: 1px solid var(--stroke);
	box-shadow: none;
}

/* ---------- alerts (errors / declined / success) ---------- */
.edd_errors, .edd_error, .edd-alert, .edd_alert,
.edd-blocks-alert {
	border-radius: var(--r-sm);
	padding: 14px 16px;
	font-size: 14px;
	margin: 0 0 var(--s4);
	border: 1px solid var(--stroke-soft);
	background: var(--glass-1);
	color: var(--text-2);
}
.edd_errors, .edd_error, .edd-alert-error, .edd-blocks-alert--error {
	border-color: rgba(255, 107, 138, .4);
	background: rgba(255, 107, 138, .1);
	color: #ffc2cf;
}
.edd_success, .edd-alert-success, .edd-blocks-alert--success {
	border-color: rgba(47, 210, 122, .4);
	background: rgba(47, 210, 122, .1);
	color: #b6f0d0;
}

/* ---------- receipt ---------- */
#edd_purchase_receipt_products li, .edd_purchase_receipt li { color: var(--text-2); }
#edd_purchase_receipt .edd_download_file_link,
.edd_purchase_history .edd_download_file_link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--accent);
	font-weight: 600;
	text-decoration: none;
}
#edd_purchase_receipt .edd_download_file_link:hover { text-decoration: underline; }

/* ---------- empty states ---------- */
.edd-cart-number-of-items, .edd_empty_cart,
.edd_purchase_history p:only-child {
	color: var(--text-3);
	font-size: 15px;
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
	/* purchase-history & receipt tables: horizontal scroll fallback */
	.edd_purchase_history, #edd_purchase_receipt table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	/* checkout cart → stacked cards (legacy table; the EDD block cart is already flex) */
	#edd_checkout_cart, .edd_cart { display: block; }
	#edd_checkout_cart thead { position: absolute; left: -9999px; top: -9999px; }
	#edd_checkout_cart tbody, #edd_checkout_cart tr, #edd_checkout_cart td { display: block; width: 100%; }
	#edd_checkout_cart tr.edd_cart_item { background: var(--glass-1); border: 1px solid var(--stroke-soft); border-radius: var(--r-md); margin-bottom: var(--s3); overflow: hidden; }
	#edd_checkout_cart tr.edd_cart_item td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--stroke-soft); text-align: right; }
	#edd_checkout_cart tr.edd_cart_item td:last-child { border-bottom: none; }
	#edd_checkout_cart td.edd_cart_item_price::before { content: "Price"; font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
	#edd_checkout_cart td.edd_cart_actions::before { content: "Actions"; font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
	#edd_checkout_cart tr.edd_cart_footer_row td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
	#edd_checkout_form_wrap input,
	#edd_checkout_form_wrap select,
	#edd_checkout_form_wrap textarea { font-size: 16px; } /* avoid iOS zoom */
	#edd_purchase_button, .edd-submit { width: 100%; }
	.lav-co-head { flex-direction: column; align-items: flex-start; gap: 14px; }
	.lav-co-steps { width: 100%; justify-content: space-between; }
	.lav-co-trust { grid-template-columns: 1fr; }
	.lav-ec-pop-row { grid-template-columns: 1fr; }
	.lav-ec-actions { flex-direction: column; width: 100%; }
	.lav-ec-btn { width: 100%; }
}
