/* ==========================================================================
   TaskPilot Auth — Landing-Look (immer dunkel, unabhängig vom App-Theme)
   Setzt die Scroll-Story der Landingpage als "Kapitel 04" fort.
   Tokens sind bewusst eine Kopie der --lp-* Werte aus landing.css,
   gescoped auf #auth-overlay (landing.css enthält globale Resets und
   darf deshalb nicht in die App geladen werden).
   ========================================================================== */

#auth-overlay {
    --lp-accent: #f97316;
    --lp-accent-2: #fb923c;
    --lp-accent-hover: #ea580c;
    --lp-accent-soft: rgba(249, 115, 22, 0.12);
    --lp-accent-soft-2: rgba(249, 115, 22, 0.22);
    --lp-accent-glow: rgba(249, 115, 22, 0.18);

    --lp-bg: #0b0b0d;

    --lp-surface: rgba(255, 255, 255, 0.03);
    --lp-surface-2: rgba(255, 255, 255, 0.05);
    --lp-surface-3: rgba(255, 255, 255, 0.07);

    --lp-border: rgba(255, 255, 255, 0.08);
    --lp-border-soft: rgba(255, 255, 255, 0.05);
    --lp-border-strong: rgba(255, 255, 255, 0.14);
    --lp-border-accent: rgba(249, 115, 22, 0.28);

    --lp-text-1: #fafafc;
    --lp-text-2: #d9d9df;
    --lp-text-3: #a3a3ad;
    --lp-text-4: #71717e;

    --lp-radius-sm: 10px;
    --lp-radius: 16px;
    --lp-radius-lg: 24px;

    --lp-shadow-lg: 0 40px 100px rgba(0, 0, 0, 0.45);
    --lp-ease: cubic-bezier(0.4, 0, 0.2, 1);

    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(1200px 800px at 70% -10%, #131318 0%, var(--lp-bg) 55%);
    color: var(--lp-text-2);
}

/* ── Ambiente: Glows + Partikel ─────────────────────────────── */

.auth-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

.auth-glow--1 {
    top: -180px;
    right: -120px;
    width: 460px;
    height: 460px;
    background: rgba(249, 115, 22, 0.10);
}

.auth-glow--2 {
    bottom: -220px;
    left: -160px;
    width: 520px;
    height: 520px;
    background: rgba(249, 115, 22, 0.06);
}

.auth-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(249, 115, 22, 0.35);
    animation: auth-drift 14s ease-in-out infinite;
}

.auth-particle:nth-child(1) { top: 18%; left: 12%; animation-delay: 0s; }
.auth-particle:nth-child(2) { top: 68%; left: 8%;  animation-delay: -3s; width: 3px; height: 3px; }
.auth-particle:nth-child(3) { top: 28%; left: 86%; animation-delay: -6s; }
.auth-particle:nth-child(4) { top: 76%; left: 82%; animation-delay: -9s; width: 3px; height: 3px; }
.auth-particle:nth-child(5) { top: 10%; left: 55%; animation-delay: -5s; width: 2px; height: 2px; }
.auth-particle:nth-child(6) { top: 88%; left: 42%; animation-delay: -11s; width: 2px; height: 2px; }

@keyframes auth-drift {
    0%, 100% { transform: translate3d(0, 0, 0); opacity: 0.5; }
    50%      { transform: translate3d(14px, -22px, 0); opacity: 1; }
}

/* ── Karte: Glas-Panel ──────────────────────────────────────── */

.auth-card {
    position: relative;
    width: 100%;
    max-width: min(420px, calc(100vw - 32px));
    padding: 36px 32px 32px;
    background: var(--lp-surface-2);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius-lg);
    box-shadow: var(--lp-shadow-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.auth-eyebrow {
    display: block;
    margin-bottom: 14px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--lp-accent);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-logo-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    filter: drop-shadow(0 6px 24px rgba(249, 115, 22, 0.25));
}

.auth-logo h1 {
    display: none;
    margin: 0;
}

/* ── Tabs ───────────────────────────────────────────────────── */

.auth-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--lp-border);
    background: var(--lp-surface);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--lp-text-3);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.16s var(--lp-ease), color 0.16s var(--lp-ease);
}

.auth-tab:hover {
    color: var(--lp-text-1);
    background: var(--lp-surface-3);
}

.auth-tab.active {
    background: linear-gradient(135deg, var(--lp-accent), var(--lp-accent-hover));
    color: #fff;
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.30);
}

/* ── Formulare (Overrides der theme-aware modals.css-Regeln) ── */

.auth-form .form-group {
    margin-bottom: 14px;
}

#auth-overlay .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--lp-text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#auth-overlay .form-group input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--lp-border);
    color: var(--lp-text-1);
}

#auth-overlay .form-group input::placeholder {
    color: var(--lp-text-4);
    opacity: 1;
}

#auth-overlay .form-group input:focus {
    outline: none;
    border-color: rgba(249, 115, 22, 0.56);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.auth-error {
    min-height: 20px;
    font-size: 13px;
    color: #f87171;
    margin-bottom: 14px;
    font-weight: 600;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--lp-text-3);
    cursor: pointer;
    margin-bottom: 6px;
    user-select: none;
}

.auth-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--lp-accent);
    cursor: pointer;
}

/* ── Buttons im Landing-Stil ────────────────────────────────── */

#auth-overlay .auth-form .btn-primary {
    width: 100%;
    justify-content: center;
    height: 46px;
    margin-top: 4px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--lp-accent), var(--lp-accent-hover));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.28);
    transition: transform 0.18s var(--lp-ease), box-shadow 0.18s var(--lp-ease), filter 0.18s var(--lp-ease);
}

#auth-overlay .auth-form .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(249, 115, 22, 0.36);
    filter: brightness(1.05);
}

#auth-overlay .auth-form .btn-primary:disabled {
    opacity: 0.65;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
    color: var(--lp-text-4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--lp-border);
}

.auth-ki-btn {
    width: 100%;
    height: 46px;
    border: 1px solid var(--lp-border-accent);
    background: var(--lp-accent-soft);
    color: var(--lp-accent-2);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s var(--lp-ease), border-color 0.16s var(--lp-ease), color 0.16s var(--lp-ease);
    font-family: inherit;
    letter-spacing: -0.01em;
    padding: 0 16px;
}

.auth-ki-btn:hover {
    background: linear-gradient(135deg, var(--lp-accent), var(--lp-accent-hover));
    color: #fff;
    border-color: transparent;
}

.auth-legal-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 22px;
}

.auth-legal-links a {
    color: var(--lp-text-4);
    font-size: 11px;
    text-decoration: none;
}

.auth-legal-links a:hover {
    color: var(--lp-text-2);
}

/* ── Choreografie: Entrance & Exit ──────────────────────────── */

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translate3d(0, 26px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Standard: kurzer Fade (z. B. nach Logout) */
.auth-card {
    animation: auth-rise 0.45s var(--lp-ease) both;
}

/* Von der Landing kommend: volle gestaffelte Entrance */
.auth-card--arrive > * {
    animation: auth-rise 0.6s var(--lp-ease) both;
}

.auth-card--arrive .auth-eyebrow    { animation-delay: 0.05s; }
.auth-card--arrive .auth-logo       { animation-delay: 0.12s; }
.auth-card--arrive .auth-tabs       { animation-delay: 0.20s; }
.auth-card--arrive .auth-form       { animation-delay: 0.28s; }
.auth-card--arrive .auth-divider    { animation-delay: 0.38s; }
.auth-card--arrive .auth-ki-btn     { animation-delay: 0.44s; }
.auth-card--arrive .auth-legal-links{ animation-delay: 0.52s; }

/* Exit nach erfolgreichem Login */
#auth-overlay.auth-leave {
    opacity: 0;
    transition: opacity 0.3s var(--lp-ease);
    pointer-events: none;
}

/* ── Reduced Motion (Codebase-Standard, vgl. landing.css) ───── */

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-card--arrive > * {
        animation: none;
    }

    .auth-particle {
        animation: none;
        opacity: 0.5;
    }

    #auth-overlay.auth-leave {
        transition: none;
    }

    #auth-overlay .auth-form .btn-primary:hover:not(:disabled) {
        transform: none;
    }
}

/* ── Mobile ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px 24px;
        border-radius: 20px;
    }

    .auth-logo-img {
        width: 64px;
        height: 64px;
    }
}
