/* ============================================================
 * user_ui — Impersonation banner chrome.
 * ============================================================
 *
 * Persistent top-of-page bar shown only while an admin is
 * impersonating the current user. Structurally mirrors the
 * banned/frozen account-state banner (`.site-banner`) but uses its
 * own `.impersonation-*` namespace so the two never collide and
 * can stack (account-state banner + impersonation banner).
 *
 * Theme-invariant: like the account-state banner, the accent
 * background is hardcoded (a deep indigo, distinct from the red
 * ban / amber freeze accents), so the inverted CTA text colour
 * is hardcoded too rather than resolved from theme tokens.
 *
 * Loaded by base.html after banner/banner.css.
 * ============================================================ */

.impersonation-bar {
    width: 100%;
    border-bottom: 1px solid #3730A3; /* indigo 800 */
    background: #4338CA;              /* indigo 700 */
    color: #fff;
}

.impersonation-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
}

.impersonation-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #fff;
}

.impersonation-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
}

.impersonation-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    color: #fff;
}

.impersonation-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
}

.impersonation-text strong {
    color: #fff;
    font-weight: 700;
}

/* Countdown — live MM:SS remaining. The partial's inline expiry
   script shows the "Active until … (M:SS left)." sentence in
   `.impersonation-countdown`, with the ticking value in
   `.impersonation-countdown-time`, and hides the static "Active
   until …." sentence visually (below). Tabular digits so the ticking
   seconds don't jitter the line width. */
.impersonation-countdown-time {
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* The static expiry sentence while the countdown replaces it on screen:
   out of sight but still read by screen readers, because the ticking
   span is aria-hidden and this sentence is the bar's accessible expiry
   statement. */
.impersonation-expiry.is-replaced {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* The exit form wraps the button only — keep it inline + flush. */
.impersonation-exit-form {
    flex-shrink: 0;
    margin: 0;
}

/* Inverted CTA: white background, indigo text — theme-invariant,
   same rationale as the account-state banner CTA. */
.impersonation-exit {
    background: #fff;
    border: 0;
    color: #4338CA;              /* indigo 700 */
}
.impersonation-exit:hover {
    background: #F3F4F6;         /* theme-invariant light grey */
}
.impersonation-exit:focus-visible {
    outline: 2px solid #3730A3; /* indigo 800 — visible on the bar */
    outline-offset: 2px;
}

/* Mobile — stack content + exit; full-width button. */
@media (max-width: 600px) {
    .impersonation-row {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px 14px;
    }
    .impersonation-icon {
        margin-top: 2px;
    }
    .impersonation-content {
        flex-basis: calc(100% - 34px);
    }
    .impersonation-exit-form {
        flex-basis: 100%;
    }
    .impersonation-exit {
        width: 100%;
        text-align: center;
    }
}
