@keyframes drift {
    from {
        /* FIX: "fom" → "from" */
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 40px);
    }
}

/* Layout Wrapper */
.wrap {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    width: 100%;
}

/* ========== LOGIN SPEZIFISCH ========== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 60px 24px;
    position: relative;
    z-index: 2;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px 32px;
    position: relative;
    animation: fadeUp 0.5s ease-out;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    opacity: 0.3;
}

@keyframes fadeUp {
    from {
        /* FIX: "fom" → "from" */
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 25px var(--blue-glow);
}

.login-header .logo-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--muted);
    font-size: 15px;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 24px;
    display: none;
    align-items: center;
    gap: 12px;
    line-height: 1.5;
    animation: fadeUp 0.3s ease-out;
    border: 1px solid;
}

.alert.error {
    background: rgba(239, 68, 68, .08);
    border-color: rgba(239, 68, 68, .25);
    color: #fca5a5;
}

.alert.success {
    background: rgba(34, 197, 94, .08);
    border-color: rgba(34, 197, 94, .25);
    color: #86efac;
}

.alert.warning {
    background: rgba(245, 158, 11, .08);
    border-color: rgba(245, 158, 11, .25);
    color: #fbbf24;
}

.alert.show {
    display: flex;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    transition: color 0.2s ease;
    width: 18px;
    height: 18px;
}

.form-input {
    width: 100%;
    padding: 14px 14px 14px 48px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all .3s ease;
}

.form-input::placeholder {
    color: var(--muted);
    opacity: 0.5;
}

.form-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-dim);
}

.form-input:focus~.input-icon {
    color: var(--blue);
}

.form-input.input-error {
    border-color: rgba(239, 68, 68, .5);
}

.form-input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .1);
}

.toggle-pw {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    transition: color .2s ease;
    display: flex;
    align-items: center;
}

.toggle-pw:hover {
    color: var(--text);
}

.toggle-pw svg {
    width: 18px;
    height: 18px;
}

.field-error {
    color: #fca5a5;
    font-size: 12px;
    margin-top: 8px;
    display: none;
}

.field-error.show {
    display: block;
}

.options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    user-select: none;
}

.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
    cursor: pointer;
}

.forgot-link {
    color: #60a5fa;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color .2s ease;
}

.forgot-link:hover {
    color: #93bbfd;
    text-decoration: underline;
    /* FIX: "uäline" → "underline" */
}

/* Buttons */
.login-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all .3s ease;
    background: var(--blue);
    color: white;
    font-family: inherit;
    box-shadow: 0 4px 16px var(--blue-glow);
}

.login-btn:hover:not(:disabled) {
    background: #2563eb;
    box-shadow: 0 8px 24px var(--blue-glow);
    transform: translateY(-2px);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none !important;
}

.login-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 0 auto;
}

.login-btn.loading .btn-text {
    display: none;
}

.login-btn.loading .spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Magic Link Button */
.magic-link-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    border: 1px solid var(--border2);
    cursor: pointer;
    transition: all .3s ease;
    margin-top: 12px;
    background: var(--blue-dim);
    color: #60a5fa;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.magic-link-btn:hover:not(:disabled) {
    background: var(--surface2);
    border-color: var(--blue);
    transform: translateY(-2px);
}

.magic-link-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.magic-link-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Divider & Footer */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
    color: var(--muted);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-footer {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.login-footer a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
    /* FIX: "uäline" → "underline" */
    color: #93bbfd;
}

.trust-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.trust-item svg {
    width: 14px;
    height: 14px;
    stroke: var(--blue);
}

/*
           MAGIC LINK STEP
         */
#magicLinkStep {
    display: none;
}

.magic-header {
    text-align: center;
    margin-bottom: 28px;
}

.magic-header .magic-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 25px rgba(2, 132, 199, 0.35);
}

.magic-header .magic-icon svg {
    width: 28px;
    height: 28px;
    stroke: white;
}

.magic-header h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.magic-header p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

/* Send-Button (blau-cyan) */
.send-magic-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all .3s ease;
    margin-top: 4px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.3);
}

.send-magic-btn:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(2, 132, 199, .4);
    transform: translateY(-2px);
}

.send-magic-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 0 auto;
}

.send-magic-btn.loading .btn-text {
    display: none;
}

.send-magic-btn.loading .spinner {
    display: block;
}

/* Magic-Sent-State */
#magicSentState {
    display: none;
}

.sent-icon-wrap {
    text-align: center;
    margin: 24px 0;
}

.sent-icon-wrap .sent-circle {
    width: 80px;
    height: 80px;
    background: var(--blue-dim);
    border: 2px solid var(--border2);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: pulse-sent 2s ease-in-out infinite;
}

@keyframes pulse-sent {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 0 16px rgba(59, 130, 246, 0);
    }
}

.sent-circle svg {
    width: 34px;
    height: 34px;
    stroke: var(--blue);
}

.sent-title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    margin-bottom: 12px;
}

.sent-desc {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.sent-desc strong {
    color: #60a5fa;
}

.sent-hint {
    background: var(--blue-dim);
    border: 1px solid var(--border2);
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}

/* Zurück-Button */
.back-to-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    color: var(--muted);
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: color .2s;
    width: 100%;
}

.back-to-login:hover {
    color: var(--text);
}

.back-to-login svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/*
           2FA STEP
         */
#twoFaStep {
    display: none;
}

.twofa-header {
    text-align: center;
    margin-bottom: 28px;
}

.twofa-header .twofa-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
}

.twofa-header .twofa-icon svg {
    width: 28px;
    height: 28px;
    stroke: white;
}

.twofa-header h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.twofa-header p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.method-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.method-tab {
    flex: 1;
    padding: 12px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    text-align: center;
}

.method-tab.active {
    border-color: var(--blue);
    background: var(--blue-dim);
    color: #60a5fa;
}

.method-tab:hover:not(.active) {
    border-color: var(--border2);
    color: var(--text);
}

.code-input {
    width: 100%;
    padding: 18px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 32px;
    font-family: var(--mono);
    letter-spacing: 8px;
    outline: none;
    text-align: center;
    transition: all .3s;
}

.code-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.code-input.input-error {
    border-color: rgba(239, 68, 68, .5);
}

.code-input.error-shake {
    animation: shake .3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.code-hint {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin-top: 12px;
}

.confirm-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all .3s ease;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    font-family: inherit;
    margin-top: 24px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.confirm-btn:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(124, 58, 237, .4);
    transform: translateY(-2px);
}

.confirm-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 0 auto;
}

.confirm-btn.loading .btn-text {
    display: none;
}

.confirm-btn.loading .spinner {
    display: block;
}

.resend-row {
    text-align: center;
    margin-top: 16px;
}

.resend-btn {
    background: none;
    border: none;
    color: #60a5fa;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: color .2s;
}

.resend-btn:hover {
    color: #93bbfd;
    text-decoration: underline;
    /* FIX: "uäline" → "underline" */
}

.resend-btn:disabled {
    color: var(--muted);
    cursor: not-allowed;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 520px) {
    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .options-row {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .trust-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
}