/* Shared look for the signed-out pages - login, sign-up and the OTP step that replaces either of
   them in place. It started as an inline block on Login.cshtml; sign-up needed the same rules and
   the OTP partial is injected into both, so a stylesheet beats copying it around.

   Loaded from the "styles" section, which the layout renders before app.css. Anything that
   re-styles a Bootstrap class is therefore scoped under .auth-page (or .auth-input) so it still
   wins on specificity rather than on order. */

:root {
	--auth-brand: #6366f1;
	--auth-brand-2: #8b5cf6;
}

.auth-page {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	padding-top: calc(1.25rem + env(safe-area-inset-top));
	padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
	background: #f4f5fb;
}

.auth-container {
	width: 100%;
	max-width: 400px;
}

/* ── Brand ── */
.auth-brand {
	text-align: center;
	margin-bottom: 1.5rem;
}

.auth-brand-mark {
	width: 60px;
	height: 60px;
	margin: 0 auto 0.85rem;
	border-radius: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--auth-brand), var(--auth-brand-2));
	box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.auth-brand-mark i {
	font-size: 1.9rem;
	color: #fff;
}

.auth-brand-name {
	font-weight: 700;
	font-size: 1.4rem;
	letter-spacing: -0.02em;
	color: #1e293b;
	margin: 0;
}

.auth-brand-sub {
	font-size: 0.9rem;
	color: #64748b;
	margin: 0.15rem 0 0;
}

/* ── Card ── */
.auth-card {
	background: #fff;
	border-radius: 18px;
	padding: 1.5rem 1.35rem;
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
	border: 1px solid #eef0f6;
}

.auth-title {
	font-weight: 600;
	font-size: 1.1rem;
	color: #1e293b;
	margin: 0 0 1.25rem;
}

.auth-sub {
	font-size: 0.87rem;
	color: #64748b;
	margin: -0.85rem 0 1.25rem;
}

/* ── Fields ── */
.auth-field {
	margin-bottom: 1rem;
}

.auth-field .form-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: #475569;
	margin-bottom: 0.4rem;
}

.auth-input {
	position: relative;
}

.auth-input .field-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: #94a3b8;
	font-size: 1.1rem;
	pointer-events: none;
	z-index: 4;
}

.auth-input .form-control {
	height: 52px;
	font-size: 16px; /* prevents iOS zoom-on-focus */
	padding-left: 2.75rem;
	padding-right: 1rem;
	border-radius: 12px;
	border: 1.5px solid #e2e8f0;
	background: #f8fafc;
	color: #1e293b;
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.auth-input .form-control::placeholder {
	color: #b0bacb;
}

.auth-input .form-control:focus {
	border-color: var(--auth-brand);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.auth-input.has-toggle .form-control {
	padding-right: 3rem;
}

/* Bootstrap paints its own invalid state on the wrapper-less input; keep the rounded shape and
   drop the background icon, which would sit under the eye toggle. */
.auth-input .form-control.is-invalid,
.auth-input .was-validated .form-control:invalid {
	background-image: none;
	border-color: #ef4444;
}

.auth-field .invalid-feedback {
	font-size: 0.78rem;
}

.auth-toggle {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: #94a3b8;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	cursor: pointer;
	z-index: 5;
}

.auth-toggle:active {
	background: #eef2ff;
}

.auth-toggle i {
	font-size: 1.15rem;
}

/* ── Password strength meter (sign-up) ── */
.auth-strength {
	display: flex;
	gap: 4px;
	margin-top: 0.5rem;
}

.auth-strength span {
	flex: 1;
	height: 4px;
	border-radius: 2px;
	background: #e2e8f0;
	transition: background 0.15s;
}

.auth-strength[data-score="1"] span:nth-child(-n+1) {
	background: #ef4444;
}

.auth-strength[data-score="2"] span:nth-child(-n+2) {
	background: #f59e0b;
}

.auth-strength[data-score="3"] span:nth-child(-n+3) {
	background: #3b82f6;
}

/* :nth-child is redundant for matching - all four bars are filled at this score - but it keeps
   this rule at the same specificity as its three siblings above. Without it the rule ties with
   the dark-theme base colour further down and loses on order, so the meter went blank in dark
   mode at exactly the score that needs a special character to reach. */
.auth-strength[data-score="4"] span:nth-child(-n+4) {
	background: #10b981;
}

.auth-hint {
	display: block;
	font-size: 0.75rem;
	color: #94a3b8;
	margin-top: 0.35rem;
}

/* ── Captcha ── */
#captchaZone .input-group {
	border-radius: 12px;
}

#captchaZone .form-control {
	height: 52px;
	font-size: 16px;
	border-radius: 0 12px 12px 0;
	border: 1.5px solid #e2e8f0;
	background: #f8fafc;
}

#captchaZone .input-group-text {
	border-radius: 12px 0 0 12px;
	border: 1.5px solid #e2e8f0;
	border-right: none;
	background: #f1f5f9;
	color: #64748b;
}

#captchaZone .form-control:focus {
	border-color: var(--auth-brand);
	box-shadow: none;
}

#captchaZone .dnt-refresh {
	color: var(--auth-brand);
	cursor: pointer;
}

#captchaZone img {
	border-radius: 8px;
	max-width: 100%;
}

/* ── OTP boxes ── */
.auth-otp {
	display: flex;
	gap: 0.4rem;
	margin-bottom: 1.25rem;
}

/* flex-basis 0 with min-width 0 rather than Bootstrap's width:100% - six boxes have to divide the
   card evenly and shrink together on a narrow phone, and a percentage width would overflow. */
.auth-page .auth-otp .form-control {
	flex: 1 1 0;
	min-width: 0;
	width: auto;
	height: 54px;
	padding: 0;
	text-align: center;
	font-size: 1.25rem;
	font-weight: 600;
	letter-spacing: 0;
	border-radius: 10px;
	border: 1.5px solid #e2e8f0;
	background: #f8fafc;
	color: #1e293b;
}

@media (max-width: 360px) {
	.auth-otp {
		gap: 0.3rem;
	}

	.auth-page .auth-otp .form-control {
		height: 48px;
		font-size: 1.1rem;
	}
}

.auth-page .auth-otp .form-control:focus {
	border-color: var(--auth-brand);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* ── Row: remember / terms ── */
.auth-options {
	display: flex;
	align-items: center;
	margin: 0.25rem 0 1.25rem;
}

.auth-options .form-check-label,
.auth-terms .form-check-label {
	font-size: 0.85rem;
	color: #64748b;
}

.auth-page .form-check-input:checked {
	background-color: var(--auth-brand);
	border-color: var(--auth-brand);
}

.auth-page .form-check-input:focus {
	border-color: var(--auth-brand);
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* Scoped under .auth-page to outrank Bootstrap's own .form-check, which this element also
   carries and which zeroes margin-bottom. Equal specificity would lose on order - app.css is
   linked after this file - and the terms row would sit flush against the Sign Up button. */
.auth-page .auth-terms {
	margin: 0.25rem 0 1.5rem;
}

/* ── Sign-up / forgot-password links ── */
.auth-link {
	font-size: 0.85rem;
	color: var(--auth-brand);
	text-decoration: none;
}

.auth-link:hover {
	color: var(--auth-brand-2);
	text-decoration: underline;
}

.auth-signup {
	text-align: center;
	font-size: 0.87rem;
	color: #64748b;
	margin-top: 1.1rem;
}

/* ── Button ── */
.btn-auth {
	width: 100%;
	height: 52px;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.2px;
	border: none;
	border-radius: 12px;
	color: #fff;
	background: linear-gradient(135deg, var(--auth-brand), var(--auth-brand-2));
	box-shadow: 0 6px 16px rgba(99, 102, 241, 0.32);
	transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.btn-auth:hover {
	color: #fff;
	box-shadow: 0 8px 22px rgba(99, 102, 241, 0.42);
}

.btn-auth:active {
	transform: scale(0.99);
}

.btn-auth:disabled {
	opacity: 0.65;
	box-shadow: none;
}

.auth-foot {
	text-align: center;
	font-size: 0.8rem;
	color: #94a3b8;
	margin-top: 1.25rem;
}

/* ── Larger screens ── */
@media (min-width: 576px) {
	.auth-card {
		padding: 1.85rem 1.75rem;
	}
}

/* ── Dark mode ── */
[data-bs-theme="dark"] .auth-page {
	background: #0f1120;
}

[data-bs-theme="dark"] .auth-brand-name {
	color: #f1f5f9;
}

[data-bs-theme="dark"] .auth-brand-sub {
	color: #94a3b8;
}

[data-bs-theme="dark"] .auth-card {
	background: #1a1c2e;
	border-color: #262a41;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .auth-title {
	color: #f1f5f9;
}

[data-bs-theme="dark"] .auth-sub,
[data-bs-theme="dark"] .auth-hint {
	color: #94a3b8;
}

[data-bs-theme="dark"] .auth-field .form-label {
	color: #cbd5e1;
}

[data-bs-theme="dark"] .auth-input .form-control,
[data-bs-theme="dark"] #captchaZone .form-control,
[data-bs-theme="dark"] .auth-page .auth-otp .form-control {
	background: #23263c;
	border-color: #2f3350;
	color: #e2e8f0;
}

[data-bs-theme="dark"] .auth-input .form-control:focus,
[data-bs-theme="dark"] .auth-page .auth-otp .form-control:focus {
	background: #262a42;
	border-color: var(--auth-brand);
}

[data-bs-theme="dark"] .auth-strength span {
	background: #2f3350;
}

[data-bs-theme="dark"] #captchaZone .input-group-text {
	background: #2a2e46;
	border-color: #2f3350;
	color: #94a3b8;
}

[data-bs-theme="dark"] .auth-toggle:active {
	background: #2a2e46;
}

[data-bs-theme="dark"] .auth-options .form-check-label,
[data-bs-theme="dark"] .auth-terms .form-check-label {
	color: #94a3b8;
}

[data-bs-theme="dark"] .auth-signup {
	color: #94a3b8;
}
