/* =====================================================
   INRADR Design System — Account panel in the header (ClickUp 124ca7cpyje)
   inradr-design layer · own inradr-* classes and --inradr-* tokens only.

   The user icon at the right end of the header opens a non-modal panel (InradrAccountComponent): user with avatar,
   name and e-mail, language, tenant, appearance (System | Hell | Dunkel, only Hell available for now) and a
   full-width secondary sign-out. Geometry and colours follow the story's mockup (user-account-panel-mockup.html),
   which is drawn with the INRADR tokens: 372px wide, 4px radius, elevation-3 shadow, 1px dividers between the
   sections. The icon button looks like the header toolbar buttons (inradr-feature-header.css): transparent with a
   white 1px frame, accent tint on hover, accent-secondary while pressed or open, white focus ring on navy (OQ-02).
   The combo boxes in the panel are DevExpress editors; their skin is in inradr-feature-header.css.
   ===================================================== */

.inradr-account {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

/* --- the user icon in the header --- */
.inradr-account__button {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    width: var(--inradr-height-control);
    height: var(--inradr-height-control);
    padding: 0;
    border: 1px solid var(--inradr-color-text-on-navy);
    border-radius: var(--inradr-radius-sm);
    background: transparent;
    color: var(--inradr-color-text-on-navy);
    cursor: pointer;

    &:hover {
        background: var(--inradr-color-accent-tint-8);
    }

    &:active,
    &[aria-expanded="true"] {
        background: var(--inradr-color-accent-secondary);
    }

    &:focus-visible {
        outline: var(--inradr-focus-ring-width) solid var(--inradr-color-text-on-navy);
        outline-offset: var(--inradr-focus-ring-offset);
    }

    & > [aria-hidden="true"] {
        font-size: 20px;
        line-height: 1;
    }
}

/* --- the panel ---
   Positioned against the header (.inradr-app-header is position: relative), below it and flush with the icon's
   right edge. The header is the panel's stacking context and lies below the status bar (z-index), so the panel ends
   above the status bar and scrolls when it is taller. */
.inradr-account__panel {
    position: absolute;
    top: calc(100% + var(--inradr-space-xs));
    right: var(--inradr-space-sm);
    z-index: 1;
    box-sizing: border-box;
    width: min(372px, calc(100vw - 2 * var(--inradr-space-2xs)));
    max-height: calc(100dvh - var(--inradr-height-nav-bar) - var(--inradr-height-footer) - 2 * var(--inradr-space-xs));
    overflow: auto;
    border: 1px solid var(--inradr-color-border);
    border-radius: var(--inradr-radius-sm);
    background: var(--inradr-color-surface);
    box-shadow: var(--inradr-elevation-3-shadow);
    color: var(--inradr-color-text-primary);
    font-family: var(--inradr-font-body);
    font-size: var(--inradr-text-body-size);
    font-weight: var(--inradr-text-body-weight);
    line-height: var(--inradr-text-body-line-height);
    text-align: start;
    white-space: normal;

    &:focus-visible {
        outline: var(--inradr-focus-ring-width) solid var(--inradr-focus-ring-color);
        outline-offset: calc(-1 * var(--inradr-focus-ring-width));
    }

    & p {
        margin: 0;
    }
}

/* --- user: avatar, name, e-mail --- */
.inradr-account__summary {
    display: flex;
    align-items: center;
    gap: var(--inradr-space-2xs);
    padding: 18px 20px;
}

.inradr-account__avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: var(--inradr-radius-full);
    background: var(--inradr-color-accent-tint-16);
    color: var(--inradr-color-text-heading);
    font-size: var(--inradr-text-body-bold-size);
    font-weight: var(--inradr-text-body-bold-weight);
    line-height: 1;
}

.inradr-account__identity {
    min-width: 0;
}

.inradr-account__name {
    margin: 0;
    color: var(--inradr-color-text-primary);
    font-size: var(--inradr-text-h3-size);
    font-weight: var(--inradr-text-body-strong-weight);
    line-height: var(--inradr-text-h3-line-height);
    overflow-wrap: anywhere;
}

.inradr-account__email {
    margin-top: 2px;
    color: var(--inradr-color-text-secondary);
    font-size: var(--inradr-text-caption-size);
    line-height: var(--inradr-text-caption-line-height);
    overflow-wrap: anywhere;
}

/* --- sections: label above the control, a 1px divider between them --- */
.inradr-account__section {
    display: flex;
    flex-direction: column;
    gap: var(--inradr-space-xs);
    padding: 14px 20px;
    border-top: 1px solid var(--inradr-color-border);
}

.inradr-account__label {
    color: var(--inradr-color-text-secondary);
    font-size: var(--inradr-text-kpi-label-size);
    font-weight: var(--inradr-text-kpi-label-weight);
    line-height: var(--inradr-text-kpi-label-line-height);
}

.inradr-account__value {
    color: var(--inradr-color-text-primary);
}

/* "Aktiver Mandant: …" and the appearance hint; 13px is the caption floor (OQ-24). */
.inradr-account__note,
.inradr-account__help {
    min-height: var(--inradr-text-caption-line-height);
    color: var(--inradr-color-text-muted);
    font-size: var(--inradr-text-caption-size);
    line-height: var(--inradr-text-caption-line-height);
}

.inradr-account__note {
    margin-top: -3px;   /* 5px below the combo box, as in the mockup */
}

/* --- appearance: System | Hell | Dunkel ---
   The segmented button group of inradr-button.css. Modes that are not available yet stay focusable and say so in their
   name and tooltip (aria-disabled). */

/* --- sign-out: full width, secondary, centred within the content padding --- */
.inradr-account__signout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--inradr-space-xs);
    width: 100%;

    &:disabled {
        background: var(--inradr-color-surface-muted);
        color: var(--inradr-color-text-muted);
        cursor: not-allowed;
    }

    & > [aria-hidden="true"] {
        font-size: 16px;
        line-height: 1;
    }
}

/* Narrow windows: the panel keeps the same 12px to both edges (mockup). */
@media (max-width: 560px) {
    .inradr-account__panel {
        right: var(--inradr-space-2xs);
    }

    .inradr-account__summary,
    .inradr-account__section {
        padding-inline: var(--inradr-space-sm);
    }
}
