/* =====================================================================
   frega-chip.css - the SHARED Frega account chip (UI-17 slice 1, 2026-07-16).
   Extracted VERBATIM from frega-header.css (its "Account chip" section) so the
   one chip component can be consumed by every master, not just the two DUW
   ones. Nothing here changed on extraction - slice 1 is a deliberate no-op.

   TWO CONTRACTS, both load-bearing:

   1. The scope is the ID #fregauserContain - do NOT re-scope to a class.
      custom.css carries 9 competing #fregauserContain rules (569,579,644,651,
      1071,1076,1087,1093,1097), including duplicates of the avatar rules below
      (custom.css:1076-1101). These rules win ONLY by being equal-specificity
      (id) and loading later. A class scope (0,1,0) hands the cascade straight
      back to that legacy block.

   2. Load this immediately AFTER frega-header.css, and before any per-brand
      sheet (weblet.master loads weblet.css after the header). frega-header.css
      still holds a tablet-band (768-991) rule for #fregauser-name at equal
      specificity; the chip block sat later in the file and must stay later.

   Accent: hover/active + avatar use the member's OWN accent (--frega-accent,
   published on documentElement by frega-header.js; #303030 fallback) and the
   member initial (--frega-initial) - so one file stays member-accented on the
   hub/weblet and brand-accented elsewhere, with no fork.
   ===================================================================== */

/* =====================================================================
   Account chip -> frega.co.uk-style PILL + dropdown -> modern fly-out card
   (Phase C step 3, frega-only, 2026-06-29). CSS-only restyle of the
   server-rendered AdminFunctionality markup (shared with the hub -> markup
   untouched). Hover/active + avatar use the member's OWN brand accent
   (--frega-accent, published by frega-header.js; #303030 fallback) and the
   member initial (--frega-initial) - NO Frega-green / S2T-orange imposed.
   ===================================================================== */

/* --- the chip cluster: gauge stacked above the account pill, right-aligned ---
   The legacy .memAdminDrop was position:absolute (top:-11px) + min-width:150px
   which let the pill fall outside the header. Put it back in normal flow inside
   the (absolutely right-pinned) #fregauserContain as a tidy right-aligned column
   so the gauge sits cleanly above the pill and nothing overflows. */
#fregauserContain {
    width: auto !important;
    display: block !important;
}
#fregauserContain .memAdminDrop {
    position: static !important;
    top: auto !important;
    display: inline-flex !important;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    min-width: 0 !important;
    padding: 0 !important;
}
#fregauserContain .memFregaRateBlock {
    width: auto !important;
    margin: 0 !important;
}
#fregauserContain .memFregaRateBlock > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- the pill chip (the dropdown trigger: avatar + name + caret) --- */
#fregauserContain .memAdminDropBtn {
    display: inline-flex !important;
    align-items: center;
    gap: 9px;
    margin: 0 !important;
    padding: 4px 14px 4px 4px !important;
    border: 1px solid rgba(0, 0, 0, .12) !important;
    border-radius: 50px !important;
    background: #ffffff !important;
    position: relative;
    cursor: pointer;
    transition: box-shadow .18s ease, border-color .18s ease;
}
#fregauserContain .memAdminDropBtn:hover {
    border-color: var(--frega-accent, #303030) !important;
    background: #ffffff !important;
    color: inherit !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .14);
}

/* avatar circle: the member's initial on the member accent */
#fregauserContain .memAdminDropBtn::before {
    content: var(--frega-initial, "");
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--frega-accent, #303030);
    color: #ffffff;
    font-family: Lato, sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* The member's own profile photo (Website.cs AdminFunctionality), laid OVER the
   ::before initial circle. Absolutely positioned on purpose: it adds no flex
   child, so the pill's layout is byte-for-byte what it was without a photo, and
   the ::before still reserves the 34px. If the blob 404s (member has no photo)
   the inline onerror hides this img and the initial shows through - no generic
   silhouette, no broken-image flash. left:4px == the button's padding-left, so
   it lands exactly on the ::before circle. The alert badge is also absolute but
   pins top-right and comes LATER in the DOM, so it still paints above this. */
#fregauserContain .memAdminDropBtn > #fregauser-photo {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    /* Hard clamp. The stored blobs are FULL SIZE (one measured 564x557 - the
       upload handler's DrawImgScale(200) postdates the older uploads), so the
       size is pinned on both axes and max-* is repeated as a backstop: no
       source image, however large, can push the pill open. The matching
       width/height attributes in the markup cover the unstyled case. */
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
    min-width: 0;
    border-radius: 50%;
    object-fit: cover;      /* fill the circle, never letterbox/stretch */
    object-position: center;
    background: var(--frega-accent, #303030);
    pointer-events: none;
}

/* down-caret on the right of the pill */
#fregauserContain .memAdminDropBtn::after {
    content: "\f078";
    font-family: "Font Awesome 5 Pro";
    font-weight: 900;
    font-size: 11px;
    line-height: 1;
    color: rgba(0, 0, 0, .45);
    flex: 0 0 auto;
}

/* the name text inside the pill */
#fregauserContain #fregauser-name {
    font-style: normal !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    width: auto !important;
    max-width: 140px;
    margin: 0 !important;
    color: #2b2b2b;
    /* keep the legacy single-line ellipsis */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* alert badge -> notification dot pinned to the pill's TOP-RIGHT; hidden empty */
#fregauserContain .memAdminDropBtn > #fregauser-count {
    position: absolute;
    top: -7px;
    right: -5px;
    left: auto;
    margin: 0 !important;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 50px;
    background: #e23b3b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    /* flex-centre so the nested <div>count</div> sits dead-centre both axes */
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid #fff;
}
/* the count markup wraps the number in a child div when alertCount > 0 */
#fregauserContain .memAdminDropBtn > #fregauser-count > div {
    margin: 0;
    padding: 0;
    line-height: 1;
}
/* hide the notification dot when there are no alerts. The base rule above sets
   display:flex !important, so this override MUST also be !important or an EMPTY
   badge still shows as a stray red dot (the count node is present-but-empty when
   there are no messages). */
#fregauserContain .memAdminDropBtn > #fregauser-count:empty {
    display: none !important;
}

/* --- the dropdown fly-out card --- */
/* Anchor it to the RIGHT edge of the cluster so it opens under the account pill
   (the pill sits right of the gauge in the side-by-side cluster). Overrides the
   legacy left/margin-left/top offsets that assumed the old chip position. */
#fregauserContain .menu-admin {
    left: auto !important;
    right: 0 !important;
    top: 100% !important;
    margin-left: 0 !important;
    margin-top: 8px !important;
    border-radius: 14px !important;
    padding: 8px !important;
    border: 1px solid rgba(0, 0, 0, .08) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .18) !important;
    overflow: hidden;
}
/* rows: label left, optional icon right, rounded accent hover */
#fregauserContain #menuDropAdmin {
    text-align: left !important;
}
#fregauserContain .menAdmBtnBtn {
    display: flex;
    align-items: center;
    margin: 2px 0 !important;
    border-radius: 10px;
    color: #2b2b2b;
    font-size: 15px;
    transition: background-color .15s ease;
}
#fregauserContain .menAdmBtnBtn:hover {
    background: rgba(0, 0, 0, .05);
    background: color-mix(in srgb, var(--frega-accent, #303030) 10%, #fff);
}
#fregauserContain .menAdmBtnTxt {
    flex: 1 1 auto;
    width: auto !important;
    float: none !important;
    text-align: left;
    padding: 11px 8px 11px 14px !important;
}
#fregauserContain .menAdmBtnRight {
    width: auto !important;
    float: none !important;
    min-width: 34px;
    padding: 10px 12px !important;
    color: #444;
    font-size: 18px;
}

/* contacts / chat-alerts list at the top of the card */
#fregauserContain .menAdmMsgPreWrap {
    background: transparent !important;
    padding: 4px !important;
}
#fregauserContain #menAdmContMsgContain {
    width: auto !important;
    border-radius: 10px !important;
    border: 1px solid rgba(0, 0, 0, .1) !important;
}
#fregauserContain .menAdmContMsg .userChatCont {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    transition: background-color .2s ease;
}
/* contact avatar: profile photo (1:1) or group glyph */
#fregauserContain .userChatAvatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0, 0, 0, .06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#fregauserContain .userChatAvatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#fregauserContain .userChatAvatar i {
    font-size: 18px;
    color: var(--frega-accent, #303030);
}
#fregauserContain .menAdmContMsg .userChatCont .menACMsgName {
    flex: 1 1 auto;
    width: auto !important;
    font-size: 15px !important;
    vertical-align: middle;
}
#fregauserContain .menAdmContMsg .userChatCont:hover {
    background: rgba(0, 0, 0, .05) !important;
    background: color-mix(in srgb, var(--frega-accent, #303030) 10%, #fff) !important;
}
