/* 3PL Theme, login page (DEC-221). Added to /login only, by tpl_theme.services.login (hook update_website_context),
   and only when TPL Theme Settings "Enable Theme" is on. Every rule is scoped to body.tpl-theme-login, the class the
   same hook adds, so the standard login is untouched when the theme is off or the app is uninstalled.
   Same tokens as the desk (tpl_theme_desk.css); --tpl-primary is set from the settings by the hook.
   Logical properties only: Arabic mirrors the field icons and the "Show" toggle.
   Fonts: English keeps Frappe's Inter; Arabic gets tpl_core's Cairo (tpl_rtl_font.css, DEC-216). */

/* ------------------------------------------------------------------ tokens */
body.tpl-theme-login {
	--tpl-primary: #5b5ceb;
	--tpl-primary-hover: color-mix(in srgb, var(--tpl-primary) 86%, #000);
	--tpl-primary-soft: color-mix(in srgb, var(--tpl-primary) 10%, #fff);
	--tpl-primary-ring: color-mix(in srgb, var(--tpl-primary) 22%, transparent);
	--tpl-bg: #f7f8fc;
	--tpl-surface: #ffffff;
	--tpl-border: #e6e8f0;
	--tpl-control-bg: #f4f5fa;
	--tpl-text: #1f2333;
	--tpl-muted: #6b7280;
	--tpl-radius: 8px;
	--tpl-radius-btn: 6px;

	--primary: var(--tpl-primary);
	--primary-color: var(--tpl-primary);
	--btn-primary: var(--tpl-primary);
	--text-color: var(--tpl-text);
	--text-muted: var(--tpl-muted);
	--border-color: var(--tpl-border);
	--control-bg: var(--tpl-control-bg);

	background-color: var(--tpl-bg);
	background-image: radial-gradient(
		ellipse 900px 420px at 50% -120px,
		var(--tpl-primary-soft) 0%,
		transparent 70%
	);
	background-repeat: no-repeat;
	color: var(--tpl-text);
}

/* Arabic: Frappe's website pages set <html lang="ar"> but no dir, so the page would stay left-to-right. */
body.tpl-theme-login:lang(ar) {
	direction: rtl;
}
/* a typed e-mail address keeps its own (left-to-right) order inside the mirrored field */
body.tpl-theme-login:lang(ar) section .page-card input {
	unicode-bidi: plaintext;
}

/* ------------------------------------------------------------------ website top bar */
body.tpl-theme-login .navbar {
	background: var(--tpl-surface);
	border-bottom: 1px solid var(--tpl-border);
	box-shadow: none;
}
body.tpl-theme-login .navbar a.nav-link:hover,
body.tpl-theme-login .navbar .navbar-brand:hover {
	color: var(--tpl-primary);
}

/* ------------------------------------------------------------------ brand + heading */
body.tpl-theme-login .page-card-head {
	padding-block: max(6vh, 32px) 18px;
}
body.tpl-theme-login .page-card-head img.app-logo {
	height: 48px;
	max-height: 48px;
	max-width: 160px;
	object-fit: contain;
}
body.tpl-theme-login .page-card-head h4 {
	margin-top: 14px;
	margin-bottom: 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--tpl-text);
}

/* ------------------------------------------------------------------ card */
body.tpl-theme-login section .page-card {
	max-width: 420px;
	padding: 36px 28px;
	background-color: var(--tpl-surface);
	border: 1px solid var(--tpl-border);
	border-radius: 12px;
	box-shadow:
		0 1px 2px rgba(31, 35, 51, 0.04),
		0 8px 24px rgba(31, 35, 51, 0.06);
}
body.tpl-theme-login section .page-card form {
	max-width: none;
}

/* ------------------------------------------------------------------ fields */
body.tpl-theme-login section .page-card .page-card-body input[type="text"],
body.tpl-theme-login section .page-card .page-card-body input[type="email"],
body.tpl-theme-login section .page-card .page-card-body input[type="password"],
body.tpl-theme-login section .page-card .form-control {
	height: 42px;
	border: 1px solid var(--tpl-border);
	border-radius: var(--tpl-radius-btn);
	background-color: var(--tpl-control-bg);
	color: var(--tpl-text);
	font-size: 14px;
	transition:
		border-color 0.12s ease,
		box-shadow 0.12s ease,
		background-color 0.12s ease;
}
body.tpl-theme-login section .page-card .page-card-body input:focus,
body.tpl-theme-login section .page-card .form-control:focus {
	border-color: var(--tpl-primary);
	background-color: var(--tpl-surface);
	box-shadow: 0 0 0 3px var(--tpl-primary-ring);
	outline: none;
}
body.tpl-theme-login section .page-card .page-card-body.invalid input {
	border-color: var(--red-500, #e03636);
}
body.tpl-theme-login section .page-card .page-card-body .email-field input,
body.tpl-theme-login section .page-card .page-card-body .password-field input {
	padding-inline: 38px 12px;
}
body.tpl-theme-login section .page-card .page-card-body .password-field input {
	padding-inline-end: 56px;
}
body.tpl-theme-login section .page-card .page-card-body .field-icon {
	inset-inline: 12px auto;
	top: 21px;
	transform: translateY(-50%);
	color: var(--tpl-muted);
}
body.tpl-theme-login section .page-card .page-card-body .password-field .toggle-password {
	inset-inline: auto 12px;
	top: 21px;
	transform: translateY(-50%);
	color: var(--tpl-primary) !important;
	font-weight: 500;
}
body.tpl-theme-login section .page-card .page-card-body .forgot-password-message {
	text-align: end;
}
body.tpl-theme-login section .page-card .page-card-body .forgot-password-message > a {
	color: var(--tpl-primary);
	font-weight: 500;
}

/* ------------------------------------------------------------------ buttons and links */
body.tpl-theme-login .btn {
	border-radius: var(--tpl-radius-btn);
}
body.tpl-theme-login .btn-primary {
	background-color: var(--tpl-primary);
	border-color: var(--tpl-primary);
	color: #fff;
	box-shadow: none;
}
body.tpl-theme-login .btn-primary:hover,
body.tpl-theme-login .btn-primary:focus,
body.tpl-theme-login .btn-primary:active {
	background-color: var(--tpl-primary-hover);
	border-color: var(--tpl-primary-hover);
	color: #fff;
}
body.tpl-theme-login section .page-card .page-card-actions .btn {
	height: 42px;
	font-size: 14px;
	font-weight: 600;
}
body.tpl-theme-login section .page-card .page-card-body .btn-login-option {
	height: 40px;
	align-items: center;
	border: 1px solid var(--tpl-border);
	background: var(--tpl-surface);
}
body.tpl-theme-login section .page-card .page-card-body .btn-login-option:hover {
	border: 1px solid var(--tpl-primary);
	background: var(--tpl-primary-soft);
}
body.tpl-theme-login .sign-up-message,
body.tpl-theme-login .login-divider {
	color: var(--tpl-muted);
}
body.tpl-theme-login .sign-up-message a,
body.tpl-theme-login section .page-card a {
	color: var(--tpl-primary);
	font-weight: 500;
}
body.tpl-theme-login section .page-card a.btn-primary {
	color: #fff;
}

/* ------------------------------------------------------------------ small screens */
@media (max-width: 575.98px) {
	body.tpl-theme-login section .page-card {
		margin-inline: 16px;
		padding: 28px 20px;
	}
}
