/* ============================================================
   INFERNUS — Auth-Modal und Alert-System
   Baut auf den Token aus style.css auf (--bg, --accent, --accent-2, --text).
   ============================================================ */

:root {
	--surface: #1c1c24;
	--surface-2: #23232d;
	--line: #32323f;
	--line-strong: #414151;
	--muted: #a3a1b0;
	--dim: #7c7a8a;
	--ok: #3e9e76;
	--warn: #d9a01f;
	--err: #e0554b;
	--radius: 14px;
	--ease: cubic-bezier(0.2, 0.9, 0.25, 1);
}

/* ------------------------------------------------------------ Hilfsklassen */
.a-hidden {
	display: none !important;
}

.a-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

body.a-locked {
	overflow: hidden;
}

/* ================================================================= ALERTS */
.alerts {
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 9000;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: min(380px, calc(100vw - 32px));
	pointer-events: none;
}

@media (max-width: 560px) {
	.alerts {
		top: auto;
		bottom: 16px;
		left: 16px;
		right: 16px;
		width: auto;
		flex-direction: column-reverse;
	}
}

.alert {
	pointer-events: auto;
	position: relative;
	display: grid;
	grid-template-columns: 22px 1fr 24px;
	gap: 12px;
	align-items: start;
	padding: 14px 14px 14px 16px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-left: 3px solid var(--dim);
	border-radius: 10px;
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	animation: alert-in 0.28s var(--ease) both;
}

.alert.is-leaving {
	animation: alert-out 0.2s ease-in both;
}

@keyframes alert-in {
	from {
		opacity: 0;
		transform: translateX(16px) scale(0.98);
	}
}

@keyframes alert-out {
	to {
		opacity: 0;
		transform: translateX(16px);
	}
}

@media (max-width: 560px) {
	@keyframes alert-in {
		from {
			opacity: 0;
			transform: translateY(16px) scale(0.98);
		}
	}
	@keyframes alert-out {
		to {
			opacity: 0;
			transform: translateY(16px);
		}
	}
}

.alert__icon {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
}

.alert__icon svg {
	width: 22px;
	height: 22px;
	display: block;
}

.alert__body {
	min-width: 0;
}

.alert__title {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--text);
}

.alert__msg {
	margin: 4px 0 0;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--muted);
	overflow-wrap: anywhere;
}

.alert__close {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	width: 24px;
	height: 24px;
	border-radius: 6px;
	color: var(--dim);
	cursor: pointer;
	line-height: 0;
	transition: color 0.15s, background 0.15s;
}

.alert__close:hover {
	color: var(--text);
	background: var(--surface-2);
}

.alert__bar {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 100%;
	transform-origin: left;
	background: currentColor;
	opacity: 0.5;
}

.alert--success {
	border-left-color: var(--ok);
	color: var(--ok);
}
.alert--error {
	border-left-color: var(--err);
	color: var(--err);
}
.alert--warning {
	border-left-color: var(--warn);
	color: var(--warn);
}
.alert--info {
	border-left-color: var(--accent);
	color: var(--accent);
}

/* ================================================================== MODAL */
.modal {
	position: fixed;
	inset: 0;
	z-index: 8000;
	display: grid;
	place-items: center;
	padding: 20px;
	overflow-y: auto;
}

.modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(8, 8, 12, 0.72);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	animation: fade-in 0.22s ease both;
}

.modal__panel {
	position: relative;
	width: 100%;
	max-width: 428px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
	padding: 30px 30px 26px;
	animation: panel-in 0.3s var(--ease) both;
	margin: auto;
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
}

@keyframes panel-in {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.985);
	}
}

.modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	appearance: none;
	background: none;
	border: 0;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	color: var(--dim);
	cursor: pointer;
	line-height: 0;
	transition: color 0.15s, background 0.15s;
}

.modal__close:hover {
	color: var(--text);
	background: var(--surface-2);
}

.modal__mark {
	display: block;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	color: var(--accent-2);
	margin-bottom: 12px;
}

.modal__title {
	margin: 0;
	font-size: 1.4rem;
	line-height: 1.25;
	font-weight: 700;
	color: var(--text);
	text-wrap: balance;
}

.modal__lede {
	margin: 8px 0 0;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--muted);
}

/* ------------------------------------------------------------- Formulare */
.form {
	margin-top: 22px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.field__label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--muted);
}

.field__wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.field input {
	width: 100%;
	font: inherit;
	font-size: 0.9375rem;
	color: var(--text);
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: 9px;
	padding: 11px 13px;
	transition: border-color 0.16s, box-shadow 0.16s;
}

.field input::placeholder {
	color: var(--dim);
}

.field input:hover:not(:disabled) {
	border-color: var(--line-strong);
}

.field input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.16);
}

.field input:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.field.has-error input {
	border-color: var(--err);
}

.field.has-error input:focus {
	box-shadow: 0 0 0 3px rgba(224, 85, 75, 0.18);
}

.field input[type="password"],
.field input.has-toggle {
	padding-right: 44px;
}

.field__toggle {
	position: absolute;
	right: 6px;
	appearance: none;
	background: none;
	border: 0;
	width: 32px;
	height: 32px;
	border-radius: 7px;
	color: var(--dim);
	cursor: pointer;
	line-height: 0;
	transition: color 0.15s, background 0.15s;
}

.field__toggle:hover {
	color: var(--text);
	background: rgba(255, 255, 255, 0.05);
}

.field__error {
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--err);
	display: flex;
	gap: 6px;
	align-items: flex-start;
}

.field__hint {
	font-size: 0.78rem;
	line-height: 1.45;
	color: var(--dim);
}

/* -------------------------------------------------------- Passwortstärke */
.strength {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.strength__track {
	display: flex;
	gap: 4px;
}

.strength__seg {
	height: 3px;
	flex: 1;
	border-radius: 2px;
	background: var(--line);
	transition: background 0.25s;
}

.strength__label {
	font-size: 0.76rem;
	color: var(--dim);
}

.strength[data-level="1"] .strength__seg:nth-child(1) {
	background: var(--err);
}
.strength[data-level="2"] .strength__seg:nth-child(-n + 2) {
	background: var(--warn);
}
.strength[data-level="3"] .strength__seg:nth-child(-n + 3) {
	background: var(--accent-2);
}
.strength[data-level="4"] .strength__seg {
	background: var(--ok);
}

/* ------------------------------------------------------------- Checkbox */
.check {
	display: grid;
	grid-template-columns: 18px 1fr;
	gap: 10px;
	align-items: start;
	font-size: 0.83rem;
	line-height: 1.5;
	color: var(--muted);
	cursor: pointer;
}

.check input {
	appearance: none;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	border: 1px solid var(--line-strong);
	border-radius: 5px;
	background: var(--surface-2);
	cursor: pointer;
	position: relative;
	transition: background 0.15s, border-color 0.15s;
	flex: 0 0 auto;
}

.check input:checked {
	background: var(--accent);
	border-color: var(--accent);
}

.check input:checked::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(43deg);
}

.check input:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.check.has-error input {
	border-color: var(--err);
}

.check a {
	color: var(--accent-2);
}

/* -------------------------------------------------------------- Buttons */
.btn-primary {
	position: relative;
	appearance: none;
	width: 100%;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	border: 0;
	border-radius: 999px;
	padding: 13px 20px;
	margin-top: 4px;
	cursor: pointer;
	box-shadow: 0 10px 24px rgba(255, 122, 0, 0.28);
	transition: transform 0.18s var(--ease), box-shadow 0.18s, filter 0.18s;
}

.btn-primary:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 14px 30px rgba(255, 122, 0, 0.36);
}

.btn-primary:active:not(:disabled) {
	transform: translateY(0);
}

.btn-primary:disabled {
	cursor: not-allowed;
	filter: saturate(0.4) brightness(0.75);
	box-shadow: none;
}

.btn-primary.is-busy {
	color: transparent;
}

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

.btn-primary.is-busy .spinner {
	display: block;
}

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

.btn-link {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 0.85rem;
	color: var(--accent-2);
	cursor: pointer;
	text-decoration: none;
}

.btn-link:hover {
	text-decoration: underline;
}

.form__foot {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--line);
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	justify-content: center;
	align-items: center;
	font-size: 0.85rem;
	color: var(--dim);
	text-align: center;
}

.form__aside {
	display: flex;
	justify-content: flex-end;
	margin-top: -4px;
}

/* ---------------------------------------------------------- Erfolgsseite */
.done {
	text-align: center;
	padding: 8px 0 2px;
}

.done__icon {
	width: 56px;
	height: 56px;
	margin: 0 auto 16px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: rgba(62, 158, 118, 0.13);
	color: var(--ok);
}

.done__icon svg {
	width: 28px;
	height: 28px;
}

.done h2 {
	margin: 0 0 8px;
	font-size: 1.25rem;
	color: var(--text);
}

.done p {
	margin: 0 auto;
	max-width: 32ch;
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--muted);
}

.done__mail {
	display: inline-block;
	margin-top: 10px;
	font-weight: 600;
	color: var(--accent-2);
	overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ Angemeldet */
.me {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px;
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: 10px;
	margin-top: 20px;
}

.me__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: #fff;
	font-weight: 700;
	flex: 0 0 auto;
}

.me__name {
	font-weight: 600;
	color: var(--text);
	font-size: 0.95rem;
}

.me__mail {
	font-size: 0.8rem;
	color: var(--dim);
	overflow-wrap: anywhere;
}

.badge {
	display: inline-block;
	margin-top: 4px;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	border: 1px solid var(--warn);
	color: var(--warn);
}

/* ------------------------------------------------------------ Reduzierte Bewegung */
@media (prefers-reduced-motion: reduce) {
	.alert,
	.modal__panel,
	.modal__backdrop {
		animation-duration: 0.01ms !important;
	}
	.btn-primary,
	.field input {
		transition: none !important;
	}
	.btn-primary:hover:not(:disabled) {
		transform: none;
	}
	.spinner {
		animation-duration: 1.6s !important;
	}
	.alert__bar {
		transition: none !important;
	}
}
