/*
 * NEMRA Lighting — auth modals.
 *
 * One modal element renders in two modes (signin / join); the
 * miniOrange OAuth button(s) sit in the middle and handle both new
 * and returning users via the same flow.
 */

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

.nemra-auth-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	font-family: var(--nemra-font-body, 'Poppins', system-ui, sans-serif);
	color: var(--nemra-text, #3f3f3f);
}

.nemra-auth-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 18, 22, 0.55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	cursor: pointer;
}

.nemra-auth-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 480px;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
	padding: 48px 40px 40px;
	box-sizing: border-box;
	animation: nemra-auth-modal-in 180ms ease-out;
}

@keyframes nemra-auth-modal-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.nemra-auth-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--nemra-muted, #6b6b6b);
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}

.nemra-auth-modal__close:hover,
.nemra-auth-modal__close:focus-visible {
	background-color: var(--nemra-surface, #F4F5F7);
	color: var(--nemra-text, #3f3f3f);
}

.nemra-auth-modal__close:focus-visible {
	outline: 2px solid var(--nemra-green, #4c7f39);
	outline-offset: 2px;
}

.nemra-auth-modal__title {
	margin: 0 0 12px;
	font-size: 28px;
	line-height: 1.15;
	letter-spacing: -0.4px;
	font-weight: 400;
	color: var(--nemra-text, #3f3f3f);
}

.nemra-auth-modal__body {
	margin: 0 0 28px;
	font-size: 16px;
	line-height: 1.5;
	color: var(--nemra-muted, #6b6b6b);
}

.nemra-auth-modal__oauth {
	margin: 0 0 28px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* `display: flex` above outranks the browser's `[hidden] { display: none }`,
   so setting the attribute alone left the sign-in button painted on top of
   the join CTA. Anything inside this modal that carries `hidden` must stay
   hidden regardless of its own display rule. */
#nemra-auth-modal [hidden] {
	display: none !important;
}

/* miniOrange renders its own button DOM inside .nemra-auth-modal__oauth.
 * Force its buttons to fill the modal width and match the brand. */
.nemra-auth-modal__oauth a,
.nemra-auth-modal__oauth button,
.nemra-auth-modal__oauth .mo-oauth-buttons,
.nemra-auth-modal__oauth .mo_btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	padding: 12px 18px;
	border-radius: 6px;
	background: var(--nemra-green, #4c7f39);
	color: #ffffff !important;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 500;
	text-decoration: none;
	border: 0;
	cursor: pointer;
	box-sizing: border-box;
	transition: background-color 150ms ease;
}

.nemra-auth-modal__oauth a:hover,
.nemra-auth-modal__oauth button:hover,
.nemra-auth-modal__oauth .mo_btn:hover {
	background: #3f6c30;
}

/* miniOrange's shortcode renders div.mo_adjust_customize_button > div > a >
 * i.mofa > span, with the SSO app's button design written inline on the <i>
 * (a fixed-width pill with its own colour, margins and shadow). The <a> above
 * is already our full-width button, so the pill painted a second button
 * inside the first. Flatten the wrappers and reduce the <i> to its lock glyph
 * and label; the !importants are needed to beat miniOrange's inline styles. */
.nemra-auth-modal__oauth .mo_adjust_customize_button,
.nemra-auth-modal__oauth .mo_adjust_customize_button > div {
	display: block !important;
	width: 100%;
	margin: 0 !important;
}

.nemra-auth-modal__oauth .mo_adjust_customize_button a {
	box-sizing: border-box !important; /* miniOrange sets box-sizing: initial inline */
}

.nemra-auth-modal__oauth a .mofa {
	display: inline-flex !important;
	align-items: center;
	gap: 10px;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	box-shadow: none !important;
	color: inherit !important;
	font-size: 16px !important;
	font-style: normal;
	line-height: 1.2;
}

.nemra-auth-modal__oauth a .mo_oauth_login_button_font {
	margin-left: 0 !important;
	/* The <i> carries the icon font, so "inherit" would render the label in it. */
	font-family: var(--nemra-font-body, 'Poppins', system-ui, sans-serif) !important;
	font-size: inherit !important;
	font-weight: inherit;
}

.nemra-auth-modal__fallback,
.nemra-auth-modal__join-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	padding: 12px 18px;
	border-radius: 6px;
	background: var(--nemra-green, #4c7f39);
	color: #ffffff !important;
	font-size: 16px;
	line-height: 1.2;
	font-weight: 500;
	text-decoration: none;
}

.nemra-auth-modal__join-cta {
	margin-top: 20px;
}

.nemra-auth-modal__footer {
	border-top: 1px solid #e6e6e6;
	padding-top: 20px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--nemra-muted, #6b6b6b);
	text-align: center;
}

.nemra-auth-modal__switch-link {
	background: none;
	border: 0;
	padding: 0;
	margin-left: 4px;
	color: var(--nemra-green, #4c7f39);
	font: inherit;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.nemra-auth-modal__switch-link:hover,
.nemra-auth-modal__switch-link:focus-visible {
	color: #3f6c30;
}

.nemra-auth-modal__switch-link:focus-visible {
	outline: 2px solid var(--nemra-green, #4c7f39);
	outline-offset: 2px;
}

/* Lock body scroll while modal is open. The script toggles this class. */
body.nemra-auth-modal-open {
	overflow: hidden;
}

/* --- Mobile ---------------------------------------------------------- */

@media (max-width: 599px) {
	.nemra-auth-modal {
		padding: 16px;
		align-items: flex-end;
	}

	.nemra-auth-modal__dialog {
		padding: 40px 24px 28px;
		border-radius: 12px 12px 0 0;
		max-width: none;
	}

	.nemra-auth-modal__title {
		font-size: 24px;
	}
}
