/*
 * Ladeanzeige für den In-Place-Content-Wechsel (UpdatePortalContent in core.js).
 *
 * - #portal-progress: schmale Fortschrittsleiste am oberen Fensterrand (wie bei
 *   YouTube/GitHub). Wird per JS erzeugt, mit .is-active sichtbar und läuft bis
 *   ca. 80 %; beim Abschluss auf 100 % und ausgeblendet.
 * - #content.is-loading: alter Inhalt wird leicht abgedunkelt und gesperrt, bis
 *   das neue Fragment eingesetzt ist (Verzögerung, damit schnelle Antworten nicht
 *   flackern). Optisch angelehnt an .gridjs-loading-bar der Tabellen.
 */
#portal-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--bs-primary, #405189);
    box-shadow: 0 0 8px var(--bs-primary, #405189);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: width .3s ease, opacity .3s ease .2s;
}

#portal-progress.is-active {
    opacity: 1;
    width: 80%;
    /* langsamer Anstieg, solange die Antwort ausbleibt */
    transition: width 6s cubic-bezier(.1, .7, .2, 1), opacity .1s ease;
}

#portal-progress.is-done {
    opacity: 0;
    width: 100%;
    transition: width .2s ease, opacity .3s ease .2s;
}

#content {
    position: relative;
    transition: opacity .2s ease .15s;
}

#content.is-loading {
    opacity: .5;
    pointer-events: none;
    user-select: none;
}

#content.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(90deg, hsla(0, 0%, 80%, 0), hsla(0, 0%, 80%, .2) 20%, hsla(0, 0%, 80%, .5) 60%, hsla(0, 0%, 80%, 0));
    transform: translateX(-100%);
    animation: portal-shimmer 2s infinite;
    pointer-events: none;
}

@keyframes portal-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/*
 * Status-Punkt am Avatar (assets/js/presence.js): das Template setzt
 * `.chat-user-img .user-status` fest auf 10 px in die Ecke des Containers - passend
 * für avatar-xs/-sm. Ab avatar-md wächst der Punkt mit und sitzt auf dem Kreisrand
 * (45°: 14,6 % der Breite vom Rand, abzüglich des halben Punkts). Setzt runde
 * Avatare voraus, wie alle Benutzer-Avatare der Anwendung.
 */
.chat-user-img.avatar-md .user-status,
.chat-user-img.avatar-lg .user-status,
.chat-user-img.avatar-xl .user-status {
    --presence-dot: 12px;
    width: var(--presence-dot);
    height: var(--presence-dot);
    right: calc(14.6% - var(--presence-dot) / 2);
    bottom: calc(14.6% - var(--presence-dot) / 2);
}

.chat-user-img.avatar-lg .user-status {
    --presence-dot: 16px;
    border-width: 3px;
}

.chat-user-img.avatar-xl .user-status {
    --presence-dot: 20px;
    border-width: 3px;
}
