/* Top-up dialog.
   Neutral by design — it inherits the theme's type and colour, and only the
   surface uses a concrete background, since a dialog must be opaque. */

.gvc-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.gvc-modal[hidden] {
	display: none;
}

.gvc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
	opacity: 0;
	transition: opacity 160ms ease;
}

.gvc-modal.is-open .gvc-modal__backdrop {
	opacity: 1;
}

.gvc-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 26rem;
	max-height: calc( 100vh - 2rem );
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	color: #1a1a1a;
	border-radius: 8px;
	box-shadow: 0 18px 50px rgba( 0, 0, 0, 0.3 );
	opacity: 0;
	transform: translateY( 12px ) scale( 0.98 );
	transition: opacity 160ms ease, transform 160ms ease;
}

.gvc-modal.is-open .gvc-modal__dialog {
	opacity: 1;
	transform: none;
}

.gvc-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.1rem 1.25rem 0.5rem;
}

.gvc-modal__title {
	margin: 0;
	font-size: 1.2rem;
	line-height: 1.3;
}

.gvc-modal__close {
	flex: none;
	width: 2rem;
	height: 2rem;
	margin: -0.25rem -0.25rem 0 0;
	padding: 0;
	font-size: 1.5rem;
	line-height: 1;
	background: transparent;
	color: inherit;
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	opacity: 0.6;
}

.gvc-modal__close:hover,
.gvc-modal__close:focus-visible {
	opacity: 1;
}

.gvc-modal__body {
	padding: 0.5rem 1.25rem 1.25rem;
}

/* The form supplies its own outer spacing and width cap, neither of which
   suits a dialog that is already the right size. */
.gvc-modal__body .gvc-topup {
	max-width: none;
	margin-bottom: 0;
}

.gvc-modal__loading {
	margin: 0;
	padding: 1.5rem 0;
	text-align: center;
	opacity: 0.65;
}

.gvc-modal__error {
	margin: 0 0 1rem;
	padding: 0.7rem 0.9rem;
	border: 1px solid currentColor;
	border-radius: 4px;
	font-size: 0.95em;
}

/* Stop the page behind the dialog scrolling on touch devices. */
body.gvc-modal-open {
	overflow: hidden;
}

@media (max-width: 480px) {
	.gvc-modal {
		padding: 0;
		align-items: flex-end;
	}

	.gvc-modal__dialog {
		max-width: none;
		max-height: 92vh;
		border-radius: 12px 12px 0 0;
		transform: translateY( 100% );
	}
}

@media (prefers-color-scheme: dark) {
	.gvc-modal__dialog {
		background: #1c1c1e;
		color: #f2f2f2;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gvc-modal__backdrop,
	.gvc-modal__dialog {
		transition: none;
		transform: none;
	}
}
