/* =========================================
 * Cherry Payment Plans for WooCommerce
 * Stylesheet v1.1.0
 * ========================================= */

/* --- Shared --- */
.cherry-pp-widget-wrap {
	margin: 10px 0;
	max-width: 100%;
}

.cherry-pp-widget-wrap:empty {
	display: none;
}

/* Visible widget placeholder gets a soft loading state while Cherry's script renders */
.cherry-pp-widget[data-cherry-widget]:not([data-cherry-done]) {
	min-height: 320px;
	background:
		linear-gradient(90deg, rgba(0,0,0,0.04) 0%, rgba(0,0,0,0.07) 50%, rgba(0,0,0,0.04) 100%);
	background-size: 200% 100%;
	animation: cherry-shimmer 1.4s ease-in-out infinite;
	border-radius: 8px;
}

@keyframes cherry-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.cherry-widget-container {
	margin: 20px 0;
	max-width: 100%;
	overflow-x: auto;
}

/* Checkout panel: tight "How it works" line + calculator modal trigger */
.cherry-pp-howto {
	margin: 8px 0 12px !important;
	font-size: 13px;
	line-height: 1.5;
}

/* "See example monthly payments" trigger button */
.cherry-pp-calc-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 100%;
	padding: 11px 16px;
	background: #fff;
	border: 1px solid #d8d8d8;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: #1a1a1a;
	font-family: inherit;
	transition: all 0.15s ease;
	margin: 8px 0 4px;
	text-align: left;
	box-sizing: border-box;
}

.cherry-pp-calc-btn:hover,
.cherry-pp-calc-btn:focus {
	background: #fafafa;
	border-color: #999;
	transform: translateY(-1px);
	box-shadow: 0 2px 6px rgba(0,0,0,0.04);
	outline: none;
}

.cherry-pp-calc-btn:focus-visible {
	border-color: var(--cherry-primary, #9F7829);
	box-shadow: 0 0 0 3px rgba(159,120,41,0.15);
}

/* ========================================
 * Cherry calculator modal
 * ======================================== */
.cherry-modal {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.cherry-modal.is-open {
	display: flex;
	animation: cherry-modal-fade 0.2s ease;
}

@keyframes cherry-modal-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.cherry-modal__backdrop {
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.55);
	backdrop-filter: blur(2px);
}

.cherry-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: 14px;
	width: 100%;
	max-width: 720px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 28px 28px 24px;
	box-shadow: 0 20px 60px -10px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.1);
	box-sizing: border-box;
	font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	animation: cherry-modal-rise 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes cherry-modal-rise {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.cherry-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	background: transparent;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
	transition: all 0.15s ease;
	padding: 0;
	z-index: 2;
}

.cherry-modal__close:hover {
	background: rgba(0,0,0,0.06);
	color: #000;
}

.cherry-modal__close:focus-visible {
	outline: 2px solid var(--cherry-primary, #9F7829);
	outline-offset: 2px;
}

.cherry-modal__title {
	margin: 0 36px 6px 0;
	font-size: 19px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
}

.cherry-modal__sub {
	margin: 0 0 18px;
	font-size: 13px;
	color: #666;
	line-height: 1.5;
}

.cherry-modal__body {
	margin-top: 4px;
}

/* Inside the modal the widget has full room, no scroll needed */
.cherry-modal__body .cherry-pp-widget {
	max-width: 100%;
}

/* Mobile: full-screen modal */
@media (max-width: 600px) {
	.cherry-modal {
		padding: 0;
		align-items: stretch;
	}
	.cherry-modal__dialog {
		max-height: 100vh;
		min-height: 100vh;
		border-radius: 0;
		padding: 56px 20px 20px;
	}
	.cherry-modal__close {
		top: 12px;
		right: 12px;
	}
	.cherry-modal__title {
		font-size: 17px;
	}
}

.cherry-apply-btn {
	transition: opacity 0.2s ease, transform 0.15s ease;
}

.cherry-apply-btn:hover,
.cherry-apply-btn:focus {
	opacity: 0.92;
	color: #fff !important;
	text-decoration: none !important;
	transform: translateY(-1px);
}

/* Payment method icon sizing in classic checkout */
#payment ul.payment_methods li.payment_method_cherry img,
.woocommerce-checkout .payment_method_cherry img {
	max-height: 24px;
	margin-left: 10px;
	float: right;
}

#payment .payment_box.payment_method_cherry .cherry-pp-widget-wrap iframe {
	max-width: 100%;
}

/* === Strict containment for Cherry checkout panel === */
/* Targets EVERY ancestor in both Elementor's WC Checkout widget AND the
 * standard WooCommerce checkout, breaking the flex/grid min-content sizing
 * chain that lets a wide Cherry iframe push parents beyond the column width. */
body .elementor-widget-woocommerce-checkout-page .e-checkout__column,
body .elementor-widget-woocommerce-checkout-page .e-checkout__column-end,
body .elementor-widget-woocommerce-checkout-page .e-checkout__column-inner,
body .elementor-widget-woocommerce-checkout-page .e-checkout__order_review,
body .elementor-widget-woocommerce-checkout-page .e-checkout__order_review-2,
body .elementor-widget-woocommerce-checkout-page #payment,
body .elementor-widget-woocommerce-checkout-page .woocommerce-checkout-payment,
body .elementor-widget-woocommerce-checkout-page ul.wc_payment_methods,
body .elementor-widget-woocommerce-checkout-page ul.payment_methods,
body .elementor-widget-woocommerce-checkout-page li.wc_payment_method,
body .elementor-widget-woocommerce-checkout-page li.payment_method_cherry,
body .elementor-widget-woocommerce-checkout-page .payment_box,
body .elementor-widget-woocommerce-checkout-page .payment_box.payment_method_cherry,
body .woocommerce-checkout #payment,
body .woocommerce-checkout ul.wc_payment_methods,
body .woocommerce-checkout li.wc_payment_method,
body .woocommerce-checkout li.payment_method_cherry,
body .woocommerce-checkout .payment_box,
body .woocommerce-checkout .payment_box.payment_method_cherry,
.wc-block-checkout__payment-method,
.wc-block-checkout__payment-method .cherry-blocks-content {
	min-width: 0 !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
}

/* The payment_box itself clips overflow so the inner calculator can't push it */
body .elementor-widget-woocommerce-checkout-page .payment_box.payment_method_cherry,
body .woocommerce-checkout .payment_box.payment_method_cherry,
.wc-block-checkout__payment-method .cherry-blocks-content {
	overflow: hidden !important;
	width: 100% !important;
}

/* Inside the payment_box, the calc body gets the horizontal scrollbar */
.payment_box.payment_method_cherry .cherry-pp-checkout-calc {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
	overflow: hidden !important;
}

.payment_box.payment_method_cherry .cherry-pp-checkout-calc__body {
	overflow-x: auto !important;
	overflow-y: hidden !important;
	-webkit-overflow-scrolling: touch;
	max-width: 100% !important;
	width: 100% !important;
	box-sizing: border-box !important;
}

.wc-block-checkout__payment-method .cherry-blocks-content {
	padding-top: 8px;
}

/* =========================================
 * Thank-you / Order Received Panel
 * ========================================= */
.cherry-tx {
	--cherry-radius: 16px;
	--cherry-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);
	--cherry-text: #1a1a1a;
	--cherry-text-soft: #555;
	--cherry-border: #e8e8e8;
	font-family: var(--cherry-font, "Open Sans", -apple-system, BlinkMacSystemFont, sans-serif);
	color: var(--cherry-text);
	margin: 28px 0;
	border-radius: var(--cherry-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: var(--cherry-shadow);
	border: 1px solid var(--cherry-border);
}

/* --- Hero --- */
.cherry-tx__hero {
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 28px 32px;
	background: linear-gradient(135deg, var(--cherry-primary), var(--cherry-primary-dark));
	color: #fff;
}

.cherry-tx--paid .cherry-tx__hero {
	background: linear-gradient(135deg, #2e7d32, #1b5e20);
}

.cherry-tx--cancelled .cherry-tx__hero {
	background: linear-gradient(135deg, #c0392b, #922b21);
}

.cherry-tx__hero-icon {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	backdrop-filter: blur(4px);
}

.cherry-tx__hero-text h2 {
	margin: 0 0 4px;
	font-size: 22px;
	font-weight: 700;
	color: #fff;
	line-height: 1.25;
}

.cherry-tx__hero-sub {
	margin: 0;
	font-size: 14px;
	color: rgba(255, 255, 255, 0.92);
	line-height: 1.5;
}

/* --- Progress steps --- */
.cherry-tx__steps {
	display: flex;
	align-items: center;
	gap: 0;
	padding: 24px 32px 8px;
	flex-wrap: nowrap;
}

.cherry-tx__step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	min-width: 0;
}

.cherry-tx__step-dot {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #e0e0e0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	font-weight: 600;
	font-size: 13px;
	transition: all 0.3s ease;
}

.cherry-tx__step--active .cherry-tx__step-dot {
	background: var(--cherry-primary);
	color: #fff;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--cherry-primary) 20%, transparent);
	animation: cherry-pulse-dot 2s ease-in-out infinite;
}

.cherry-tx__step--done .cherry-tx__step-dot {
	background: var(--cherry-primary);
	color: #fff;
}

.cherry-tx--paid .cherry-tx__step--done .cherry-tx__step-dot {
	background: #2e7d32;
}

.cherry-tx__step-label {
	font-size: 12px;
	color: var(--cherry-text-soft);
	font-weight: 500;
	white-space: nowrap;
}

.cherry-tx__step--active .cherry-tx__step-label,
.cherry-tx__step--done .cherry-tx__step-label {
	color: var(--cherry-text);
	font-weight: 600;
}

.cherry-tx__step-bar {
	flex: 1;
	min-width: 20px;
	height: 2px;
	background: #e0e0e0;
	margin: 0 8px;
	margin-bottom: 26px;
	transition: background 0.3s ease;
}

.cherry-tx__step-bar--done {
	background: var(--cherry-primary);
}

.cherry-tx--paid .cherry-tx__step-bar--done {
	background: #2e7d32;
}

@keyframes cherry-pulse-dot {
	0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cherry-primary) 20%, transparent); }
	50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--cherry-primary) 12%, transparent); }
}

/* --- CTA row --- */
.cherry-tx__cta-row {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px 32px;
	flex-wrap: wrap;
}

.cherry-tx__cta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 28px;
	background: var(--cherry-primary);
	color: #fff !important;
	font-weight: 600;
	font-size: 15px;
	text-decoration: none !important;
	border-radius: 10px;
	transition: all 0.2s ease;
	box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--cherry-primary) 60%, transparent);
}

.cherry-tx__cta:hover,
.cherry-tx__cta:focus {
	background: var(--cherry-primary-dark);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px -4px color-mix(in srgb, var(--cherry-primary) 70%, transparent);
}

.cherry-tx__cta svg {
	transition: transform 0.2s ease;
}

.cherry-tx__cta:hover svg {
	transform: translateX(3px);
}

.cherry-tx__cta--secondary {
	background: #fff;
	color: var(--cherry-text) !important;
	border: 1.5px solid var(--cherry-border);
	box-shadow: none;
}

.cherry-tx__cta--secondary:hover {
	background: #f7f7f7;
	box-shadow: none;
}

/* --- Live status pulse --- */
.cherry-tx__status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	background: #fff8e1;
	border-radius: 99px;
	font-size: 13px;
	color: #856404;
	font-weight: 500;
}

.cherry-tx__status.is-success {
	background: #d4edda;
	color: #155724;
}

.cherry-tx__status-pulse {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #f0b400;
	box-shadow: 0 0 0 0 rgba(240, 180, 0, 0.6);
	animation: cherry-pulse-status 2s infinite;
}

.cherry-tx__status.is-success .cherry-tx__status-pulse {
	background: #2e7d32;
	animation: none;
}

@keyframes cherry-pulse-status {
	0% { box-shadow: 0 0 0 0 rgba(240, 180, 0, 0.6); }
	70% { box-shadow: 0 0 0 10px rgba(240, 180, 0, 0); }
	100% { box-shadow: 0 0 0 0 rgba(240, 180, 0, 0); }
}

/* --- Info card grid --- */
.cherry-tx__info-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 12px;
	padding: 8px 32px 24px;
}

.cherry-tx__info-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	background: #fafafa;
	border-radius: 10px;
	border: 1px solid var(--cherry-border);
}

.cherry-tx__info-icon {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--cherry-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	font-weight: 700;
}

.cherry-tx__info-card strong {
	display: block;
	font-size: 13px;
	color: var(--cherry-text);
	margin-bottom: 2px;
}

.cherry-tx__info-card span {
	display: block;
	font-size: 12px;
	color: var(--cherry-text-soft);
	line-height: 1.4;
}

/* --- Calculator collapsible --- */
.cherry-tx__calc {
	margin: 0 32px 28px;
	border: 1px solid var(--cherry-border);
	border-radius: 10px;
	overflow: hidden;
}

.cherry-tx__calc summary {
	padding: 14px 18px;
	cursor: pointer;
	font-weight: 600;
	font-size: 14px;
	color: var(--cherry-text);
	background: #fafafa;
	list-style: none;
	user-select: none;
	transition: background 0.2s ease;
}

.cherry-tx__calc summary::-webkit-details-marker {
	display: none;
}

.cherry-tx__calc summary::before {
	content: "▸";
	display: inline-block;
	margin-right: 10px;
	transition: transform 0.2s ease;
	color: var(--cherry-primary);
}

.cherry-tx__calc[open] summary::before {
	transform: rotate(90deg);
}

.cherry-tx__calc summary:hover {
	background: #f4f4f4;
}

.cherry-tx__calc-body {
	padding: 16px 18px;
	max-width: 100%;
	overflow-x: auto;
}

/* --- Paid / cancelled actions --- */
.cherry-tx__paid-actions {
	padding: 20px 32px 28px;
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

/* --- Mobile --- */
@media (max-width: 600px) {
	.cherry-tx__hero {
		padding: 22px 20px;
		gap: 14px;
	}
	.cherry-tx__hero-icon {
		width: 52px;
		height: 52px;
	}
	.cherry-tx__hero-text h2 {
		font-size: 18px;
	}
	.cherry-tx__hero-sub {
		font-size: 13px;
	}
	.cherry-tx__steps {
		padding: 20px 16px 6px;
	}
	.cherry-tx__step-label {
		font-size: 11px;
	}
	.cherry-tx__step-dot {
		width: 28px;
		height: 28px;
	}
	.cherry-tx__step-bar {
		margin-bottom: 22px;
	}
	.cherry-tx__cta-row {
		padding: 16px 20px;
		flex-direction: column;
		align-items: stretch;
	}
	.cherry-tx__cta {
		justify-content: center;
	}
	.cherry-tx__status {
		justify-content: center;
	}
	.cherry-tx__info-grid {
		padding: 4px 20px 20px;
		grid-template-columns: 1fr;
	}
	.cherry-tx__calc {
		margin: 0 20px 22px;
	}
	.cherry-tx__paid-actions {
		padding: 16px 20px 22px;
	}
}
