/* On Duty — loading overlay, form entrance, images, buttons */

/* ── Screen loader ───────────────────────────────────────────── */

.screen-loader {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	background: rgba(10, 12, 18, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.28s ease;
}

.screen-loader.is-visible {
	opacity: 1;
}

html.onduty-theme-light .screen-loader {
	background: rgba(238, 241, 246, 0.72);
}

.screen-loader__panel {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	padding: 28px 36px;
	border-radius: 12px;
	background: rgba(20, 22, 30, 0.92);
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
	animation: odLoaderPanelIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

html.onduty-theme-light .screen-loader__panel {
	background: rgba(255, 255, 255, 0.96);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.screen-loader__text {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.02em;
	color: #fafbfc;
}

html.onduty-theme-light .screen-loader__text {
	color: #1a1d24;
}

.loader-ring {
	width: 52px;
	height: 52px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: #007aff;
	border-radius: 50%;
	animation: screenLoaderSpin 0.75s linear infinite;
}

html.onduty-theme-light .loader-ring {
	border-color: rgba(0, 122, 255, 0.15);
	border-top-color: #007aff;
}

body.onduty-loading {
	overflow: hidden;
}

/* ── Auth page entrance (login / register standalone) ───────── */

/* Always visible — do not hide until JS runs (was causing blank login/register pages) */
.onduty-login-standalone,
.onduty-register-standalone,
.onduty-hr-standalone {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: no-preference) {
	.onduty-login-standalone.onduty-animate-in,
	.onduty-register-standalone.onduty-animate-in,
	.onduty-hr-standalone.onduty-animate-in {
		animation: odAuthPageIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.onduty-hr-standalone.onduty-animate-in .onduty-hr-dashboard {
		animation: odTitleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.onduty-animate-in .wizard-auth-title,
	.onduty-animate-in .wizard-register-title {
		animation: odTitleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
	}

	.onduty-animate-in .wizard-auth-subtitle,
	.onduty-animate-in .wizard-register-subtitle {
		animation: odTitleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
	}

	.onduty-animate-in .login-from-wrapper,
	.onduty-animate-in .register-from-wrapper {
		animation: odTitleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.14s both;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.onduty-animate-in .from-field-wrapper {
		animation: odFieldIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
	}

	.onduty-animate-in .from-field-wrapper:nth-child(1) { animation-delay: 0.08s; }
	.onduty-animate-in .from-field-wrapper:nth-child(2) { animation-delay: 0.12s; }
	.onduty-animate-in .from-field-wrapper:nth-child(3) { animation-delay: 0.16s; }
	.onduty-animate-in .from-field-wrapper:nth-child(4) { animation-delay: 0.2s; }
	.onduty-animate-in .from-field-wrapper:nth-child(5) { animation-delay: 0.24s; }
	.onduty-animate-in .from-field-wrapper:nth-child(6) { animation-delay: 0.28s; }
	.onduty-animate-in .from-field-wrapper:nth-child(7) { animation-delay: 0.32s; }

	.onduty-animate-in .field-btn-wrapper.wizard-btn-wrapper {
		animation: odFieldIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both;
	}

	.onduty-animate-in p.account-wrapper {
		animation: odFieldIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.42s both;
	}
}

/* Wizard step 6 auth panels (hidden until shown; standalone login/register always visible) */
.onduty-auth-panel {
	opacity: 0;
	transform: translateY(12px);
}

.onduty-login-standalone .onduty-auth-panel,
.onduty-register-standalone .onduty-auth-panel,
.onduty-auth-panel.onduty-auth-panel--visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: no-preference) {
	.wizard-step-6 .onduty-auth-panel.onduty-auth-panel--visible {
		animation: odAuthPageIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	}
}

/* ── Form inputs focus ───────────────────────────────────────── */

.from-field-wrapper input:focus,
.from-field-wrapper input:focus-visible {
	outline: none;
	border-color: #007aff !important;
	box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.22);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.from-field-wrapper input {
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* ── Submit buttons loading state ────────────────────────────── */

button.login-btn.is-loading,
button.register-btn.is-loading {
	position: relative;
	color: transparent !important;
	pointer-events: none;
	min-width: 160px;
}

button.login-btn.is-loading::after,
button.register-btn.is-loading::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 22px;
	height: 22px;
	margin: -11px 0 0 -11px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: screenLoaderSpin 0.65s linear infinite;
}

/* ── Success / error messages ────────────────────────────────── */

.wizard-message.login-message,
.wizard-message.register-message {
	animation: odMessageIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ── Wizard step backgrounds (fade in when step becomes active) ─ */

.wizard-step.wizard-step-3,
.wizard-step.wizard-step-4,
.wizard-step.wizard-step-5 {
	background-color: transparent;
}

.wizard-step.wizard-step-3.active,
.wizard-step.wizard-step-4.active,
.wizard-step.wizard-step-5.active {
	animation: odStepBgIn 0.55s ease 0.1s both;
}

/* ── Wizard images ───────────────────────────────────────────── */

.wizard-step.active img.onduty-img-reveal,
.wizard-step.active .vehicle-card label img,
.wizard-step-1 img {
	animation: odImageIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.vehicle-card label {
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.vehicle-card label:hover {
	transform: translateY(-2px);
}

.vehicle-card input[type="radio"]:checked + label {
	animation: odCardPulse 0.4s ease;
}

/* Only one wizard step in layout (prevents double height / double backgrounds) */
#onduty-wizard > .wizard-step:not(.active) {
	display: none !important;
}

#onduty-wizard > .wizard-step.active {
	display: block !important;
}

.wizard-step.exit-left,
.wizard-step.exit-right {
	display: none !important;
}

/* ── Login ↔ Register toggle (wizard step 6) ─────────────────── */

.login-wrapper.onduty-panel-exit,
.register-wrapper.onduty-panel-exit {
	animation: odPanelOut 0.22s ease forwards;
}

.login-wrapper.onduty-panel-enter,
.register-wrapper.onduty-panel-enter {
	animation: odPanelIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ── Keyframes ───────────────────────────────────────────────── */

@keyframes screenLoaderSpin {
	to { transform: rotate(360deg); }
}

@keyframes odLoaderPanelIn {
	from {
		opacity: 0;
		transform: scale(0.92) translateY(8px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

@keyframes odAuthPageIn {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes odTitleIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes odFieldIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes odImageIn {
	from {
		opacity: 0;
		transform: scale(0.97);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes odStepBgIn {
	from {
		opacity: 0.4;
	}
	to {
		opacity: 1;
	}
}

@keyframes odMessageIn {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes odPanelOut {
	to {
		opacity: 0;
		transform: translateY(-8px);
	}
}

@keyframes odPanelIn {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes odCardPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.02); }
	100% { transform: scale(1); }
}

/* ── Reduced motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.screen-loader,
	.screen-loader__panel,
	.loader-ring,
	.onduty-login-standalone,
	.onduty-register-standalone,
	.onduty-animate-in .from-field-wrapper,
	.onduty-animate-in .field-btn-wrapper,
	.onduty-animate-in p.account-wrapper,
	.wizard-step.active img,
	.wizard-message,
	.login-wrapper,
	.register-wrapper,
	.wizard-step.wizard-step-3.active,
	.wizard-step.wizard-step-4.active,
	.wizard-step.wizard-step-5.active,
	.wizard-truck-bg,
	.wizard-truck {
		animation: none !important;
		transition: none !important;
		opacity: 1 !important;
		transform: none !important;
	}

	.wizard-truck-bg.is-visible {
		opacity: 1 !important;
		visibility: visible !important;
	}

	.screen-loader.is-visible {
		opacity: 1;
	}
}
