/* ==========================================================================
   Identity › Groups — the Networks overview's Cards | List UX for identity groups (reference images
   docs/architecture/modular-ux/current/30-identity/Idenityty_Group_Cards.png, Idenityty_Group_List.png).
   The breadcrumb, the compact Cards | List switch and Create group on one row; a row of search, status, page size and
   refresh only when needed (IdentityGroupsFit + wwwroot/js/nms-fit.js); then two framed cards per row, or one framed
   table. The same tokens and measures as nms-network.css (its frame, surface, gutter and switch), restated here under
   the page's own prefix so neither page's stylesheet can move the other. Tokens only, each with a fallback.
   ========================================================================== */

.idg-page {
    container-type: inline-size;
    container-name: idg-page;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
    padding: 1.75rem var(--idg-gutter) 2rem;

    /* The page gutter: the same distance from the sidebar on the left as from the window edge on the right. */
    --idg-gutter: clamp(1rem, 2.2vw, 2.25rem);
    --idg-text: var(--air-text, var(--mud-palette-text-primary));
    --idg-muted: var(--air-text-muted, var(--mud-palette-text-secondary));
    --idg-accent: var(--air-accent, var(--mud-palette-primary));
    --idg-card-border: color-mix(in srgb, var(--idg-text) 16%, transparent);
    --idg-control-border: color-mix(in srgb, var(--idg-text) 28%, transparent);
    /* One framed surface for cards and the list: a restrained blue edge, a little brighter on top, a step off the page. */
    --idg-frame: color-mix(in srgb, var(--idg-accent) 34%, transparent);
    --idg-frame-top: color-mix(in srgb, var(--idg-accent) 62%, transparent);
    --idg-frame-line: color-mix(in srgb, var(--idg-accent) 18%, var(--idg-card-border));
    --idg-surface: color-mix(in srgb, var(--idg-accent) 6%, var(--air-surface, var(--mud-palette-surface)));
}

/* Visible to assistive technology only. */
.idg-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.idg-muted { color: var(--idg-muted); }

/* ── The head: breadcrumb, the switch and Create group on one row ─────── */

.idg-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; min-height: 2.75rem; }
.idg-crumbs { flex: 1 1 12rem; min-width: 0; font-size: 1.125rem; }
.idg-crumbs__list { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0; margin: 0; padding: 0; list-style: none; }
.idg-crumbs__item { display: inline-flex; align-items: center; min-width: 0; }
.idg-crumbs__sep { margin: 0 0.625rem; color: var(--idg-muted); }
.idg-crumbs__text { color: color-mix(in srgb, var(--idg-text) 85%, transparent); }
.idg-crumbs__current { color: var(--idg-text); font-weight: var(--air-font-weight-semibold, 600); overflow-wrap: anywhere; }

.idg-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }

/* Cards | List: a small icon switch at the Networks overview's measures; the chosen half filled. */
.idg-views {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--idg-frame);
    border-radius: 6px;
    background: var(--idg-surface);
}
.idg-views__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 4px;
    color: var(--idg-text);
    background: none;
    cursor: pointer;
}
.idg-views__option:hover:not(.is-active) { background: var(--air-hover, var(--mud-palette-action-default-hover)); }
.idg-views__option.is-active { color: var(--air-accent-text, var(--mud-palette-primary-text)); background: var(--idg-accent); }
.idg-views__option:focus-visible { outline: 2px solid var(--idg-accent); outline-offset: 2px; position: relative; z-index: 1; }

/* Create group: a quiet outlined button at the switch's height, as Add on the Networks overview. */
.idg-head__create.mud-button-root {
    min-height: 2.375rem;
    padding: 0 1rem;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: var(--air-font-weight-semibold, 600);
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    color: var(--idg-text);
    border-color: var(--idg-frame-top);
    background: transparent;
    box-shadow: none;
}
.idg-head__create.mud-button-root:hover { background: var(--air-hover, var(--mud-palette-action-default-hover)); border-color: var(--idg-accent); }
.idg-head__create.mud-button-root:focus-visible { outline: 2px solid var(--idg-accent); outline-offset: 2px; }

/* ── The tools row: only when needed ─────────────────────────────────── */

.idg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.idg-bar__search { flex: 0 1 26rem; min-width: 12rem; }
.idg-bar__search.mud-input-control, .idg-bar__field.mud-input-control { margin-top: 0; }
.idg-bar__field { flex: 0 0 11rem; }
.idg-bar__size { flex-basis: 8rem; }
.idg-bar__spacer { flex: 1 1 auto; }
.idg-bar__refresh.mud-icon-button { border-radius: 6px; }

/* ── The panel and its states ─────────────────────────────────────────── */

.idg-panel { position: relative; min-width: 0; }
.idg-failure { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.idg-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--idg-muted);
    border: 1px dashed var(--idg-control-border);
    border-radius: 10px;
}
.idg-empty__title { margin: 0; font-size: 1rem; font-weight: var(--air-font-weight-semibold, 600); color: var(--idg-text); }
.idg-empty__body { margin: 0; font-size: 0.9375rem; }
.is-stale { opacity: 0.6; pointer-events: none; transition: opacity 120ms ease; }

/* The group's sign: the people icon on a quiet tile. */
.idg-tile {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 6px;
    color: var(--idg-text);
    background: color-mix(in srgb, var(--idg-text) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--idg-text) 18%, transparent);
}
.idg-tile .mud-icon-root { font-size: 1.625rem; }
.idg-tile--small { width: 2.5rem; height: 2.5rem; }
.idg-tile--small .mud-icon-root { font-size: 1.375rem; }

.idg-badge { flex: 0 0 auto; }

/* ── Cards: two per row; the whole card is the link, ⋯ sits above it ── */

.idg-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.idg-card {
    position: relative;
    display: flex;
    min-width: 0;
    background: var(--idg-surface);
    border: 1px solid var(--idg-frame);
    border-top-color: var(--idg-frame-top);
    border-radius: 8px;
    transition: border-color 120ms ease, background-color 120ms ease;
}
.idg-card:hover { background: color-mix(in srgb, var(--idg-accent) 10%, var(--air-surface, var(--mud-palette-surface))); border-color: var(--idg-frame-top); }
.idg-card:has(.idg-card__link:focus-visible) { outline: 2px solid var(--idg-accent); outline-offset: 3px; }
.idg-card__link {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.125rem 1.5rem 1.25rem;
    color: var(--idg-text);
    text-decoration: none;
    border-radius: 8px;
}
.idg-card__link:focus-visible { outline: none; }
.idg-card__top { display: flex; align-items: flex-start; gap: 1.125rem; min-width: 0; padding-bottom: 1rem; border-bottom: 1px solid var(--idg-frame-line); }
.idg-card__titles { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; min-width: 0; min-height: 3rem; }
.idg-card__name { font-size: 1.25rem; line-height: 1.25; font-weight: var(--air-font-weight-bold, 700); overflow-wrap: anywhere; }
.idg-card__ssid { font-size: 0.9375rem; color: color-mix(in srgb, var(--idg-text) 78%, transparent); overflow-wrap: anywhere; }
.idg-card__status { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 2rem; }
.idg-card--menu .idg-card__status { margin-right: 2.75rem; }
.idg-card__menu { position: absolute; top: 1.25rem; right: 1rem; }
.idg-card__body { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.875rem; font-size: 0.9375rem; }
.idg-card__desc { margin-top: 0.25rem; color: color-mix(in srgb, var(--idg-text) 88%, transparent); overflow-wrap: anywhere; }
.idg-fact { display: flex; align-items: flex-start; gap: 0.75rem; min-width: 0; overflow-wrap: anywhere; }
.idg-fact__icon { flex: 0 0 auto; margin-top: 0.125rem; color: var(--idg-text); }
.idg-fact__label { font-weight: var(--air-font-weight-semibold, 600); }
.idg-item-menu .mud-icon-button { color: var(--idg-text); border-radius: 6px; }
.idg-item-menu .mud-icon-button:focus-visible { outline: 2px solid var(--idg-accent); outline-offset: 1px; }

/* ── List: one framed table; the row opens the group, its name is the keyboard's link, ⋯ stays apart ── */

.idg-table-wrap {
    background: var(--idg-surface);
    border: 1px solid var(--idg-frame);
    border-top-color: var(--idg-frame-top);
    border-radius: 8px;
}
.idg-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.9375rem; }
.idg-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    white-space: nowrap;
    font-weight: var(--air-font-weight-semibold, 600);
    border-bottom: 1px solid var(--idg-frame);
}
.idg-table td { padding: 0.75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--idg-frame-line); overflow-wrap: anywhere; }
.idg-table tbody tr:last-child td { border-bottom: 0; }
.idg-table th:first-child, .idg-table td:first-child { padding-left: 1.5rem; }
/* Fixed columns, so a long name, many methods or many SSIDs wrap inside their own column instead of pushing another. */
.idg-table .idg-col-name { width: auto; }
.idg-table .idg-col-auth { width: 18%; }
.idg-table .idg-col-ssid { width: 19%; }
.idg-table .idg-col-members { width: 7.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.idg-table .idg-col-status { width: 8rem; }
.idg-table .idg-col-actions { width: 3.5rem; padding-left: 0; padding-right: 0.75rem; text-align: right; }
.idg-row { cursor: pointer; }
.idg-row:hover, .idg-row:has(.idg-row__link:focus-visible) { background: var(--air-hover, var(--mud-palette-action-default-hover)); }
.idg-row__name-cell { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.idg-row__titles { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.idg-row__link { font-size: 1.0625rem; font-weight: var(--air-font-weight-bold, 700); color: var(--idg-text); text-decoration: none; border-radius: 4px; overflow-wrap: anywhere; }
.idg-row__link:hover { text-decoration: underline; }
.idg-row__link:focus-visible { outline: 2px solid var(--idg-accent); outline-offset: 2px; }
.idg-row__desc { font-size: 0.875rem; color: color-mix(in srgb, var(--idg-text) 82%, transparent); overflow-wrap: anywhere; }
.idg-row__label { display: none; }
.idg-ssid { color: color-mix(in srgb, var(--idg-text) 85%, transparent); }
.idg-ssid__more { white-space: nowrap; }
.idg-table .idg-ssid.idg-muted, .idg-card__ssid .idg-muted { color: var(--idg-muted); }

/* The methods in the list: one quiet pill holding the set (the reference image), wrapping when long. */
.idg-pill {
    display: inline-block;
    max-width: 100%;
    padding: 0.25rem 0.75rem;
    border-radius: 0.875rem;
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--idg-text);
    background: color-mix(in srgb, var(--idg-text) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--idg-text) 22%, transparent);
    overflow-wrap: anywhere;
}

/* ── The pager: only while the store pages ───────────────────────────── */

.idg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.idg-foot__range { font-size: 0.875rem; color: var(--idg-muted); font-variant-numeric: tabular-nums; }

/* ── A narrower work area: the list drops its widths, then stacks; cards go to one column ── */

@container idg-page (max-width: 1000px) {
    .idg-table .idg-col-auth { width: 22%; }
    .idg-table .idg-col-ssid { width: 22%; }
    .idg-table .idg-col-members { width: 6.5rem; }
    .idg-table .idg-col-status { width: 7rem; }
}

@container idg-page (max-width: 760px) {
    .idg-cards { grid-template-columns: minmax(0, 1fr); }
}

@container idg-page (max-width: 900px) {
    /* The list: each row the group's name with ⋯, then its facts, each labelled — the column heads stay for assistive
       technology. No horizontal scrolling at any width. */
    .idg-table, .idg-table tbody { display: block; }
    .idg-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .idg-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 0.75rem;
        padding: 0.75rem 0.75rem 0.875rem 1rem;
        border-bottom: 1px solid var(--idg-frame-line);
    }
    .idg-table tbody tr:last-child { border-bottom: 0; }
    /* Every cell drops its column width (a stacked row has no columns) — the selector outweighs .idg-table .idg-col-*. */
    .idg-table tbody td[class*="idg-col-"], .idg-table tbody td:first-child { width: auto; padding: 0; border-bottom: 0; text-align: left; }
    .idg-table td.idg-col-name { grid-column: 1; grid-row: 1; }
    .idg-table td.idg-col-actions { grid-column: 2; grid-row: 1; align-self: start; }
    .idg-table tbody td.idg-col-auth, .idg-table tbody td.idg-col-ssid, .idg-table tbody td.idg-col-members, .idg-table tbody td.idg-col-status {
        grid-column: 1 / -1;
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
        margin-top: 0.375rem;
        padding-left: 3.5rem;
    }
    .idg-table tbody td.idg-col-status { margin-top: 0.5rem; }
    .idg-row__label { display: inline; flex: 0 0 auto; color: var(--idg-muted); }
    .idg-row__label::after { content: ":"; }
    .idg-pill { padding: 0; border: 0; background: none; }
}

@container idg-page (max-width: 520px) {
    .idg-head__actions { flex: 1 1 100%; justify-content: space-between; }
    .idg-bar__search { flex: 1 1 100%; }
    .idg-bar__spacer { display: none; }
    .idg-card__link { padding: 1rem; }
    .idg-card__top { flex-wrap: wrap; gap: 0.75rem; }
    .idg-card__titles { flex-basis: calc(100% - 4rem); }
    .idg-card__status { order: 3; margin-right: 0; }
    .idg-card--menu .idg-card__titles { padding-right: 2.25rem; }
    .idg-card--menu .idg-card__status { margin-right: 0; }
    .idg-card__menu { top: 1rem; right: 0.625rem; }
    .idg-tile:not(.idg-tile--small) { width: 2.75rem; height: 2.75rem; }
    .idg-table tbody td.idg-col-auth, .idg-table tbody td.idg-col-ssid, .idg-table tbody td.idg-col-members, .idg-table tbody td.idg-col-status { padding-left: 0; }
}

@media (max-width: 600px) {
    .idg-page { padding-top: 1rem; }
}
