/*
 * Microsoft 365 SSO — login page styles
 * Floating card: gradient branding panel (left) + sign-in form (right),
 * centered on a light background. Colours driven by two variables
 * (--m365-primary / --m365-accent) injected from settings.
 */

:root {
	--m365-primary: #4a267d;
	--m365-accent: #ff5202;
	--m365-primary-dark: color-mix(in srgb, var(--m365-primary), #000 40%);
	--m365-accent-ring: color-mix(in srgb, var(--m365-accent) 32%, transparent);
	--m365-page-bg: #ece9f1;
	--m365-ink: #2a1633;
	--m365-muted: #6b6172;
	--m365-faint: #9a90a5;
	--m365-field-bg: #f6f4f9;
	--m365-field-border: #ddd6e6;
	--font-head: "Prompt", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-body: "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Page ---------- */
body.login {
	margin: 0;
	min-height: 100vh;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: var(--m365-page-bg);
	font-family: var(--font-body);
}

/* ---------- Card (brand + form wrapped by JS) ---------- */
.m365-card {
	display: flex;
	width: 1040px;
	max-width: 100%;
	min-height: 620px;
	border-radius: 22px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 30px 70px rgba(60, 20, 80, .28);
}

/* ---------- Left branding panel ---------- */
.m365-brand {
	position: relative;
	width: 46%;
	padding: 56px 48px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	overflow: hidden;
	color: #fff;
	background: linear-gradient(150deg,
		var(--m365-primary-dark) 0%,
		var(--m365-primary) 44%,
		color-mix(in srgb, var(--m365-primary), var(--m365-accent) 62%) 76%,
		var(--m365-accent) 118%);
}
.m365-brand-ring { position: absolute; border-radius: 50%; }
.m365-brand-ring-1 { width: 420px; height: 420px; border: 1px solid rgba(255, 255, 255, .14); top: -150px; right: -160px; }
.m365-brand-ring-2 { width: 280px; height: 280px; border: 1px solid rgba(255, 255, 255, .10); bottom: -90px; left: -110px; }

.m365-brand-head { position: relative; display: flex; align-items: center; gap: 16px; }
.m365-brand-logo {
	width: 64px;
	height: 64px;
	border-radius: 16px;
	overflow: hidden;
	background: rgba(255, 255, 255, .14);
	border: 1px solid rgba(255, 255, 255, .25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-head);
	font-weight: 700;
	font-size: 22px;
	color: #fff;
}
.m365-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
/* Uploaded org logo: white plate + auto width so dark, landscape logos read clearly. */
.m365-brand-logo--custom {
	width: auto;
	min-width: 64px;
	max-width: 190px;
	height: 64px;
	padding: 9px 14px;
	background: #fff;
	border-color: rgba(255, 255, 255, .6);
}
.m365-brand-logo--custom img { width: auto; max-width: 100%; }
/* Logo-only head: no site-name text, so show the logo larger and centred. */
.m365-brand-head--logo { justify-content: center; }
.m365-brand-head--logo .m365-brand-logo--custom {
	height: 96px;
	max-width: 300px;
	padding: 16px 22px;
	border-radius: 18px;
}
.m365-brand-name { font-family: var(--font-head); line-height: 1.15; }
.m365-brand-name-main { font-size: 18px; font-weight: 600; }
.m365-brand-name-sub { font-size: 11px; letter-spacing: .14em; opacity: .85; text-transform: uppercase; margin-top: 3px; }

.m365-brand-body { position: relative; }
.m365-brand-body h1 { font-family: var(--font-head); font-size: 36px; font-weight: 600; line-height: 1.22; margin: 0 0 16px; }
.m365-brand-body p { font-size: 16px; line-height: 1.7; opacity: .9; max-width: 340px; margin: 0; }
.m365-brand-foot { position: relative; font-size: 13px; opacity: .75; }

/* ---------- Right form panel (#login is the white half) ---------- */
#login {
	flex: 1;
	width: auto;
	max-width: none;
	margin: 0;
	padding: 56px 52px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
	z-index: 1;
}
#login h1 { display: none; }

/* The form itself is transparent — the card provides the surface. */
#loginform,
#login form.shake,
.login form {
	background: transparent;
	border: 0;
	box-shadow: none;
	padding: 0;
	margin: 0;
}

/* ---------- Labels & inputs ---------- */
.login form label { color: #4a4054; font-size: 14px; font-weight: 500; }
.login #loginform input[type="text"],
.login #loginform input[type="password"],
.login #loginform input[type="email"] {
	background: var(--m365-field-bg);
	border: 1px solid var(--m365-field-border);
	border-radius: 11px;
	padding: 12px 13px;
	font-size: 15px;
	color: var(--m365-ink);
	box-shadow: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.login #loginform input::placeholder { color: var(--m365-faint); }
.login #loginform input[type="text"]:focus,
.login #loginform input[type="password"]:focus,
.login #loginform input[type="email"]:focus {
	border-color: var(--m365-accent);
	box-shadow: 0 0 0 3px var(--m365-accent-ring);
	outline: none;
}
.login .wp-pwd .button.wp-hide-pw { border: 0; background: transparent; box-shadow: none; color: var(--m365-faint); }
.login .wp-pwd .button.wp-hide-pw:hover { color: var(--m365-accent); }
.login .forgetmenot { color: var(--m365-muted); font-size: 13px; }

/* ---------- SSO block ---------- */
.m365-sso-wrap { text-align: center; }
.m365-sso-heading { font-family: var(--font-head); font-size: 28px; font-weight: 600; color: var(--m365-ink); margin: 0; }
.m365-sso-subtext { font-size: 15px; color: var(--m365-muted); margin: 6px 0 30px; }

.m365-sso-divider {
	display: block;
	position: relative;
	margin: 20px 0 16px;
	color: var(--m365-faint);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .06em;
}
.m365-sso-divider::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	border-top: 1px solid var(--m365-field-border);
}
.m365-sso-divider span { position: relative; background: #fff; padding: 0 12px; }

/* Orange sign-in button (solid accent). No `.button` class → not hijacked by
   theme/AJAX-login scripts binding to `.button`. */
.login .m365-sso-button,
.m365-sso-button {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	box-sizing: border-box;
	width: 100%;
	height: 56px;
	border: 0;
	border-radius: 12px;
	background: var(--m365-accent);
	color: #fff;
	font-family: var(--font-head);
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	text-shadow: none;
	box-shadow: 0 10px 24px color-mix(in srgb, var(--m365-accent) 38%, transparent);
	transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.login .m365-sso-button:hover {
	transform: translateY(-1px);
	filter: brightness(1.03);
	box-shadow: 0 14px 30px color-mix(in srgb, var(--m365-accent) 46%, transparent);
}
.login .m365-sso-button:active { transform: translateY(0); }
.m365-sso-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	background: #fff;
	border-radius: 5px;
}
.m365-sso-logo img { display: block; width: 16px; height: 16px; }

.m365-sso-note {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 22px;
	font-size: 13px;
	line-height: 1.6;
	color: var(--m365-faint);
}
.m365-sso-note svg { color: #22a06b; flex: none; }

/* ---------- Native submit (local login mode) ---------- */
.login #loginform .submit .button-primary,
.login #wp-submit {
	width: 100%;
	float: none;
	display: block;
	height: 52px;
	background: var(--m365-accent);
	border: 0;
	border-radius: 11px;
	font-family: var(--font-head);
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	text-shadow: none;
	box-shadow: 0 10px 24px color-mix(in srgb, var(--m365-accent) 34%, transparent);
	transition: filter .12s ease, transform .05s ease;
}
.login #wp-submit:hover { filter: brightness(1.04); }
.login #wp-submit:active { transform: translateY(1px); }

/* ---------- Messages / errors ---------- */
.login #login_error,
.login .message,
.login .notice {
	background: #fff;
	color: var(--m365-ink);
	border: 1px solid var(--m365-field-border);
	border-left: 4px solid var(--m365-accent);
	border-radius: 12px;
	box-shadow: 0 8px 22px rgba(60, 20, 80, .12);
	padding: 14px 16px;
}
.login #login_error { border-left-color: #e5484d; }

/* ---------- Footer links ---------- */
#nav, #backtoblog { text-align: center; margin-top: 16px; }
#nav a, #backtoblog a,
.login #nav a, .login #backtoblog a { color: var(--m365-muted); text-shadow: none; transition: color .15s ease; }
#nav a:hover, #backtoblog a:hover,
.login #nav a:hover, .login #backtoblog a:hover { color: var(--m365-accent); }
.login .language-switcher { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
	.m365-card { flex-direction: column; min-height: 0; }
	.m365-brand { width: 100%; min-height: 240px; padding: 40px; }
	.m365-brand-body h1 { font-size: 28px; }
	#login { padding: 40px 32px; }
}

/*
 * When local login is disabled, hide the native username/password fields,
 * the submit button, "remember me", and the nav links — but keep the SSO block.
 */
body.m365-local-disabled #loginform > p:not(.m365-sso-wrap),
body.m365-local-disabled #loginform > .user-pass-wrap,
body.m365-local-disabled #loginform > .forgetmenot,
body.m365-local-disabled #loginform > .submit,
body.m365-local-disabled #nav {
	display: none !important;
}
