/* ============================================================
   Login-Seite – eigenes Stylesheet (CSP-konform, keine
   Inline-Styles, kein JavaScript nötig).
   Design: ruhige „Bühne" mit Farb-Glows und Wellenform-Deko,
   davor eine Karte im Glas-Look. Light/Dark automatisch.
   ============================================================ */

:root {
    color-scheme: light dark;

    --bg-base: #e7edf6;
    --bg-deep: #dde5f2;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --border: rgba(120, 138, 170, 0.28);
    --text: #17202e;
    --muted: #5b6a80;
    --faint: #8a97ab;

    --accent: #2f6fed;
    --accent-hover: #2961cc;
    --accent-2: #7c5cf0;
    --on-accent: #ffffff;

    --danger: #c0392b;
    --danger-bg: rgba(224, 72, 72, 0.1);
    --danger-border: rgba(224, 72, 72, 0.4);

    --glow-a: rgba(47, 111, 237, 0.22);
    --glow-b: rgba(124, 92, 240, 0.18);
    --wave: rgba(47, 111, 237, 0.32);

    --card-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 24px 64px -16px rgba(15, 23, 42, 0.22),
        0 4px 16px rgba(15, 23, 42, 0.06);
    --focus-ring: 0 0 0 4px rgba(47, 111, 237, 0.22);

    --radius-card: 22px;
    --radius-field: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-base: #0a0e17;
        --bg-deep: #0d1322;
        --surface: rgba(21, 26, 36, 0.88);
        --surface-solid: #151a24;
        --border: rgba(148, 163, 190, 0.2);
        --text: #e8ecf4;
        --muted: #9aa6ba;
        --faint: #6d7a90;

        /* Flächen leicht abdunkeln, damit Weißtext ≥ 4.5:1 bleibt. */
        --accent: #3572e0;
        --accent-hover: #4f8cff;
        --accent-2: #6d4fe0;
        --on-accent: #ffffff;

        --danger: #ff7a7a;
        --danger-bg: rgba(255, 107, 107, 0.12);
        --danger-border: rgba(255, 107, 107, 0.38);

        --glow-a: rgba(47, 111, 237, 0.26);
        --glow-b: rgba(124, 92, 240, 0.2);
        --wave: rgba(79, 140, 255, 0.2);

        --card-shadow:
            0 1px 2px rgba(0, 0, 0, 0.4),
            0 28px 72px -16px rgba(0, 0, 0, 0.6),
            0 4px 18px rgba(0, 0, 0, 0.35);
        --focus-ring: 0 0 0 4px rgba(79, 140, 255, 0.28);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(1200px 800px at 12% -10%, var(--glow-b), transparent 60%),
        radial-gradient(1100px 700px at 95% 8%, var(--glow-a), transparent 55%),
        linear-gradient(180deg, var(--bg-base), var(--bg-deep));
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---------------- Dekorative Bühne ---------------- */

.login-scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.85;
}

.glow-a {
    width: 520px;
    height: 520px;
    left: -140px;
    top: -160px;
    background: radial-gradient(circle, var(--glow-a), transparent 70%);
    animation: drift 22s ease-in-out infinite alternate;
}

.glow-b {
    width: 620px;
    height: 620px;
    right: -180px;
    bottom: -220px;
    background: radial-gradient(circle, var(--glow-b), transparent 70%);
    animation: drift 26s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(40px, 26px, 0) scale(1.08); }
}

/* Wellenform am unteren Rand – passend zum Audio-Thema. */
.wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -8px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    height: 160px;
}

.wave i {
    width: 4px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--wave), transparent);
    animation: wave 1.9s ease-in-out infinite;
}

/* 28 Balken: gestaffelte Höhe/Phase, Richtung Rand flacher. */
.wave i:nth-child(1)  { height: 22%; animation-delay: 0.00s; }
.wave i:nth-child(2)  { height: 38%; animation-delay: 0.10s; }
.wave i:nth-child(3)  { height: 55%; animation-delay: 0.20s; }
.wave i:nth-child(4)  { height: 72%; animation-delay: 0.30s; }
.wave i:nth-child(5)  { height: 88%; animation-delay: 0.40s; }
.wave i:nth-child(6)  { height: 64%; animation-delay: 0.50s; }
.wave i:nth-child(7)  { height: 42%; animation-delay: 0.60s; }
.wave i:nth-child(8)  { height: 26%; animation-delay: 0.70s; }
.wave i:nth-child(9)  { height: 44%; animation-delay: 0.15s; }
.wave i:nth-child(10) { height: 66%; animation-delay: 0.35s; }
.wave i:nth-child(11) { height: 84%; animation-delay: 0.55s; }
.wave i:nth-child(12) { height: 96%; animation-delay: 0.25s; }
.wave i:nth-child(13) { height: 78%; animation-delay: 0.65s; }
.wave i:nth-child(14) { height: 52%; animation-delay: 0.05s; }
.wave i:nth-child(15) { height: 34%; animation-delay: 0.45s; }
.wave i:nth-child(16) { height: 58%; animation-delay: 0.75s; }
.wave i:nth-child(17) { height: 82%; animation-delay: 0.20s; }
.wave i:nth-child(18) { height: 92%; animation-delay: 0.60s; }
.wave i:nth-child(19) { height: 70%; animation-delay: 0.30s; }
.wave i:nth-child(20) { height: 46%; animation-delay: 0.50s; }
.wave i:nth-child(21) { height: 30%; animation-delay: 0.70s; }
.wave i:nth-child(22) { height: 48%; animation-delay: 0.10s; }
.wave i:nth-child(23) { height: 68%; animation-delay: 0.40s; }
.wave i:nth-child(24) { height: 86%; animation-delay: 0.00s; }
.wave i:nth-child(25) { height: 60%; animation-delay: 0.55s; }
.wave i:nth-child(26) { height: 40%; animation-delay: 0.25s; }
.wave i:nth-child(27) { height: 28%; animation-delay: 0.65s; }
.wave i:nth-child(28) { height: 18%; animation-delay: 0.35s; }

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.42); }
}

/* ---------------- Karte ---------------- */

.login-card {
    position: relative;
    z-index: 1;
    background: var(--surface);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 40px 36px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--card-shadow);
    animation: card-in 0.45s cubic-bezier(0.22, 0.9, 0.3, 1);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .login-card { background: var(--surface-solid); }
}

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

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.logo-tile {
    width: 60px;
    height: 60px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow:
        0 8px 22px -6px color-mix(in srgb, var(--accent) 55%, transparent),
        inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.logo {
    width: 30px;
    height: 30px;
}

.login-brand h1 {
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -0.015em;
}

.subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-top: 6px;
}

/* ---------------- Formular ---------------- */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.field label {
    font-size: 13px;
    font-weight: 650;
    color: var(--muted);
}

.control {
    position: relative;
}

.control svg {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--faint);
    pointer-events: none;
    transition: color 0.16s;
}

.control input {
    width: 100%;
    font-size: 15px;
    padding: 12px 14px 12px 43px;
    border: 1px solid var(--border);
    border-radius: var(--radius-field);
    background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
    color: var(--text);
    outline: none;
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.control input::placeholder {
    color: var(--faint);
}

.control input:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.control input:focus {
    border-color: var(--accent);
    background: var(--surface-solid);
    box-shadow: var(--focus-ring);
}

.control input:focus ~ svg,
.control:focus-within > svg {
    color: var(--accent);
}

/* ---------------- Button ---------------- */

.btn-primary {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 650;
    font-family: inherit;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-field);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--accent) 92%, #fff),
        var(--accent) 55%,
        var(--accent-2));
    color: var(--on-accent);
    cursor: pointer;
    box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 55%, transparent);
    transition: filter 0.16s, box-shadow 0.18s, transform 0.14s ease;
}

.btn-primary svg {
    width: 17px;
    height: 17px;
    transition: transform 0.18s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 12px 26px -6px color-mix(in srgb, var(--accent) 62%, transparent);
}

.btn-primary:hover svg {
    transform: translateX(3px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.985);
}

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

/* ---------------- Fehlermeldung ---------------- */

.error {
    display: flex;
    align-items: baseline;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    border-left-width: 3px;
    border-radius: var(--radius-field);
    padding: 11px 13px;
    font-size: 13.5px;
    margin-bottom: 2px;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* ---------------- Fußzeile ---------------- */

.secure-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--faint);
    font-size: 12px;
}

.secure-hint svg {
    width: 13px;
    height: 13px;
    flex: none;
}

.version {
    text-align: center;
    color: var(--faint);
    font-size: 11.5px;
    margin-top: 10px;
}

/* ---------------- Kleinbildschirm ---------------- */

@media (max-width: 480px) {
    body { padding: 14px; align-items: flex-start; }

    .login-card {
        padding: 30px 22px 18px;
        margin-top: 4vh;
    }
}

/* OS-seitig reduzierte Bewegung: Deko bleibt statisch. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}
