/*
 * Login page (views/authentication/login_2.php, js/authentication/login.js).
 * Same ledger palette as the sidebar (sidebar.css): the navy brand panel sits on the side the sidebar
 * takes once signed in, the form sits on cream paper, and crimson (--bs-primary) is kept for the one action.
 * The form carries data-step="login|otp"; [data-step-only] blocks show for their step only.
 */

.pln-auth {
	--auth-ink:          #1c2a3b;
	--auth-paper:        #f5eee6;
	--auth-paper-2:      rgba(245, 238, 230, 0.74);
	--auth-paper-3:      rgba(245, 238, 230, 0.5);
	--auth-paper-rule:   rgba(245, 238, 230, 0.16);
	--auth-ruling:       rgba(245, 238, 230, 0.045);
	--auth-seal:         #e0628f;
	--auth-margin:       rgba(224, 98, 143, 0.28);

	--auth-surface:      #faf7f3;
	--auth-text:         #1c2a3b;
	--auth-text-2:       #56606d;
	--auth-text-3:       #8a919b;
	--auth-field:        #ffffff;
	--auth-border:       #ddd6cc;
	--auth-border-hover: #c4bcb1;
	--auth-hover:        rgba(28, 42, 59, 0.05);
	--auth-action:       var(--bs-primary, #981c4b);
	--auth-action-hover: var(--bs-primary-active, #7a1639);
	--auth-focus:        var(--bs-primary, #981c4b);
	--auth-ring:         rgba(152, 28, 75, 0.16);
	--auth-error:        #b42318;
	--auth-error-bg:     #fcefed;
	--auth-error-ring:   rgba(180, 35, 24, 0.14);
	--auth-warn:         #8a5a00;
	--auth-warn-bg:      #fbf3de;
	--auth-info:         #1a6b47;
	--auth-info-bg:      #e9f4ee;

	--auth-radius-sm: 8px;
	--auth-radius-md: 10px;
	--auth-field-h:   48px;
	--auth-panel-w:   392px;
	--auth-ease:      cubic-bezier(0.2, 0.8, 0.2, 1);

	background-color: var(--auth-surface);
	color: var(--auth-text);
	-webkit-font-smoothing: antialiased;
}

[data-bs-theme=dark] .pln-auth {
	--auth-ink:          #13161d;
	--auth-ruling:       rgba(245, 238, 230, 0.03);

	--auth-surface:      #0f1116;
	--auth-text:         #ece5da;
	--auth-text-2:       #a7adb6;
	--auth-text-3:       #7a818c;
	--auth-field:        #171a21;
	--auth-border:       #2a2f39;
	--auth-border-hover: #3a404c;
	--auth-hover:        rgba(255, 255, 255, 0.05);
	--auth-focus:        #e0628f;
	--auth-ring:         rgba(224, 98, 143, 0.22);
	--auth-error:        #f97066;
	--auth-error-bg:     rgba(249, 112, 102, 0.1);
	--auth-error-ring:   rgba(249, 112, 102, 0.18);
	--auth-warn:         #f0a94b;
	--auth-warn-bg:      rgba(240, 169, 75, 0.1);
	--auth-info:         #4fcf8a;
	--auth-info-bg:      rgba(79, 207, 138, 0.1);
}


/* ---------------------------------------------------------------- layout */
.pln-auth__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	min-height: 100vh;
	min-height: 100dvh;
}

@media (min-width: 992px) {
	.pln-auth__layout {
		grid-template-columns: minmax(420px, 0.85fr) minmax(0, 1.15fr);
		grid-template-rows: none;
	}
}


/* ---------------------------------------------------------------- brand panel */
.pln-auth__brand {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	gap: 32px;
	padding: 14px 16px;
	background-color: var(--auth-ink);
	color: var(--auth-paper);
}

@media (min-width: 992px) {
	.pln-auth__brand {
		padding: 40px 64px 32px;
		border-inline-end: 1px solid rgba(255, 255, 255, 0.06);
	}

	/* ledger ruling, fading out at both ends */
	.pln-auth__brand::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: -1;
		background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 35px, var(--auth-ruling) 35px, var(--auth-ruling) 36px);
		-webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
		mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
	}

	/* the ledger's margin line */
	.pln-auth__brand::after {
		content: "";
		position: absolute;
		top: 0;
		bottom: 0;
		inset-inline-start: 36px;
		z-index: -1;
		width: 1px;
		background-color: var(--auth-margin);
	}
}

.pln-auth__watermark {
	display: none;
}

@media (min-width: 992px) {
	.pln-auth__watermark {
		display: block;
		position: absolute;
		inset-inline-end: -110px;
		bottom: -80px;
		z-index: -1;
		width: 420px;
		height: 420px;
		background-color: var(--auth-paper);
		opacity: 0.035;
		transform: rotate(-8deg);
		-webkit-mask: url(../../theme/media/logos/logo2.png) center / contain no-repeat;
		mask: url(../../theme/media/logos/logo2.png) center / contain no-repeat;
	}
}

.pln-auth__identity {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.pln-auth__mark {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background-color: var(--auth-paper);
}

.pln-auth__mark img {
	width: 26px;
	height: 26px;
	object-fit: contain;
}

.pln-auth__name {
	display: block;
	color: var(--auth-paper);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
}

.pln-auth__org {
	display: block;
	color: var(--auth-paper-3);
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.4;
}

.pln-auth__pitch {
	display: none;
}

@media (min-width: 992px) {
	.pln-auth__pitch {
		display: block;
		max-width: 31rem;
		margin-block: auto;
		animation: pln-auth-in 0.5s var(--auth-ease) 0.08s both;
	}
}

.pln-auth__headline {
	margin: 0 0 16px;
	color: var(--auth-paper);
	font-size: clamp(28px, 2.3vw, 36px);
	font-weight: 700;
	line-height: 1.4;
	text-wrap: balance;
}

.pln-auth__lede {
	margin: 0 0 32px;
	color: var(--auth-paper-2);
	font-size: 15.5px;
	line-height: 1.9;
	text-wrap: pretty;
}

/* university → college → department → plan, the order the data is kept in */
.pln-auth__path {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pln-auth__path li {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--auth-paper-2);
	font-size: 13px;
	font-weight: 600;
}

.pln-auth__path li > span {
	padding: 5px 12px;
	border: 1px solid var(--auth-paper-rule);
	border-radius: 6px;
}

.pln-auth__path li:not(:last-child)::after {
	content: "";
	width: 14px;
	height: 1px;
	background-color: var(--auth-paper-rule);
}

.pln-auth__path li:last-child > span {
	border-color: var(--auth-seal);
	color: var(--auth-paper);
}

.pln-auth__brand-foot {
	display: none;
}

@media (min-width: 992px) {
	.pln-auth__brand-foot {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		color: var(--auth-paper-3);
		font-size: 12.5px;
	}
}

.pln-auth__brand-foot a {
	border-radius: 4px;
	color: var(--auth-paper-2);
	text-decoration: none;
	transition: color 0.15s ease;
}

.pln-auth__brand-foot a:hover {
	color: var(--auth-paper);
}

.pln-auth__brand-foot a:focus-visible {
	outline: 2px solid var(--auth-seal);
	outline-offset: 2px;
}


/* ---------------------------------------------------------------- form panel */
.pln-auth__main {
	display: flex;
	flex-direction: column;
	padding: 32px 16px 24px;
}

@media (min-width: 576px) {
	.pln-auth__main {
		padding: 48px 32px 32px;
	}
}

.pln-auth__panel {
	width: 100%;
	max-width: var(--auth-panel-w);
	margin: 0 auto;
}

@media (min-width: 992px) {
	.pln-auth__panel {
		margin: auto;
	}
}

.pln-auth__form[data-step=login] [data-step-only=otp],
.pln-auth__form[data-step=otp] [data-step-only=login] {
	display: none;
}

.pln-auth__step {
	animation: pln-auth-in 0.28s var(--auth-ease) both;
}

.pln-auth__head {
	margin-bottom: 32px;
}

.pln-auth__title {
	margin: 0 0 8px;
	color: var(--auth-text);
	font-size: 28px;
	font-weight: 700;
	line-height: 1.35;
}

.pln-auth__sub {
	margin: 0;
	color: var(--auth-text-2);
	font-size: 15px;
	line-height: 1.75;
	text-wrap: pretty;
}

.pln-auth__row {
	margin-bottom: 20px;
}

.pln-auth__label {
	display: block;
	margin-bottom: 8px;
	color: var(--auth-text);
	font-size: 14px;
	font-weight: 600;
}


/* ---- text fields */
.pln-auth__field {
	position: relative;
}

.pln-auth__field-icon {
	position: absolute;
	top: 50%;
	inset-inline-start: 14px;
	width: 18px;
	height: 18px;
	color: var(--auth-text-3);
	transform: translateY(-50%);
	pointer-events: none;
	transition: color 0.15s ease;
}

.pln-auth__field:focus-within .pln-auth__field-icon {
	color: var(--auth-text-2);
}

.pln-auth__input {
	display: block;
	width: 100%;
	height: var(--auth-field-h);
	padding-block: 0;
	padding-inline: 44px 14px;
	border: 1px solid var(--auth-border);
	border-radius: var(--auth-radius-md);
	background-color: var(--auth-field);
	color: var(--auth-text);
	font-size: 15px;
	font-weight: 500;
	caret-color: var(--auth-focus);
	box-shadow: 0 1px 1px rgba(28, 42, 59, 0.04);
	appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pln-auth__input--reveal {
	padding-inline-end: 48px;
}

.pln-auth__input:hover {
	border-color: var(--auth-border-hover);
}

.pln-auth__input:focus {
	outline: none;
	border-color: var(--auth-focus);
	box-shadow: 0 0 0 4px var(--auth-ring);
}

.pln-auth__input:-webkit-autofill {
	-webkit-text-fill-color: var(--auth-text);
	box-shadow: 0 0 0 100px var(--auth-field) inset;
}

.pln-auth__input:-webkit-autofill:focus {
	box-shadow: 0 0 0 100px var(--auth-field) inset, 0 0 0 4px var(--auth-ring);
}

.pln-auth__input.is-invalid {
	border-color: var(--auth-error);
}

.pln-auth__input.is-invalid:focus {
	box-shadow: 0 0 0 4px var(--auth-error-ring);
}

/* FormValidation message under a field */
.pln-auth .fv-plugins-message-container.invalid-feedback {
	display: block;
	margin-top: 6px;
	color: var(--auth-error);
	font-size: 13px;
	font-weight: 500;
}

.pln-auth__reveal {
	position: absolute;
	top: 50%;
	inset-inline-end: 6px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: var(--auth-radius-sm);
	background: transparent;
	color: var(--auth-text-3);
	transform: translateY(-50%);
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.pln-auth__reveal:hover {
	background-color: var(--auth-hover);
	color: var(--auth-text);
}

.pln-auth__reveal:focus-visible {
	outline: 2px solid var(--auth-focus);
	outline-offset: 0;
}

.pln-auth__reveal svg {
	width: 18px;
	height: 18px;
}

.pln-auth__reveal .is-shown-icon,
.pln-auth__reveal[aria-pressed=true] .is-hidden-icon {
	display: none;
}

.pln-auth__reveal[aria-pressed=true] .is-shown-icon {
	display: block;
}

.pln-auth__hint {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 8px 0 0;
	color: var(--auth-warn);
	font-size: 13px;
	font-weight: 500;
}

.pln-auth__hint svg {
	flex-shrink: 0;
	width: 15px;
	height: 15px;
}


/* ---- one-time code: always left to right, like the digits it holds */
.pln-otp {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr)) 10px repeat(3, minmax(0, 1fr));
	align-items: center;
	gap: 8px;
}

.pln-otp__sep {
	height: 2px;
	border-radius: 1px;
	background-color: var(--auth-border-hover);
}

.pln-otp__digit {
	width: 100%;
	height: 56px;
	padding: 0;
	border: 1px solid var(--auth-border);
	border-radius: var(--auth-radius-md);
	background-color: var(--auth-field);
	color: var(--auth-text);
	font-size: 24px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: center;
	caret-color: var(--auth-focus);
	box-shadow: 0 1px 1px rgba(28, 42, 59, 0.04);
	appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pln-otp__digit:hover {
	border-color: var(--auth-border-hover);
}

.pln-otp__digit.is-filled {
	border-color: var(--auth-border-hover);
}

.pln-otp__digit:focus {
	outline: none;
	border-color: var(--auth-focus);
	box-shadow: 0 0 0 4px var(--auth-ring);
}

.pln-otp.is-rejected {
	animation: pln-auth-shake 0.34s var(--auth-ease);
}

.pln-otp.is-rejected .pln-otp__digit {
	border-color: var(--auth-error);
}

@media (min-width: 420px) {
	.pln-otp {
		gap: 10px;
	}

	.pln-otp__digit {
		height: 60px;
	}
}


/* ---- server message */
.pln-auth__alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 4px;
	padding: 12px 14px;
	border-radius: var(--auth-radius-md);
	background-color: var(--auth-error-bg);
	color: var(--auth-error);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.6;
	animation: pln-auth-in 0.2s var(--auth-ease) both;
}

.pln-auth__alert[data-tone=warning] {
	background-color: var(--auth-warn-bg);
	color: var(--auth-warn);
}

.pln-auth__alert[data-tone=info] {
	background-color: var(--auth-info-bg);
	color: var(--auth-info);
}

.pln-auth__alert svg {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin-top: 2px;
}

.pln-auth__alert .is-info-icon,
.pln-auth__alert[data-tone=info] .is-error-icon {
	display: none;
}

.pln-auth__alert[data-tone=info] .is-info-icon {
	display: block;
}


/* ---- action */
.pln-auth__submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 48px;
	margin-top: 24px;
	padding: 0 20px;
	border: 0;
	border-radius: var(--auth-radius-md);
	background-color: var(--auth-action);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(122, 22, 57, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
	cursor: pointer;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.pln-auth__submit:hover {
	background-color: var(--auth-action-hover);
}

.pln-auth__submit:active {
	transform: translateY(1px);
}

.pln-auth__submit:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px var(--auth-ring);
}

.pln-auth__submit:disabled {
	cursor: default;
}

.pln-auth__submit-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.pln-auth__submit-label svg {
	width: 18px;
	height: 18px;
	transition: transform 0.2s var(--auth-ease);
}

.pln-auth__submit:hover:not(:disabled) .pln-auth__submit-label svg {
	transform: translateX(-3px);
}

.pln-auth__spinner {
	position: absolute;
	inset: 0;
	display: none;
	width: 20px;
	height: 20px;
	margin: auto;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pln-auth-spin 0.7s linear infinite;
}

.pln-auth__submit[aria-busy=true] .pln-auth__submit-label {
	visibility: hidden;
}

.pln-auth__submit[aria-busy=true] .pln-auth__spinner {
	display: block;
}

.pln-auth__aside {
	margin: 16px 0 0;
	color: var(--auth-text-2);
	font-size: 13.5px;
	line-height: 1.7;
	text-align: center;
}

.pln-auth__back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-block: -6px 20px;
	margin-inline-start: -10px;
	padding: 6px 10px;
	border: 0;
	border-radius: var(--auth-radius-sm);
	background: transparent;
	color: var(--auth-text-2);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.pln-auth__back:hover {
	background-color: var(--auth-hover);
	color: var(--auth-text);
}

.pln-auth__back:focus-visible {
	outline: 2px solid var(--auth-focus);
	outline-offset: 0;
}

.pln-auth__back svg {
	width: 16px;
	height: 16px;
}

.pln-auth__link {
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: none;
	color: var(--auth-focus);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 4px;
	cursor: pointer;
	transition: text-decoration-color 0.15s ease;
}

.pln-auth__link:hover:not(:disabled) {
	text-decoration-color: currentColor;
}

.pln-auth__link:disabled {
	color: var(--auth-text-3);
	cursor: default;
}

.pln-auth__link:focus-visible {
	outline: 2px solid var(--auth-focus);
	outline-offset: 2px;
}

.pln-num {
	font-variant-numeric: tabular-nums;
}

.pln-auth__notice {
	width: 100%;
	max-width: var(--auth-panel-w);
	margin: auto auto 0;
	padding-top: 40px;
	color: var(--auth-text-3);
	font-size: 12.5px;
	line-height: 1.7;
	text-align: center;
	text-wrap: balance;
}

@media (min-width: 992px) {
	.pln-auth__notice {
		margin-top: 40px;
		padding-top: 0;
	}
}


/* ---------------------------------------------------------------- motion */
@keyframes pln-auth-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes pln-auth-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes pln-auth-shake {
	0%, 100% { transform: none; }
	20%      { transform: translateX(-6px); }
	40%      { transform: translateX(5px); }
	60%      { transform: translateX(-3px); }
	80%      { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
	.pln-auth__pitch,
	.pln-auth__step,
	.pln-auth__alert,
	.pln-otp.is-rejected {
		animation: none;
	}

	.pln-auth__submit:active,
	.pln-auth__submit:hover:not(:disabled) .pln-auth__submit-label svg {
		transform: none;
	}
}
