/*
 * Overlay/backdrop chrome only — a popup needs a dimmed backdrop and
 * centering that a plain page section doesn't. The dialog itself is the
 * OTP plugin's own `.annghar-otp-card` (its own CSS: border radius, box
 * shadow, padding, step-transition animation), the exact same element/
 * class already used unmodified on the My Account page. Nothing here
 * overrides it.
 */

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

.agm-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
}

.agm-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, .5 );
	backdrop-filter: blur( 6px );
	-webkit-backdrop-filter: blur( 6px );
	opacity: 0;
	transition: opacity var( --agm-animation-speed ) ease;
}

.agm-modal__dialog-wrap {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 420px;
	max-height: calc( 100vh - 32px - var( --agm-safe-top ) - var( --agm-safe-bottom ) );
	overflow-y: auto;
	opacity: 0;
	transform: scale( .96 );
	transition: opacity var( --agm-animation-speed ) ease, transform var( --agm-animation-speed ) ease;
}

.agm-modal.is-open .agm-modal__overlay {
	opacity: 1;
}

.agm-modal.is-open .agm-modal__dialog-wrap {
	opacity: 1;
	transform: scale( 1 );
}

/* The reused card sets its own max-width/margin for a plain page; inside
   our wrap it just needs to fill it instead. */
.agm-modal__dialog-wrap .annghar-otp-card {
	max-width: none;
	margin: 0;
}

.agm-modal__close {
	position: absolute;
	top: 8px;
	right: 8px;
	min-width: var( --agm-tap-size );
	min-height: var( --agm-tap-size );
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	color: inherit;
	opacity: .6;
	cursor: pointer;
	z-index: 2;
}

.agm-modal__close:hover {
	opacity: 1;
}

/* While showing "Login Successful", hide the form controls so the
   message is the only thing left in the card. */
.agm-login-success .annghar-otp-phone-wrap,
.agm-login-success .annghar-otp-button,
.agm-login-success .annghar-otp-resend-row,
.agm-login-success #annghar_otp_code,
.agm-login-success label[for="annghar_otp_code"],
.agm-login-success .annghar-otp-subtitle {
	display: none;
}

.agm-login-success .annghar-otp-message {
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	margin-top: 8px;
}

@media ( prefers-reduced-motion: reduce ) {
	body.agm-respect-reduced-motion .agm-modal__overlay,
	body.agm-respect-reduced-motion .agm-modal__dialog-wrap {
		transition: none !important;
	}
}
