/**
 * EDD Custom Checkout
 *
 * Everything is scoped under .eddcc-page so the stylesheet can sit alongside a
 * theme without leaking. Design tokens live on .eddcc-page for easy re-theming.
 */

.eddcc-page {
	--eddcc-bg: #f1f5f9;
	--eddcc-card: #ffffff;
	--eddcc-border: #e5e7eb;
	--eddcc-border-strong: #d1d5db;
	--eddcc-text: #111827;
	--eddcc-muted: #6b7280;
	--eddcc-primary: #2563eb;
	--eddcc-primary-hover: #1d4ed8;
	--eddcc-primary-soft: #eef4ff;
	--eddcc-bump-bg: #eef1fe;
	--eddcc-bump-border: #dfe4fb;
	--eddcc-surface: #f3f4f6;
	--eddcc-danger: #dc2626;
	--eddcc-success: #16a34a;
	--eddcc-radius: 12px;
	--eddcc-radius-sm: 8px;

	box-sizing: border-box;
	max-width: 1360px;
	margin: 0 auto;
	padding: 24px 20px 64px;
	color: var(--eddcc-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.eddcc-page *,
.eddcc-page *::before,
.eddcc-page *::after {
	box-sizing: border-box;
}

/* Standalone mode: own the page background. */
body.eddcc-standalone {
	margin: 0;
	background: #f1f5f9;
}

/* -------------------------------------------------- Header */

.eddcc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	margin-bottom: 28px;
}

.eddcc-header__logo {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: var(--eddcc-text);
}

.eddcc-header__logo img {
	display: block;
	max-height: 40px;
	width: auto;
}

.eddcc-header__name {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

/* -------------------------------------------------- Progress steps */

.eddcc-steps {
	display: flex;
	align-items: flex-start;
	margin: 0;
	padding: 0;
	list-style: none;
}

.eddcc-steps__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	min-width: 132px;
	text-align: center;
}

/* The connector: drawn from each step back toward the previous one. */
.eddcc-steps__item:not(:first-child)::before {
	content: "";
	position: absolute;
	top: 9px;
	right: 50%;
	left: -50%;
	height: 2px;
	background: var(--eddcc-primary);
}

.eddcc-steps__marker {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--eddcc-primary);
	color: #fff;
}

.eddcc-steps__marker svg {
	width: 12px;
	height: 12px;
}

/* Reached steps are ticked; steps still ahead are an open ring on a blue rail. */
.eddcc-steps__item.is-todo .eddcc-steps__marker {
	background: #fff;
	border: 2px solid var(--eddcc-primary);
}

.eddcc-steps__label {
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-steps__item.is-current .eddcc-steps__label,
.eddcc-steps__item.is-done .eddcc-steps__label {
	color: var(--eddcc-text);
}

/* -------------------------------------------------- Layout */

.eddcc-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	align-items: start;
}

.eddcc-card {
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
	padding: 24px;
}

/* -------------------------------------------------- Product */

.eddcc-product {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px;
	margin-bottom: 20px;
	background: var(--eddcc-surface);
	border-radius: var(--eddcc-radius-sm);
}

.eddcc-product__icon {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	border-radius: var(--eddcc-radius-sm);
	overflow: hidden;
}

.eddcc-product__icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.eddcc-product__placeholder svg {
	width: 24px;
	height: 24px;
	color: var(--eddcc-primary);
}

.eddcc-product__body {
	flex: 1 1 auto;
	min-width: 0;
}

.eddcc-product__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}

.eddcc-product__note {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-product__price {
	display: flex;
	align-items: baseline;
	gap: 6px;
	white-space: nowrap;
}

/* -------------------------------------------------- Prices */

.eddcc-price__was {
	font-size: 14px;
	color: var(--eddcc-muted);
	text-decoration: line-through;
}

.eddcc-price__now {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.eddcc-price__period {
	font-size: 13px;
	color: var(--eddcc-muted);
}

/* -------------------------------------------------- Order bumps */

.eddcc-bumps__heading {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 700;
}

.eddcc-bump {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	margin-bottom: 10px;
	background: var(--eddcc-bump-bg);
	border: 1px solid var(--eddcc-bump-border);
	border-radius: var(--eddcc-radius-sm);
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.eddcc-bump:hover {
	border-color: var(--eddcc-primary);
}

.eddcc-bump.is-checked {
	border-color: var(--eddcc-primary);
	box-shadow: 0 0 0 1px var(--eddcc-primary);
}

.eddcc-bump.is-busy {
	opacity: 0.6;
	pointer-events: none;
}

/* Visually hidden, but still focusable and reachable by screen readers. */
.eddcc-bump__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.eddcc-bump__box {
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	border: 1.5px solid var(--eddcc-border-strong);
	border-radius: 5px;
	color: transparent;
}

.eddcc-bump__box svg {
	width: 12px;
	height: 12px;
}

.eddcc-bump__input:checked + .eddcc-bump__box {
	background: var(--eddcc-primary);
	border-color: var(--eddcc-primary);
	color: #fff;
}

.eddcc-bump__input:focus-visible + .eddcc-bump__box {
	outline: 2px solid var(--eddcc-primary);
	outline-offset: 2px;
}

.eddcc-bump__body {
	flex: 1 1 auto;
	min-width: 0;
}

.eddcc-bump__title {
	display: block;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
}

.eddcc-bump__desc {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-bump__price {
	display: flex;
	align-items: baseline;
	gap: 6px;
	white-space: nowrap;
}

.eddcc-bump__price .eddcc-price__now {
	font-size: 18px;
}

/* -------------------------------------------------- Discount */

.eddcc-discount {
	margin-top: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--eddcc-border);
}

.eddcc-discount__toggle {
	padding: 0;
	background: none;
	border: 0;
	color: var(--eddcc-muted);
	font-size: 14px;
	text-decoration: underline;
	cursor: pointer;
}

.eddcc-discount__toggle:hover {
	color: var(--eddcc-text);
}

.eddcc-discount__form {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}

.eddcc-discount__form[hidden] {
	display: none;
}

.eddcc-discount__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
	font-size: 15px;
	color: var(--eddcc-text);
}

.eddcc-discount__input:focus {
	outline: none;
	border-color: var(--eddcc-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.eddcc-discount__applied {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.eddcc-discount__applied li {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: var(--eddcc-primary-soft);
	border-radius: 999px;
	font-size: 13px;
}

.eddcc-discount__code {
	font-weight: 600;
	text-transform: uppercase;
}

.eddcc-discount__remove {
	padding: 0;
	background: none;
	border: 0;
	color: var(--eddcc-muted);
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}

.eddcc-discount__message {
	margin: 8px 0 0;
	font-size: 13px;
	min-height: 0;
}

.eddcc-discount__message:empty {
	display: none;
}

.eddcc-discount__message.is-error {
	color: var(--eddcc-danger);
}

.eddcc-discount__message.is-success {
	color: var(--eddcc-success);
}

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

.eddcc-totals {
	padding-top: 20px;
}

.eddcc-totals__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 6px 0;
	font-size: 15px;
}

.eddcc-totals__row--tax {
	color: var(--eddcc-muted);
}

.eddcc-totals__row--discount {
	color: var(--eddcc-success);
}

.eddcc-totals__row--grand {
	margin-top: 10px;
	padding-top: 16px;
	border-top: 1px solid var(--eddcc-border);
	font-size: 20px;
	font-weight: 700;
}

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

.eddcc-form__heading {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.eddcc-form__subheading {
	margin: 6px 0 20px;
	font-size: 14px;
	color: var(--eddcc-muted);
}

.eddcc-field {
	margin: 0 0 16px;
	padding: 0;
	border: 0;
}

.eddcc-field__label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
}

.eddcc-field__required {
	color: var(--eddcc-danger);
}

.eddcc-field__note {
	margin-left: 4px;
	font-weight: 400;
	color: var(--eddcc-muted);
}

.eddcc-field__input {
	display: block;
	width: 100%;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
	font-size: 15px;
	line-height: 1.4;
	color: var(--eddcc-text);
}

.eddcc-field__input:focus {
	outline: none;
	border-color: var(--eddcc-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.eddcc-field__input.has-error {
	border-color: var(--eddcc-danger);
}

.eddcc-field__select {
	appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	padding-right: 40px;
}

/* -------------------------------------------------- Gateways */

.eddcc-gateway {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	margin-bottom: 8px;
	border: 1px solid var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
	cursor: pointer;
}

.eddcc-gateway:has(input:checked) {
	border-color: var(--eddcc-primary);
	background: var(--eddcc-primary-soft);
}

/* -------------------------------------------------- Buttons */

.eddcc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 20px;
	border: 1px solid transparent;
	border-radius: var(--eddcc-radius-sm);
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.eddcc-btn--primary {
	width: 100%;
	background: var(--eddcc-primary);
	color: #fff;
	font-size: 16px;
	padding: 16px 20px;
}

.eddcc-btn--primary:hover {
	background: var(--eddcc-primary-hover);
}

.eddcc-btn--secondary {
	background: #fff;
	border-color: var(--eddcc-border-strong);
	color: var(--eddcc-text);
}

.eddcc-btn--secondary:hover {
	border-color: var(--eddcc-primary);
	color: var(--eddcc-primary);
}

.eddcc-btn:focus-visible {
	outline: 2px solid var(--eddcc-primary);
	outline-offset: 2px;
}

.eddcc-submit[disabled] {
	opacity: 0.7;
	cursor: progress;
}

.eddcc-submit__spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: eddcc-spin 0.7s linear infinite;
}

.eddcc-submit.is-busy .eddcc-submit__spinner {
	display: block;
}

@keyframes eddcc-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.eddcc-submit__spinner {
		animation-duration: 2s;
	}

	.eddcc-btn,
	.eddcc-bump {
		transition: none;
	}
}

/* -------------------------------------------------- Assurance strip */

.eddcc-assurance {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 20px;
	margin-top: 12px;
	padding: 12px 16px;
	background: var(--eddcc-primary-soft);
	border-radius: var(--eddcc-radius-sm);
}

.eddcc-assurance__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #1e3a8a;
}

.eddcc-assurance__item svg {
	width: 14px;
	height: 14px;
	flex: 0 0 14px;
}

/* -------------------------------------------------- Trust badges */

.eddcc-badges {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-top: 16px;
}

.eddcc-badge {
	padding: 20px 16px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
	text-align: center;
}

.eddcc-badge__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0 auto 12px;
	border-radius: 50%;
	background: #dcfce7;
	color: #16a34a;
}

.eddcc-badge__icon--1 {
	background: #dbeafe;
	color: #2563eb;
}

.eddcc-badge__icon--2 {
	background: #ede9fe;
	color: #7c3aed;
}

.eddcc-badge__icon svg {
	width: 30px;
	height: 30px;
}

.eddcc-badge__icon img {
	width: 56px;
	height: 56px;
	object-fit: contain;
	border-radius: 50%;
}

.eddcc-badge__title {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
}

.eddcc-badge__desc {
	margin: 0;
	font-size: 12px;
	color: var(--eddcc-muted);
	line-height: 1.4;
}

/* -------------------------------------------------- Errors */

.eddcc-errors:empty {
	display: none;
}

.eddcc-errors {
	margin-bottom: 16px;
	padding: 12px 14px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: var(--eddcc-radius-sm);
	color: #991b1b;
	font-size: 14px;
}

.eddcc-errors p {
	margin: 0 0 4px;
}

.eddcc-errors p:last-child {
	margin-bottom: 0;
}

/* EDD prints its own error markup into this container. */
.eddcc-errors .edd_errors,
.eddcc-errors .edd_error {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	color: inherit;
}

/* -------------------------------------------------- Terms / privacy */

.eddcc-form #edd_terms_agreement,
.eddcc-form #edd_privacy_policy_agreement {
	margin-bottom: 16px;
	font-size: 14px;
}

.eddcc-form #edd_terms_agreement label,
.eddcc-form #edd_privacy_policy_agreement label {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
}

/* -------------------------------------------------- Payment step */

/* The order is placed; the summary is now a read-only record. */
.eddcc-card--locked {
	background: rgba(255, 255, 255, 0.55);
}

.eddcc-summary.is-locked {
	opacity: 0.55;
	pointer-events: none;
	user-select: none;
}

.eddcc-payment {
	padding: 24px 28px 28px;
}

/*
 * The Paddle gateway prints its own heading and rule above the frame. Rather
 * than duplicate them, restyle what it already emits.
 */
.eddcc-payment .paddle-checkout-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	color: var(--eddcc-text);
}

.eddcc-payment .paddle-checkout-container {
	height: 0;
	margin: 14px 0 4px !important;
	border: 0 !important;
	border-top: 1px solid var(--eddcc-border) !important;
}

.eddcc-payment .wp-smartpay-edd-payment-wrapper {
	position: relative;
	min-height: 320px;
}

/*
 * Paddle resizes its iframe as the customer moves through card entry and the
 * "Add VAT number" panel, so the container must never constrain or clip it.
 */
.eddcc-payment .paddle-inline-checkout-container {
	width: 100%;
	height: auto;
	overflow: visible;
}

.eddcc-payment iframe.paddle-frame {
	width: 100%;
	border: 0;
	/* The gateway fades this in on Paddle's `checkout.loaded` event. */
	opacity: 0;
	transition: opacity 0.2s ease;
}

.eddcc-payment__fallback {
	text-align: center;
}

/* -------------------------------------------------- Social proof */

.eddcc-social {
	margin-top: 24px;
	padding: 0 4px;
}

.eddcc-social__trusted {
	display: flex;
	align-items: center;
	gap: 10px;
}

.eddcc-social__avatars {
	height: 28px;
	width: auto;
}

.eddcc-social__trusted-text {
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-social__reviews {
	margin-top: 12px;
}

.eddcc-social__reviews img {
	max-height: 22px;
	width: auto;
}

.eddcc-social__quote {
	margin: 20px 0 0;
	padding-left: 16px;
	border-left: 3px solid var(--eddcc-primary);
}

.eddcc-social__quote blockquote {
	margin: 0;
	font-size: 14px;
	font-style: italic;
	line-height: 1.55;
	color: var(--eddcc-muted);
}

.eddcc-social__author {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 14px;
}

.eddcc-social__author img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
}

.eddcc-social__author span {
	display: flex;
	flex-direction: column;
	line-height: 1.35;
}

.eddcc-social__author strong {
	font-size: 14px;
}

.eddcc-social__author em {
	font-size: 12px;
	font-style: normal;
	color: var(--eddcc-muted);
}

/* -------------------------------------------------- Empty cart */

.eddcc-empty {
	max-width: 480px;
	margin: 60px auto;
	padding: 40px 24px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
	text-align: center;
}

.eddcc-empty__title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
}

.eddcc-empty__text {
	margin: 0 0 20px;
	color: var(--eddcc-muted);
}

/* -------------------------------------------------- Responsive */

@media (max-width: 1024px) {
	.eddcc-grid {
		gap: 24px;
	}

	.eddcc-steps__item {
		min-width: 104px;
	}
}

@media (max-width: 860px) {
	.eddcc-grid {
		grid-template-columns: 1fr;
	}

	/* Summary first on mobile: the customer confirms what they're buying, then pays. */
	.eddcc-col--summary {
		order: 1;
	}

	.eddcc-col--form {
		order: 2;
	}

	.eddcc-header {
		justify-content: center;
	}
}

@media (max-width: 600px) {
	.eddcc-page {
		padding: 16px 12px 40px;
	}

	.eddcc-card {
		padding: 18px;
	}

	.eddcc-badges {
		grid-template-columns: 1fr;
	}

	.eddcc-steps__item {
		min-width: 84px;
	}

	.eddcc-steps__label {
		font-size: 11px;
	}

	.eddcc-product {
		flex-wrap: wrap;
	}

	.eddcc-product__price {
		width: 100%;
		justify-content: flex-end;
	}
}
