/* ==================================================
   BENUTZER-KÄRTCHEN – ANMELDUNG
   Linienbündel nach „Login 03“ (Hirael, MIT)
   ================================================== */

@font-face {
    font-family: "Newsreader";
    src: url("../fonts/Newsreader.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Public Sans";
    src: url("../fonts/PublicSans.woff2") format("woff2");
    font-weight: 400 600;
    font-style: normal;
    font-display: swap;
}


/* --------------------------------------------------
   FARBEN
   -------------------------------------------------- */

:root {
    --ground: #f3f6f9;
    --surface: #ffffff;
    --ink: #0f2233;
    --primary: #155b91;
    --primary-ink: #ffffff;
    --muted: #5b6b7a;
    --line: #d6dee6;
    --danger: #b3261e;
    --danger-ground: #fcebea;
    --ok-ground: #e6f2ec;
    --ok: #1d6b45;
    --focus: #155b91;
    --lines-opacity: 0.55;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #0b1a29;
        --surface: #11253a;
        --ink: #e4edf5;
        --primary: #6aaee0;
        --primary-ink: #06121e;
        --muted: #8da2b5;
        --line: #21384f;
        --danger: #f2a39d;
        --danger-ground: #3a1b1d;
        --ok-ground: #12301f;
        --ok: #8fd3ad;
        --focus: #6aaee0;
        --lines-opacity: 0.8;

        color-scheme: dark;
    }
}


/* --------------------------------------------------
   GRUNDLAGEN
   -------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    background: var(--ground);
    color: var(--ink);
    font-family: "Public Sans", system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

p {
    margin: 0;
}


/* --------------------------------------------------
   LAYOUT
   -------------------------------------------------- */

.login {
    min-height: 100svh;
    display: grid;
}

@media (min-width: 1024px) {
    .login {
        grid-template-columns: 1fr 1fr;
    }
}


/* --------------------------------------------------
   LINKE SEITE: SCHULE
   -------------------------------------------------- */

.login-aside {
    display: none;
}

@media (min-width: 1024px) {

    .login-aside {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 2.5rem;
        overflow: hidden;
        background: var(--surface);
        border-inline-end: 1px solid var(--line);
    }

    /* Linien unten in den Hintergrund auslaufen lassen */
    .login-aside::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to bottom, transparent 35%, var(--surface) 92%);
        pointer-events: none;
    }
}

.login-aside-lines {
    position: absolute;
    inset: 0;
    color: var(--primary);
    opacity: var(--lines-opacity);
}

.paths {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.paths path {
    stroke: currentColor;
    stroke-dasharray: 0.3 1;
    animation: drift var(--d) linear var(--o) infinite;
}

@keyframes drift {
    0% {
        stroke-dasharray: 0.3 1;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 1 0;
        stroke-dashoffset: -1;
    }
    100% {
        stroke-dasharray: 0.3 1;
        stroke-dashoffset: 0;
    }
}

.login-app,
.login-school {
    position: relative;
    z-index: 1;
}

.login-app {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--muted);
}

.login-school {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
}

.login-school-logo {
    max-width: 11rem;
    max-height: 7rem;
    object-fit: contain;
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 10px;
}

.login-school-name {
    font-family: "Newsreader", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2.25rem, 3.4vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
    max-width: 14ch;
    text-wrap: balance;
}


/* --------------------------------------------------
   RECHTE SEITE: FORMULAR
   -------------------------------------------------- */

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.login-panel {
    width: 100%;
    max-width: 24rem;
}

.login-mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 2.5rem;
    font-weight: 600;
    color: var(--muted);
}

.login-mobile-logo {
    height: 2rem;
    width: auto;
    background: #ffffff;
    padding: 0.2rem;
    border-radius: 6px;
}

@media (min-width: 1024px) {
    .login-mobile-brand {
        display: none;
    }
}

.login-title {
    margin: 0;
    font-family: "Newsreader", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2.75rem, 6vw, 3.5rem);
    line-height: 1;
    letter-spacing: -0.02em;
}

.login-lead {
    margin-top: 0.75rem;
    color: var(--muted);
}

.login-notice {
    margin-top: 1.5rem;
    padding: 0.75rem 0.875rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    background: var(--ok-ground);
    color: var(--ok);
}

.login-notice-error,
.login-notice-warning {
    background: var(--danger-ground);
    color: var(--danger);
}

.login-form {
    margin-top: 2rem;
}


/* --------------------------------------------------
   ROLLEN
   -------------------------------------------------- */

.roles {
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    gap: 0.625rem;
}

.roles-legend {
    padding: 0;
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.role {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.role:hover {
    border-color: var(--primary);
}

.role-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role:has(.role-input:checked) {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

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

.role-off {
    cursor: not-allowed;
    opacity: 0.55;
}

.role-off:hover {
    border-color: var(--line);
}

.role-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    transition: background-color 150ms ease, color 150ms ease;
}

.role:has(.role-input:checked) .role-icon {
    background: var(--primary);
    color: var(--primary-ink);
}

.role-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.role-text {
    display: grid;
    gap: 0.125rem;
}

.role-name {
    font-weight: 600;
}

.role-desc {
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--muted);
}


/* --------------------------------------------------
   PASSWORT (erscheint nach der Rollenwahl)
   -------------------------------------------------- */

.login-secret {
    display: grid;
    grid-template-rows: 1fr;
}

/* Nur mit :has()-Unterstützung einklappen, sonst immer sichtbar */
@supports selector(:has(*)) {

    .login-secret {
        grid-template-rows: 0fr;
        transition: grid-template-rows 280ms cubic-bezier(0.22, 1, 0.36, 1);
    }

    .login-form:has(.role-input:checked) .login-secret {
        grid-template-rows: 1fr;
    }

    .login-secret-inner {
        visibility: hidden;
        transition: visibility 0s linear 280ms;
    }

    .login-form:has(.role-input:checked) .login-secret-inner {
        visibility: visible;
        transition-delay: 0s;
    }
}

.login-secret-inner {
    min-height: 0;
    overflow: hidden;
    display: grid;
    gap: 0.5rem;
    padding-top: 1.5rem;
    padding-inline: 2px;
    padding-bottom: 2px;
}

.field-label {
    font-size: 0.875rem;
    font-weight: 600;
}

.field {
    width: 100%;
    height: 2.875rem;
    padding: 0 0.875rem;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.field:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
    border-color: transparent;
}

.login-submit {
    margin-top: 0.75rem;
    height: 2.875rem;
    font: inherit;
    font-weight: 600;
    color: var(--primary-ink);
    background: var(--primary);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: filter 150ms ease;
}

.login-submit:hover {
    filter: brightness(1.08);
}

.login-submit:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}


/* --------------------------------------------------
   WENIGER BEWEGUNG
   -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .paths path {
        animation: none;
        stroke-dasharray: none;
    }

    .login-secret,
    .login-secret-inner,
    .role,
    .role-icon {
        transition: none;
    }
}


/* SuperAdmin-Anmeldung: Felder ohne Rollenwahl */
.login-fields {
    display: grid;
    gap: 0.5rem;
}

