/* Custom Stripe Gateway - modern card form */
.csg-card-form {
	--csg-accent: #635bff;
	--csg-accent-soft: rgba(99, 91, 255, .16);
	--csg-border: #e2e5ea;
	--csg-border-hover: #c4c9d2;
	--csg-text: #111827;
	--csg-muted: #6b7280;
	--csg-danger: #dc2626;
	--csg-danger-soft: rgba(220, 38, 38, .14);
	--csg-radius: 10px;

	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 10px 0 4px;
	padding: 20px;
	background: #fff;
	border: 1px solid var(--csg-border);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
	color: var(--csg-text);
	font-size: 14px;
	line-height: 1.4;
}

.csg-card-form *,
.csg-card-form *::before,
.csg-card-form *::after {
	box-sizing: border-box;
}

/* Header */
.csg-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.csg-secure {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--csg-text);
}

.csg-secure svg {
	color: #16a34a;
}

.csg-brands {
	display: inline-flex;
	gap: 6px;
}

.csg-brands svg {
	width: 32px;
	height: 22px;
	opacity: .55;
	filter: grayscale(.4);
	transition: opacity .2s ease, filter .2s ease, transform .2s ease;
}

.csg-brands svg.is-active {
	opacity: 1;
	filter: none;
	transform: translateY(-1px);
}

.csg-brands.has-brand svg:not(.is-active) {
	opacity: .25;
}

/* Fields */
.csg-field {
	margin-bottom: 14px;
	min-width: 0;
}

.csg-label {
	display: block;
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .02em;
	color: var(--csg-muted);
}

.csg-input {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 50px;
	padding: 0 14px;
	background: #fff;
	border: 1.5px solid var(--csg-border);
	border-radius: var(--csg-radius);
	transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.csg-input:hover {
	border-color: var(--csg-border-hover);
}

.csg-input.is-focused {
	border-color: var(--csg-accent);
	box-shadow: 0 0 0 4px var(--csg-accent-soft);
}

.csg-input.is-invalid {
	border-color: var(--csg-danger);
	box-shadow: 0 0 0 4px var(--csg-danger-soft);
}

.csg-stripe-el {
	display: block;
	position: relative;
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: 24px;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	box-shadow: none;
	overflow: visible;
	pointer-events: auto;
}

/* Stripe renders each field inside .StripeElement > .__PrivateStripeElement > iframe.
   Many themes style "iframe", "div" or responsive embeds; neutralise that here. */
.csg-stripe-el .StripeElement,
.csg-stripe-el .__PrivateStripeElement {
	display: block !important;
	width: 100% !important;
	height: 24px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	position: relative !important;
}

.csg-stripe-el iframe {
	display: block !important;
	position: static !important;
	width: 100% !important;
	max-width: none !important;
	min-width: 0 !important;
	height: 24px !important;
	min-height: 24px !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	aspect-ratio: auto !important;
	transform: none !important;
	float: none !important;
	pointer-events: auto !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.csg-brand-icon {
	display: inline-flex;
	flex: 0 0 auto;
	width: 34px;
	height: 24px;
}

.csg-brand-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.csg-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.csg-row .csg-field {
	margin-bottom: 0;
}

.csg-lock-icon {
	flex: 0 0 auto;
	color: var(--csg-muted);
}

/* Error + footer */
.csg-error {
	min-height: 0;
	margin-top: 12px;
	font-size: 13px;
	font-weight: 500;
	color: var(--csg-danger);
}

.csg-error:empty {
	display: none;
}

.csg-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid #f0f1f4;
	font-size: 12px;
	color: var(--csg-muted);
}

/* Test mode notice */
.csg-test-notice {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 8px;
	padding: 8px 12px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: 8px;
	color: #92400e;
	font-size: 13px;
}

.csg-test-notice strong {
	letter-spacing: .04em;
}

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

/* Header may wrap instead of squeezing; never overflow the screen. */
.csg-card-header {
	flex-wrap: wrap;
}

.csg-card-form,
.csg-card-form .csg-field,
.csg-card-form .csg-row {
	max-width: 100%;
}

.csg-card-form {
	-webkit-tap-highlight-color: transparent;
	-webkit-text-size-adjust: 100%;
}

.csg-test-notice {
	flex-wrap: wrap;
	max-width: 100%;
}

/* Tablets and large phones */
@media (max-width: 600px) {
	.csg-card-form {
		margin-top: 8px;
		padding: 16px;
		border-radius: 14px;
		box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
	}

	.csg-card-header {
		margin-bottom: 14px;
	}

	.csg-label {
		font-size: 12.5px;
	}

	/* Taller, thumb-friendly fields */
	.csg-input {
		height: 54px;
		padding: 0 14px;
		gap: 10px;
	}

	.csg-row {
		gap: 10px;
	}

	.csg-footer {
		margin-top: 14px;
		padding-top: 12px;
		text-align: center;
		flex-wrap: wrap;
	}
}

/* Phones */
@media (max-width: 420px) {
	.csg-card-form {
		padding: 14px;
	}

	.csg-brands svg {
		width: 28px;
		height: 20px;
	}

	.csg-brands svg:nth-child(n+4) {
		display: none;
	}

	.csg-brand-icon {
		width: 30px;
		height: 22px;
	}

	.csg-secure {
		font-size: 12.5px;
	}

	.csg-error {
		font-size: 12.5px;
	}
}

/* Very small phones: stack expiry and security code, drop decorative icon */
@media (max-width: 340px) {
	.csg-row {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.csg-row .csg-field {
		margin-bottom: 14px;
	}

	.csg-row .csg-field:last-child {
		margin-bottom: 0;
	}

	.csg-brands {
		display: none;
	}

	.csg-lock-icon {
		display: none;
	}
}

/* Landscape phones: keep the form compact */
@media (max-height: 480px) and (orientation: landscape) {
	.csg-card-form {
		padding: 12px 16px;
	}

	.csg-footer {
		display: none;
	}
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
	.csg-input,
	.csg-brands svg {
		transition: none;
	}
}
