/*
	The sign-in - /login in the portal's dress.

	The page loads portal.css before it: the brand, the wordmark, .panel, .input
	and .btn come from there. Here stands what only the sign-in needs - and the
	handful of styles for frappe's classes, because the page does not load
	website.bundle.css and frappe's login.js thinks in these classes.
*/

/* ---- Buehne ----------------------------------------------------------- */

.signin {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.9rem;
	padding: 3rem 1.25rem;
	animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/*
	Smaller than on the start page: there the mark is the content, here the
	card.
*/
.signin .mark { width: 64px; height: 64px; }
.signin .wordmark { margin-bottom: 0.5rem; }

.noscript {
	margin: 0;
	font-size: 0.75rem;
	color: #d16a5e;
}

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

/* ---- the card --------------------------------------------------------- */

/*
	There always stands exactly one card; which one login.js decides through the
	address bar. The sign-in is the default and is not hidden in advance - were
	the script to stay away, the page would otherwise be empty.
*/
.for-forgot,
.for-login-with-email-link,
.for-signup { display: none; }

.for-login,
.for-email-login,
.for-forgot,
.for-login-with-email-link,
.for-signup { width: 100%; }

.login-content {
	width: 100%;
	max-width: 21rem;
	margin: 0 auto;
	padding: 1.25rem;
}

/* ---- Felder ----------------------------------------------------------- */

.form-group { margin-bottom: 0.85rem; }
.form-group:last-child { margin-bottom: 0; }

.field-label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.75rem;
	color: var(--muted);
}

/* .form-control: the field for the second factor login.js builds itself. */
.login-content .input,
.login-content .form-control {
	width: 100%;
	max-width: none;
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--hairline-strong);
	border-radius: 6px;
	background: #131316;
	color: var(--ink);
	font: inherit;
	font-size: 0.8125rem;
}

.login-content .input:focus-visible,
.login-content .form-control:focus-visible {
	outline: none;
	border-color: rgba(255, 255, 255, 0.34);
}

.login-content ::placeholder { color: var(--faint); }

.password { position: relative; }
.password .input { padding-right: 2.1rem; }

.toggle-password {
	position: absolute;
	top: 50%;
	right: 0.5rem;
	transform: translateY(-50%);
	display: flex;
	padding: 0;
	border: 0;
	background: none;
	color: var(--faint);
	cursor: pointer;
}

.toggle-password svg { fill: currentColor; }
.toggle-password:hover, .toggle-password:focus-visible { color: var(--ink); }

/* ---- Buttons and ways ------------------------------------------------ */

.page-card-actions {
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
	margin-top: 1.1rem;
}

.btn--full {
	display: block;
	width: 100%;
	padding: 0.5rem 0.9rem;
	text-align: center;
}

/*
	login.js locks buttons as long as nothing is typed in or the link is on its
	way already.
*/
.btn--full:disabled { color: var(--faint); cursor: default; }
.btn--full:disabled:hover { border-color: var(--hairline-strong); background: var(--raised); }

/* ---- Anbieter --------------------------------------------------------- */

/*
	The button for the company account, below the form. Several providers would
	be below one another - set up is one (Google).
*/
.provider {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.btn--provider {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

/*
	The logo of the provider brings its own colours along and therefore does not
	take the colour of the text - unlike the icons in the rest of the portal,
	which follow `currentColor`.
*/
.btn--provider img {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
}

/*
	Between the password and the provider: a line with the word in the middle.
	Without a margin of its own - the card stands in .page-card-actions, and its
	`gap` sets the distance upwards as downwards.
*/
.separator {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0;
	font-size: 0.6875rem;
	color: var(--faint);
}

.separator::before,
.separator::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--hairline-strong);
}

.channels {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	margin: 0;
	font-size: 0.75rem;
	color: var(--faint);
}

.channels a {
	color: var(--faint);
	text-decoration: none;
	transition: color 0.18s ease;
}

.channels a:hover, .channels a:focus-visible { color: var(--ink); }
.channels span { opacity: 0.45; }

/* ---- Rueckmeldung ----------------------------------------------------- */

/* Both bands login.js makes visible with display:flex. */
.login-error-banner,
.login-success-banner {
	display: none;
	align-items: center;
	gap: 0.45rem;
	margin: 0 0 0.85rem;
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--hairline);
	border-left-width: 2px;
	border-radius: 6px;
	font-size: 0.75rem;
	color: var(--ink);
}

.login-error-banner { border-left-color: #d16a5e; }
.login-success-banner { border-left-color: #4fae6a; }
.login-error-banner svg { flex-shrink: 0; fill: #d16a5e; }
.login-success-banner svg { flex-shrink: 0; fill: #4fae6a; }

.field-error {
	display: none;
	margin: 0.3rem 0 0;
	font-size: 0.6875rem;
	color: #d16a5e;
}

.form-group.invalid .field-error { display: block; }

.form-group.invalid .input,
.page-card-body.invalid .input {
	border-color: color-mix(in srgb, #d16a5e 55%, transparent);
}

/* A wrong password: the card wobbles once. */
.invalid-login { animation: wackeln 0.4s ease-in-out; }

@keyframes wackeln {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-4px); }
	40% { transform: translateX(4px); }
	60% { transform: translateX(-3px); }
	80% { transform: translateX(3px); }
}

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

/* Visible only once the link is out - login.js sets display:flex. */
.resend-link {
	display: none;
	align-items: center;
	gap: 0.35rem;
	margin: 0;
	font-size: 0.75rem;
	color: var(--faint);
}

.resend-link a { color: var(--muted); }
.resend-link a:hover { color: var(--ink); }

/* ---- what frappe brings along ----------------------------------------- */

/*
	Without website.bundle.css these classes are missing, and login.js uses
	them: .hide at the forms until the script runs, the rest in the form for the
	second factor and in system messages.
*/
.hide { display: none; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.btn-block { display: block; width: 100%; }

.indicator {
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
}

#twofactor_div { display: flex; flex-direction: column; gap: 0.8rem; }
#twofactor_div .form-verify { display: flex; flex-direction: column; gap: 0.8rem; }

/*
	frappe.call(freeze) lays this area over the page during the signing in -
	without a style it would be invisible, and a second click would go through.
*/
#freeze {
	position: fixed;
	inset: 0;
	z-index: 10;
	background: rgba(0, 0, 0, 0.35);
	opacity: 0;
	transition: opacity 0.2s ease;
}

#freeze.in { opacity: 1; }

/*
	After the signing in login.js replaces the page content with this, until the
	redirect takes hold.
*/
.splash { margin: auto; }
