/* The sign-in card, and the reset-password card that shares its markup.

   Loaded on every website page through `web_include_css`, so every rule is scoped to the two
   routes by the `data-path` Frappe puts on <body>. Nothing here may leak into the portal or
   the Builder pages. */

body:is([data-path="login"], [data-path="update-password"]) {
	/* The green of the Board's own logo. Same values as `--pc-brand` in `portal_style.html`,
	   repeated here because that stylesheet is not loaded on these two routes. */
	--login-brand: #008d00;
	--login-brand-dark: #006b00;
	--login-brand-deep: #003d00;

	min-height: 100vh;
	background: linear-gradient(165deg, var(--login-brand) 0%, var(--login-brand-dark) 38%, var(--login-brand-deep) 100%) fixed;
}

body:is([data-path="login"], [data-path="update-password"]) .page-content-wrapper {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 100vh;
	min-height: 100svh;
	padding: 32px 16px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-content-wrapper > main {
	width: 100%;
	padding: 0;
}

body:is([data-path="login"], [data-path="update-password"]) .page-breadcrumbs,
body:is([data-path="login"], [data-path="update-password"]) .page-header-wrapper {
	display: none;
}

/* ---- Card ---- */
body:is([data-path="login"], [data-path="update-password"]) .page-card {
	max-width: 440px;
	min-height: 0;
	padding: 24px 30px 20px;
	background-color: #fff;
	border: none;
	border-radius: 20px;
	box-shadow: 0 24px 60px rgba(0, 24, 0, 0.45);
}

/* Frappe's own markup carries `items-start text-left` on this block, and Bootstrap's
   `.text-left` is `!important` - so centring it has to be as well, or the logo centres and
   "Sign In" and the line under it stay left. */
body:is([data-path="login"], [data-path="update-password"]) .page-card-head {
	align-items: center !important;
	text-align: center !important;
	gap: 18px;
	margin-bottom: 12px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card-head .page-card-head-text,
body:is([data-path="login"], [data-path="update-password"]) .page-card-head h4,
body:is([data-path="login"], [data-path="update-password"]) .page-card-head .page-card-subtitle {
	align-items: center;
	text-align: center !important;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card-head img.app-logo {
	max-height: 44px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card-head h4 {
	font-size: 22px;
	color: #171c26;
}

/* ---- Fields ---- */
body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-body input.form-control {
	background-color: #f1f5f3;
	border-color: #dbe5df;
	border-radius: 7px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-body input.form-control:focus {
	background-color: #fff;
	border-color: rgba(0, 141, 0, 0.45);
	box-shadow: 0 0 0 3px rgba(0, 141, 0, 0.14);
	outline: none;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .forgot-password-message > a,
body:is([data-path="login"], [data-path="update-password"]) .page-card .sign-up-message a {
	color: var(--login-brand);
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .forgot-password-message > a:hover,
body:is([data-path="login"], [data-path="update-password"]) .page-card .sign-up-message a:hover {
	text-decoration: underline;
}

/* ---- Primary action ----
   `.btn-signup` is the stock class on the Send Link and Sign Up buttons as well; only its
   enabled state is recoloured, so a disabled one still reads as disabled. */
body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-login,
body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-ldap-login,
body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-signup:not(:disabled) {
	background: var(--login-brand);
	border-radius: 7px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-login:is(:hover, :focus, :active),
body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-ldap-login:is(:hover, :focus, :active),
body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-signup:not(:disabled):is(:hover, :focus, :active) {
	background: var(--login-brand-dark);
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .page-card-actions .btn-login:disabled {
	background: var(--login-brand);
}

/* ---- Primary action, as Frappe draws it now ----
   The rules above name `.btn-login` and `.btn-signup`, which the stock page no longer puts on
   its buttons: "Continue", "Send Link", "Reset" and "Confirm" are all a bare
   `.es-button[data-variant="solid"]` now, and came out in Frappe's near-black. Matched by the
   variant instead of a class, so the next button it adds is covered too. `!important`
   because the stock colour comes from that component's own variables, not from a rule this
   could simply outrank. */
body:is([data-path="login"], [data-path="update-password"]) .page-card .es-button[data-variant="solid"]:not(:disabled) {
	background: var(--login-brand) !important;
	border-color: var(--login-brand) !important;
	color: #fff !important;
	border-radius: 7px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .es-button[data-variant="solid"]:not(:disabled):is(:hover, :focus, :active) {
	background: var(--login-brand-dark) !important;
	border-color: var(--login-brand-dark) !important;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .es-button[data-variant="solid"]:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 141, 0, 0.25);
}

/* ---- Field icons ----
   An envelope in the email fields and a padlock in the password ones. Drawn as a background
   on the input rather than added to the page: the markup is Frappe's, and its wrappers
   (`.email-field`, `.password-field`) are all there is to hold on to. `background-color` is
   set elsewhere and left alone, so the focus tint still applies; the wrapper is matched and
   not `[type=password]`, because showing the password turns the input into `type=text`. */
body:is([data-path="login"], [data-path="update-password"]) .page-card :is(.email-field, .password-field) input.form-control {
	padding-left: 40px;
	background-repeat: no-repeat;
	background-position: 13px center;
	background-size: 17px 17px;
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .email-field input.form-control {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c8a84' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7'/%3E%3C/svg%3E");
}

body:is([data-path="login"], [data-path="update-password"]) .page-card .password-field input.form-control {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c8a84' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}
