/* ============================================================================
   Shared ops nav-cluster styles (#2024)

   Top-right cluster: language · waffle apps launcher · avatar account menu.
   Linked by both base.html and settings/base.html so the headers can't drift.
   Originated as duplicated blocks in #1995 (base.html) and #2023 (settings).
   ============================================================================ */
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
/* Anonymous Sign-In pill (#3267). base.html styles .header-login-btn in its own
   inline <style> via var(--accent); static R2 pages (Words meetings, People) only
   load THIS sheet, so the fetched nav-cluster fragment's <a class="header-login-btn">
   rendered as unstyled text without this rule. var(--accent, …) keeps base.html's
   theming (incl. dark mode) where the token is defined and falls back on static pages. */
.header-login-btn {
    display: inline-flex; align-items: center;
    background: var(--accent, #005ea2); color: #fff; border: none;
    padding: .4rem .875rem; border-radius: 4px; cursor: pointer;
    font-size: .8rem; font-weight: 500; line-height: 1.2;
    text-decoration: none; white-space: nowrap;
}
.header-login-btn:hover { background: var(--accent-2, #1a4480); }
.apps-waffle, .profile-wrap { position: relative; }
.icon-btn, .avatar-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid transparent;
    background: transparent; cursor: pointer; display: flex; align-items: center;
    justify-content: center; padding: 0; transition: background .15s;
}
.icon-btn:hover, .avatar-btn:hover { background: #eef1f5; }
.icon-btn[aria-expanded="true"], .avatar-btn[aria-expanded="true"] { background: #e7eef7; }
/* Waffle a bit bigger than the profile button (#2839 chrome tweak). */
.icon-btn { width: 44px; height: 44px; }
.waffle-glyph { display: grid; grid-template-columns: repeat(3,1fr); gap: 3.5px; width: 24px; height: 24px; }
.waffle-glyph i { background: #1a4480; border-radius: 2px; opacity: .85; }
/* Dark internal chrome (#3624): the navy waffle dots vanish on the dark header —
   flip to light dots and dark-aware hover fills. Contrast rules documented in
   docs/design/header-controls-light-dark.md */
body.internal-surface:not(.force-light) .waffle-glyph i { background: #c2cfe0; opacity: .92; }
body.internal-surface:not(.force-light) .icon-btn:hover,
body.internal-surface:not(.force-light) .avatar-btn:hover { background: rgba(160,190,230,.16); }
body.internal-surface:not(.force-light) .icon-btn[aria-expanded="true"],
body.internal-surface:not(.force-light) .avatar-btn[aria-expanded="true"] { background: rgba(160,190,230,.26); }
/* Avatar fills the 40px profile button so its outer circle matches the UG logo height. */
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg,#1a4480,#005ea2); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .95rem; border: 2px solid #fff; box-shadow: 0 0 0 1px #dfe1e2;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; margin: 0 auto 10px; }
.apps-pop, .profile-pop {
    /* z-index 1100: above the Leaflet control tier (.leaflet-top/.leaflet-bottom
       default to 1000) so the header chrome popovers aren't occluded by the +/-
       map zoom controls on entity map pages (#3051). Stays below the dialog/modal
       tier (cgb-modal is 1500). The popovers compete in the root stacking context
       because .site-header sets no position/z-index, so this must beat 1000. */
    position: absolute; top: 52px; right: 0; z-index: 1100; background: #fff;
    border: 1px solid #dfe1e2; border-radius: 14px; box-shadow: 0 12px 40px rgba(20,40,80,.18);
    display: none;
}
.apps-pop.open, .profile-pop.open { display: block; }
.apps-pop { width: 300px; padding: 14px; }
.apps-pop-h { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; padding: 2px 6px 10px; }
.apps-pop-h-note { font-weight: 500; color: #9aa3af; letter-spacing: 0; text-transform: none; }
.apps-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; }
/* Four-section waffle (#2038): Government Transparency / Public Actions / UnGovr
   Published Sites (all public), then the gated Internal UnGovr section. */
.apps-pop-sep { border-top: 1px solid #dfe1e2; margin: 8px 6px 12px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px; border-radius: 10px; text-align: center; text-decoration: none; position: relative; }
.app-tile:hover { background: #f5f7fa; }
.app-tile .ic { width: 30px; height: 30px; color: #1a4480; display: flex; align-items: center; justify-content: center; }
.app-tile .ic svg { width: 26px; height: 26px; }
.app-tile .lbl { font-size: .74rem; color: #3d4551; font-weight: 500; line-height: 1.15; }
.app-tile .crawl-activity-dot { position: absolute; top: 8px; right: 14px; margin: 0; }
.profile-pop { width: 282px; overflow: hidden; }
.profile-head { padding: 18px 16px 14px; text-align: center; border-bottom: 1px solid #dfe1e2; }
.profile-name { font-weight: 700; color: #1a4480; }
.profile-name a { color: inherit; text-decoration: none; }
.profile-name a:hover { text-decoration: underline; }
.profile-role { font-size: .78rem; color: #6b7280; margin-top: 1px; }
.profile-row {
    display: flex; align-items: center; gap: 10px; padding: 11px 16px; font-size: .88rem;
    color: #3d4551; cursor: pointer; text-decoration: none; width: 100%;
    background: none; border: none; text-align: left; font-family: inherit;
}
.profile-row:hover { background: #f5f7fa; }
.profile-row svg { width: 18px; height: 18px; color: #6b7280; flex-shrink: 0; }
.profile-row.sep { border-top: 1px solid #dfe1e2; }
.profile-row .chev { margin-left: auto; color: #6b7280; font-size: .8rem; }
.profile-row.console { background: #f3f7fc; border-top: 1px solid #dfe1e2; border-bottom: 1px solid #dfe1e2; color: #1a4480; font-weight: 600; }
.profile-row.console svg, .profile-row.console .chev { color: #005ea2; }
.profile-pop .entity-selector-wrap { padding: 6px 12px; margin: 0; }
.profile-pop .entity-selector input { width: 100%; }
/* Flow the "act as" results inline so they aren't clipped by the popover's
   overflow:hidden (the popover grows; on mobile it scrolls). */
.profile-pop .entity-dropdown { position: static; box-shadow: none; max-height: 220px; }
@media (max-width: 640px) {
    .apps-pop, .profile-pop { position: fixed; top: 64px; left: 8px; right: 8px; width: auto; max-height: 75vh; overflow-y: auto; }
}
