/*
 * mw-view-scope.css — MwViewScopeWidget (PeoplePage toolbar).
 *
 * A single-line "who is shown" indicator. It NEVER wraps: the host is a query
 * container (container-type: inline-size), and @container rules below degrade the
 * content as the available width shrinks — drop the connector word, collapse the
 * team list to a count, then a minimal icon-only form. The event name truncates
 * continuously via flex + ellipsis. Hover popovers carry the full breakdown so
 * truncation never loses information.
 *
 * All colours come from --mud-palette-* so the widget tracks the active theme.
 */

.mw-vs-host {
    container-type: inline-size;
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
}

.mw-vs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    padding: 4px 11px 4px 6px;
}

.mw-vs-ico {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: none;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
}
.mw-vs-ico svg { display: block; }

.mw-vs-conn {
    color: var(--mud-palette-text-secondary);
    flex: none;
}
.mw-vs-sep {
    display: none;
    color: var(--mud-palette-text-disabled);
    font-weight: 700;
    flex: none;
}

/* ── listed team chips (≤ 3 teams) ── */
.mw-vs-teams-list {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    min-width: 0;
}
.mw-vs-tchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    background: var(--mud-palette-background-grey);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    padding: 2px 9px 2px 7px;
    font-weight: 600;
}
.mw-vs-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-surface) 70%, transparent);
}

/* ── hoverable pills (team count / event / global) ── */
.mw-vs-chip { display: inline-flex; align-items: center; min-width: 0; }
.mw-vs-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    border-radius: 999px;
    padding: 3px 10px 3px 7px;
    font-weight: 700;
    cursor: default;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-grey);
    transition: border-color .15s, background .15s;
}
.mw-vs-pill:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, var(--mud-palette-background-grey));
}
.mw-vs-pill svg { flex: none; opacity: 0.8; }
.mw-vs-caret { opacity: 0.45; flex: none; }
.mw-vs-pill:hover .mw-vs-caret { opacity: 0.8; }

.mw-vs-pill-global {
    color: var(--mud-palette-primary);
    border-color: color-mix(in srgb, var(--mud-palette-primary) 42%, transparent);
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
}

/* stacked dots inside the count pill */
.mw-vs-stack { display: inline-flex; align-items: center; flex: none; }
.mw-vs-stack .mw-vs-dot {
    width: 11px;
    height: 11px;
    margin-left: -5px;
    box-shadow: 0 0 0 2px var(--mud-palette-background-grey);
}
.mw-vs-stack .mw-vs-dot:first-child { margin-left: 0; }

.mw-vs-num { font-variant-numeric: tabular-nums; }
.mw-vs-unit { /* the " teams" word — dropped at the tightest width */ }

/* event name — truncates continuously */
.mw-vs-evname {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 22ch;
}
.mw-vs-chip-event { flex: 0 1 auto; }

/* The count pill is only the fallback when a team list is present: hidden until the
   250px @container breakpoint below swaps them. When teams > 3 the component adds
   .mw-vs-teams-count--always, which keeps it visible at every width. These base
   rules MUST precede the @container blocks so the breakpoint (equal specificity,
   later in source) wins at narrow widths. */
.mw-vs-teams-count { display: none; }
.mw-vs-teams-count.mw-vs-teams-count--always { display: inline-flex; }

/* ── popover ──
   Rendered through MudPopover (portals to MudPopoverProvider at the document root) so
   the card escapes the data-grid toolbar's overflow clipping while keeping full custom
   styling. The anchor is position:relative so MudPopover positions under the pill. */
.mw-vs-anchor {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

/* Strip MudPopover's own surface so .mw-vs-pop-inner is the only card chrome. */
.mw-vs-popover {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

.mw-vs-pop-inner {
    min-width: 220px;
    max-width: 340px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    box-shadow: 0 16px 42px -12px rgba(0,0,0,.55), 0 4px 12px -6px rgba(0,0,0,.4);
    overflow: hidden;
}
.mw-vs-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.mw-vs-pop-head .t {
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    font-weight: 700;
}
.mw-vs-pop-head .n {
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    color: var(--mud-palette-primary);
}
.mw-vs-pop-body { padding: 5px; max-height: 240px; overflow-y: auto; }
.mw-vs-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border-radius: 7px;
}
.mw-vs-row:hover { background: var(--mud-palette-action-default-hover); }
.mw-vs-row .name {
    font-weight: 600;
    font-size: 0.8rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mw-vs-row .name .sub {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--mud-palette-text-disabled);
}
.mw-vs-row .count {
    font-variant-numeric: tabular-nums;
    font-size: 0.74rem;
    color: var(--mud-palette-text-secondary);
}
.mw-vs-pop-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid var(--mud-palette-lines-default);
    font-size: 0.74rem;
    color: var(--mud-palette-text-secondary);
}
.mw-vs-pop-foot .v {
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-primary);
}
.mw-vs-pop-note {
    padding: 11px 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--mud-palette-text-secondary);
}
.mw-vs-pop-note b { color: var(--mud-palette-text-primary); }

/* ════════════ responsive concession ladder ════════════
   Breakpoints read the host (available toolbar space). The event name
   ellipsis covers slack between these discrete steps. */

/* drop the connector word → thin separator */
@container (max-width: 300px) {
    .mw-vs-conn { display: none; }
    .mw-vs-sep { display: inline; }
}

/* collapse a listed team set to its count pill */
@container (max-width: 250px) {
    .mw-vs-teams-list { display: none; }
    .mw-vs-teams-count { display: inline-flex; }
}

/* minimal: drop the " teams" word and the event name (icon-only) */
@container (max-width: 190px) {
    .mw-vs-unit { display: none; }
    .mw-vs-evname { display: none; }
    .mw-vs { gap: 6px; }
}
