/* =========================================================================
   MGD Login Modal

   Colours come from the theme's own tokens with literal fallbacks, so the
   dialog follows the Customizer the way the "Chip In" panel does rather than
   hard-coding a palette of its own.
   ========================================================================= */

.mgdlm-overlay {
	position: fixed;
	inset: 0;
	/* Above the sticky header and every BuddyPress overlay on the site — the
	   gift lightbox tops out at 10002. */
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: rgba(0, 0, 0, .55);
}

.mgdlm-overlay[hidden] {
	display: none;
}

.mgdlm-dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 400px;
	margin: auto;
	padding: 28px 28px 24px;
	background: var(--color-theme-white-box, #fff);
	border-radius: var(--global-border-radius, 6px);
	box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
	/* The overlay fades; the panel also rises, so the eye lands on it rather
	   than on the dimmed page behind. */
	animation: mgdlm-rise .18s ease-out;
}

@keyframes mgdlm-rise {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.mgdlm-dialog { animation: none; }
}

/* Same !important treatment the other dialogs on this site need: BuddyX
   styles bare <button> elements as pills with their own radius. */
.mgdlm-close,
#buddypress .mgdlm-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0 !important;
	font-size: 22px;
	line-height: 1;
	color: #888;
	background: none !important;
	border: 0 !important;
	border-radius: 6px !important;
	cursor: pointer;
	transition: color .15s, background .15s;
}

.mgdlm-close:hover,
.mgdlm-close:focus-visible,
#buddypress .mgdlm-close:hover {
	color: #222;
	background: rgba(0, 0, 0, .06) !important;
}

.mgdlm-title {
	margin: 0 0 20px;
	padding-right: 28px;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--color-h1, #1d2327);
}

/* -------------------------------------------------------------- fields -- */

.mgdlm-field {
	margin-bottom: 16px;
}

.mgdlm-field label {
	display: block;
	margin-bottom: 6px;
	font-size: .8125rem;
	font-weight: 600;
	color: #555;
}

.mgdlm-field input[type="text"],
.mgdlm-field input[type="password"] {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 10px 12px;
	font-size: 15px;
	line-height: 1.3;
	color: inherit;
	background: #fff;
	border: 1px solid var(--global-border-color, #e7e9ec);
	border-radius: var(--global-border-radius, 6px);
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
}

.mgdlm-field input:focus {
	outline: none;
	border-color: var(--color-theme-primary, #ef5455);
	box-shadow: 0 0 0 3px rgba(239, 84, 85, .15);
}

/* The eye sits inside the field, so the input reserves room for it. */
.mgdlm-pwd-wrap {
	position: relative;
}

.mgdlm-pwd-wrap input {
	padding-right: 44px !important;
}

.mgdlm-pwd-toggle,
#buddypress .mgdlm-pwd-toggle {
	position: absolute;
	top: 50%;
	right: 4px;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0 !important;
	color: #8a8f98;
	background: none !important;
	border: 0 !important;
	border-radius: 6px !important;
	cursor: pointer;
	transition: color .15s;
}

.mgdlm-pwd-toggle:hover,
.mgdlm-pwd-toggle:focus-visible {
	color: var(--color-theme-primary, #ef5455);
}

/* The slash is drawn only while the password is hidden: once it is on screen,
   the plain eye reads as "this is visible". */
.mgdlm-pwd-toggle[aria-pressed="true"] .mgdlm-eye-slash {
	display: none;
}

/* ------------------------------------------------- remember / lost pwd -- */

.mgdlm-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 4px 0 20px;
	font-size: .8125rem;
}

.mgdlm-remember {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0;
	font-weight: 500;
	color: #555;
	cursor: pointer;
}

.mgdlm-remember input {
	width: auto;
	margin: 0;
}

.mgdlm-lost,
.mgdlm-register a {
	color: var(--color-theme-primary, #ef5455);
	text-decoration: none;
}

.mgdlm-lost:hover,
.mgdlm-register a:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------- submit -- */

.mgdlm-submit,
#buddypress .mgdlm-submit {
	display: block;
	box-sizing: border-box;
	width: 100%;
	padding: 12px 16px !important;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: var(--color-theme-primary, #ef5455) !important;
	border: 0 !important;
	border-radius: var(--global-border-radius, 6px) !important;
	cursor: pointer;
	transition: filter .15s, opacity .15s;
}

.mgdlm-submit:hover:not(:disabled) {
	filter: brightness(1.07);
}

.mgdlm-submit:disabled {
	opacity: .65;
	cursor: default;
}

/* Failure text keeps the field it refers to in view — it sits under the
   button, where the eye ends up after a submit. */
.mgdlm-msg {
	margin: 14px 0 0;
	padding: 10px 12px;
	font-size: .8125rem;
	line-height: 1.45;
	color: #8a1f24;
	background: #fdecec;
	border-radius: var(--global-border-radius, 6px);
}

.mgdlm-msg[hidden] {
	display: none;
}

.mgdlm-msg a {
	color: inherit;
	text-decoration: underline;
}

.mgdlm-register {
	margin: 18px 0 0;
	font-size: .8125rem;
	color: #666;
	text-align: center;
}

/* Nothing behind the overlay scrolls while it is open. */
body.mgdlm-open {
	overflow: hidden;
}

@media screen and (max-width: 480px) {
	.mgdlm-dialog {
		padding: 24px 18px 20px;
	}
}
