/**
 * StripeEase Checkout — Premium payment form styles
 */

/* ── Payment wrapper ───────────────────────────────────────────────────────── */

.stripeease-payment-wrapper {
	margin: 1.25rem 0 1.5rem;
	padding: 1.5rem;
	background: linear-gradient(145deg, #fafbfc 0%, #ffffff 100%);
	border: 1px solid #e6e9ef;
	border-radius: 12px;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 4px 16px rgba(16, 24, 40, 0.06);
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.stripeease-payment-wrapper:focus-within {
	border-color: #635bff;
	box-shadow:
		0 0 0 3px rgba(99, 91, 255, 0.12),
		0 4px 16px rgba(16, 24, 40, 0.08);
}

/* ── Description text ──────────────────────────────────────────────────────── */

.stripeease-checkout-description {
	margin: 0 0 1rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #5e6c84;
}

/* ── Payment Element container ─────────────────────────────────────────────── */

.stripeease-payment-element {
	min-height: 120px;
	padding: 0.25rem 0;
}

/* ── Loading skeleton ──────────────────────────────────────────────────────── */

.stripeease-payment-element.stripeease-loading {
	min-height: 140px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 4px 0;
}

.stripeease-skeleton {
	height: 44px;
	border-radius: 8px;
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: stripeease-shimmer 1.4s infinite;
}

.stripeease-skeleton--short {
	height: 36px;
	width: 55%;
}

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

/* ── Messages ──────────────────────────────────────────────────────────────── */

.stripeease-payment-message {
	display: none;
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	font-size: 0.875rem;
	line-height: 1.4;
	border-radius: 8px;
}

.stripeease-message-error {
	display: block;
	color: #b42318;
	background: #fef3f2;
	border: 1px solid #fecdca;
}

.stripeease-message-success {
	display: block;
	color: #027a48;
	background: #ecfdf3;
	border: 1px solid #abefc6;
}

/* ── Test mode badge ───────────────────────────────────────────────────────── */

.stripeease-test-mode-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin: 0 0 1rem;
	padding: 0.35rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #b54708;
	background: #fffaeb;
	border: 1px solid #fedf89;
	border-radius: 6px;
}

.stripeease-test-mode-badge::before {
	content: "⚠";
	font-style: normal;
}

/* ── Trust badge ───────────────────────────────────────────────────────────── */

.stripeease-trust-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	margin-top: 1rem;
	font-size: 0.75rem;
	color: #8892a0;
}

.stripeease-trust-badge svg {
	flex-shrink: 0;
}

/* ── Gateway selection polish ──────────────────────────────────────────────── */

#edd-payment-mode-wrap .edd-gateway-option label {
	font-weight: 500;
}

#edd-payment-mode-wrap input[value="stripeease"]:checked + label,
.edd-gateway-option-selected[data-gateway="stripeease"] {
	color: #635bff;
}

/* ── Processing state ──────────────────────────────────────────────────────── */

#edd_purchase_form.processing .stripeease-payment-wrapper {
	opacity: 0.7;
	pointer-events: none;
}

/* ── Saved cards ───────────────────────────────────────────────────────────── */

.stripeease-saved-cards {
	margin-bottom: 1.25rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid #e6e9ef;
}

.stripeease-saved-cards__title {
	margin: 0 0 0.75rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: #1a1f36;
}

.stripeease-saved-cards__list {
	list-style: none;
	margin: 0 0 0.75rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.stripeease-saved-cards__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border: 1px solid #e6e9ef;
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
	font-size: 0.875rem;
}

.stripeease-saved-cards__item:hover {
	background: #f7f8fa;
	border-color: #c8cdd6;
}

.stripeease-saved-cards__item input[type="radio"] {
	margin: 0;
	flex-shrink: 0;
}

.stripeease-saved-cards__brand {
	font-weight: 600;
	color: #1a1f36;
	min-width: 52px;
}

/* Brand-specific colours */
.stripeease-brand-visa        { color: #1a1f71; }
.stripeease-brand-mastercard  { color: #eb001b; }
.stripeease-brand-amex        { color: #007bc1; }
.stripeease-brand-discover    { color: #ff6600; }
.stripeease-brand-unionpay    { color: #cc0000; }

.stripeease-saved-cards__last4 {
	color: #5e6c84;
	letter-spacing: 0.05em;
}

.stripeease-saved-cards__exp {
	margin-left: auto;
	color: #8892a0;
	font-size: 0.8rem;
}

.stripeease-save-card {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 0.75rem;
	font-size: 0.875rem;
	color: #3d4460;
	cursor: pointer;
}

.stripeease-save-card input[type="checkbox"] {
	margin: 0;
}

/* ── Account page card list ────────────────────────────────────────────────── */

.stripeease-account-cards h3 {
	margin-bottom: 0.75rem;
}

.stripeease-account-cards__list {
	list-style: none;
	padding: 0;
	margin: 0 0 1rem;
}

.stripeease-account-cards__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid #e6e9ef;
	font-size: 0.9rem;
}

.stripeease-account-cards__number {
	color: #5e6c84;
	letter-spacing: 0.04em;
}

.stripeease-account-cards__exp {
	color: #8892a0;
	font-size: 0.8rem;
}

.stripeease-remove-card {
	margin-left: auto;
	color: #b42318;
	font-size: 0.8rem;
	text-decoration: none;
}

.stripeease-remove-card:hover {
	text-decoration: underline;
}

.stripeease-account-cards__empty {
	color: #8892a0;
	font-style: italic;
}

/* ── Setup page ────────────────────────────────────────────────────────────── */

.stripeease-setup-page body,
body.stripeease-setup-page {
	background: #f6f8fa;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.stripeease-setup-wrap {
	max-width: 520px;
	margin: 60px auto;
	padding: 0 20px;
}

.stripeease-setup-header {
	text-align: center;
	margin-bottom: 1.5rem;
}

.stripeease-setup-header h1 {
	font-size: 1.5rem;
	color: #1a1f36;
	margin: 0 0 0.5rem;
}

.stripeease-setup-subtitle {
	font-size: 0.875rem;
	color: #8892a0;
	margin: 0;
}

.stripeease-setup-form {
	background: #fff;
	border: 1px solid #e6e9ef;
	border-radius: 12px;
	padding: 1.75rem;
	box-shadow: 0 4px 16px rgba(16,24,40,0.06);
}

.stripeease-setup-btn {
	display: block;
	width: 100%;
	margin-top: 1.25rem;
	padding: 0.8rem 1rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: #635bff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s;
}

.stripeease-setup-btn:hover:not(:disabled) {
	background: #4f46e5;
}

.stripeease-setup-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.stripeease-setup-cancel {
	text-align: center;
	margin-top: 1rem;
	font-size: 0.875rem;
}

.stripeease-setup-cancel a {
	color: #8892a0;
	text-decoration: none;
}

.stripeease-setup-cancel a:hover {
	text-decoration: underline;
}

/* ── Checkout info widget ──────────────────────────────────────────────────── */

.stripeease-checkout-info {
	margin: 0.5rem 0 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* Error notice (keys not configured) */
.stripeease-checkout-notice {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.65rem 0.875rem;
	border-radius: 8px;
	font-size: 0.82rem;
	line-height: 1.4;
}

.stripeease-checkout-notice--error {
	background: #fef3f2;
	border: 1px solid #fecdca;
	color: #b42318;
}

.stripeease-checkout-notice svg {
	flex-shrink: 0;
}

/* Test mode badge */
.stripeease-checkout-testbadge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.3rem 0.75rem;
	background: #fffaeb;
	border: 1px solid #fedf89;
	border-radius: 6px;
	font-size: 0.75rem;
	font-weight: 600;
	color: #b54708;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	align-self: flex-start;
}

.stripeease-checkout-testbadge svg {
	flex-shrink: 0;
}

/* Secure payment row */
.stripeease-checkout-secure {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	padding: 0.75rem 0.9rem;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 8px;
}

.stripeease-checkout-secure__icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: #dcfce7;
	border-radius: 50%;
}

.stripeease-checkout-secure__text {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.stripeease-checkout-secure__title {
	display: block;
	font-size: 0.82rem;
	font-weight: 700;
	color: #15803d;
	letter-spacing: 0.01em;
}

.stripeease-checkout-secure__sub {
	display: block;
	font-size: 0.78rem;
	color: #166534;
	line-height: 1.4;
	opacity: 0.85;
}

/* Next-step indicator */
.stripeease-checkout-step {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.8rem;
	color: #5e6c84;
	line-height: 1.4;
	padding: 0 0.1rem;
}

.stripeease-checkout-step__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	background: #635bff;
	color: #fff;
	border-radius: 50%;
	font-size: 0.65rem;
	flex-shrink: 0;
	line-height: 1;
}

/* Card brand row */
.stripeease-card-brands {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.stripeease-card-brand {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 26px;
	padding: 0 8px;
	border-radius: 5px;
	border: 1px solid #e6e9ef;
	background: #fff;
	font-size: 0.65rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
	line-height: 1;
}

/* VISA */
.stripeease-card-visa {
	color: #1a1f71;
	font-style: italic;
	font-size: 0.72rem;
	letter-spacing: 0;
}

/* Mastercard overlapping circles */
.stripeease-card-mc {
	padding: 0 7px;
}

.stripeease-mc-circles {
	display: flex;
	align-items: center;
	position: relative;
	width: 28px;
	height: 17px;
}

.stripeease-mc-circle {
	position: absolute;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	opacity: 0.95;
}

.stripeease-mc-red {
	background: #eb001b;
	left: 0;
}

.stripeease-mc-orange {
	background: #f79e1b;
	left: 11px;
	mix-blend-mode: multiply;
}

/* AMEX */
.stripeease-card-amex {
	color: #007bc1;
	font-size: 0.6rem;
	letter-spacing: 0.06em;
}

/* Stripe text badge */
.stripeease-card-stripe {
	color: #635bff;
	font-weight: 700;
	font-size: 0.68rem;
	letter-spacing: 0.02em;
}

/* ── Popup modal ─────────────────────────────────────────────────────────────── */

/* Full-screen overlay */
.stripeease-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.22s ease;
}

.stripeease-modal--open {
	opacity: 1;
	pointer-events: all;
}

/* Blurred backdrop */
.stripeease-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 24, 40, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

/* Centering wrapper */
.stripeease-modal__wrap {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 480px;
	display: flex;
	flex-direction: column;
}

/* Card container */
.stripeease-modal__container {
	position: relative;
	width: 100%;
	height: 640px;
	border-radius: 20px;
	overflow: hidden;
	background: #f6f8fa;
	box-shadow:
		0 32px 80px rgba(16, 24, 40, 0.28),
		0 8px 24px rgba(16, 24, 40, 0.14);
	transform: translateY(28px) scale(0.96);
	transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stripeease-modal--open .stripeease-modal__container {
	transform: translateY(0) scale(1);
}

/* Close button */
.stripeease-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	background: rgba(255, 255, 255, 0.9);
	color: #6b7280;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
	transition: background 0.14s, color 0.14s, transform 0.12s;
}

.stripeease-modal__close:hover {
	background: #fff;
	color: #1a1f36;
	transform: scale(1.1);
}

.stripeease-modal__close:focus-visible {
	outline: 2px solid #635bff;
	outline-offset: 2px;
}

/* Loading state */
.stripeease-modal__loader {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.85rem;
	background: #f6f8fa;
}

.stripeease-modal__spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e6e9ef;
	border-top-color: #635bff;
	border-radius: 50%;
	animation: stripeease-spin 0.7s linear infinite;
}

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

.stripeease-modal__loader-text {
	font-size: 0.8rem;
	color: #8892a0;
	letter-spacing: 0.01em;
}

/* Payment page iframe */
.stripeease-modal__iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
	background: transparent;
}

/* Prevent body scroll while modal is open */
body.stripeease-modal-open {
	overflow: hidden;
}

/* Mobile — bottom sheet */
@media ( max-width: 560px ) {
	.stripeease-modal {
		align-items: flex-end;
		padding: 0;
	}

	.stripeease-modal__wrap {
		max-width: 100%;
	}

	.stripeease-modal__container {
		height: 88vh;
		border-radius: 24px 24px 0 0;
		transform: translateY(100%);
		transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	.stripeease-modal--open .stripeease-modal__container {
		transform: translateY(0);
	}
}

/* ── Dark mode support ─────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
	.stripeease-payment-wrapper {
		background: linear-gradient(145deg, #1e2235 0%, #252a41 100%);
		border-color: #3d4460;
	}

	.stripeease-checkout-description {
		color: #a3acb9;
	}

	.stripeease-saved-cards__title,
	.stripeease-saved-cards__brand {
		color: #d1d8e2;
	}

	.stripeease-saved-cards__item {
		border-color: #3d4460;
	}

	.stripeease-saved-cards__item:hover {
		background: #2a2f47;
	}

	.stripeease-skeleton {
		background: linear-gradient(90deg, #2a2f47 25%, #333a56 50%, #2a2f47 75%);
		background-size: 200% 100%;
	}
}
