/*
 * The header bar (templates/base/components/navbar.html), option A of the header mockups
 * (Philipp, 2026-10-04): logo | links | team pill + account menu, one height, labels on one
 * line; while impersonating the whole bar turns amber (as in mockup B). Loaded after css/base.css, so the phone
 * rules there (fixed bar, collapsed links, dropdown positions) still apply below 992 px; the
 * rules here only add what they do not cover.
 */

.sg-header {
    min-height: 60px;
    padding-top: 0;
    padding-bottom: 0;
    /* The open menus lie over everything on the page (Philipp, 2026-10-04): maps (Leaflet
       stacks its panes and controls up to z-index 1000), the sticky top of the sidebar and
       the timeline. Below Bootstrap's modal backdrop (1040) and modals (1050), so a dialog
       still covers the header. On a phone css/base.css makes the bar fixed at 9999. */
    position: relative;
    z-index: 1035;
}

.sg-header-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 16px;
    min-height: 60px;
}

.sg-header .navbar-brand {
    margin-right: 0;
    padding: 0;
}

.sg-header .navbar-brand img {
    height: 30px;
    width: auto;
}

/* -- the team pill (right, next to the avatar) ----------------------------- */

.sg-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px 0 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.sg-switch:hover,
.sg-switch:focus,
.sg-switch[aria-expanded="true"] {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.16);
}

.sg-switch-name {
    font-weight: 600;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sg-chevron {
    font-size: 0.7rem;
    color: #adb5bd;
}

.sg-team-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 6px;
    object-fit: cover;
}

.sg-team-icon-lg {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
}

.sg-team-icon-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
}

.sg-team-icon-lg.sg-team-icon-initials {
    font-size: 11px;
}

/* -- the links: one line each, the open page underlined ------------------- */

.sg-header .navbar-collapse {
    flex: 1 1 auto;
    min-width: 0;
}

.sg-nav {
    align-items: stretch;
    flex-wrap: nowrap;
}

.sg-header .sg-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 60px;
    padding: 0 12px;
    white-space: nowrap;
    color: #c8cdd2;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}

.sg-header .sg-nav .nav-link:hover {
    color: #fff;
}

.sg-header .sg-nav .nav-link.active {
    color: #fff;
    border-bottom-color: #5aa9ff;
}

/* -- the right side: team pill, toggler, avatar ---------------------------- */

.sg-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex: 0 0 auto;
}

.sg-avatar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.sg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.sg-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.sg-create-team {
    white-space: nowrap;
}

/* -- the menus ------------------------------------------------------------ */

.sg-menu {
    z-index: 1036;
    min-width: 16rem;
    padding: 0.5rem 0;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.sg-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.45rem 1rem;
}

.sg-menu .dropdown-item .fa-fw {
    color: #6c757d;
}

.sg-menu .dropdown-item.text-warning .fa-fw {
    color: inherit;
}

.sg-menu-current {
    font-weight: 600;
}

.sg-check {
    margin-left: auto;
    color: #0b5ed7;
}

.sg-account-who {
    padding: 0.5rem 1rem 0.25rem;
    white-space: nowrap;
}

/* Bootstrap 4 has no .dropdown-divider on an <hr> inside a <li> (HORUS menu): drawn here. */
.sg-menu hr.dropdown-divider {
    margin: 0.4rem 0;
    border: 0;
    border-top: 1px solid #e9ecef;
}

/* -- impersonating: the whole bar turns amber (as in mockup B; 2026-10-04) -- */

.sg-header.sg-header-impersonating {
    background-color: #f0ad4e !important;
}

.sg-header-impersonating .sg-nav .nav-link {
    color: #3d2c06;
}

.sg-header-impersonating .sg-nav .nav-link:hover,
.sg-header-impersonating .sg-nav .nav-link.active {
    color: #000;
}

.sg-header-impersonating .sg-nav .nav-link.active {
    border-bottom-color: #212529;
}

/* The white logo on amber: made dark, so it can still be read. */
.sg-header-impersonating .navbar-brand img {
    filter: brightness(0.15);
}

.sg-header-impersonating .sg-switch {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.35);
    color: #212529;
}

.sg-header-impersonating .sg-switch:hover,
.sg-header-impersonating .sg-switch:focus,
.sg-header-impersonating .sg-switch[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.15);
    color: #212529;
}

.sg-header-impersonating .sg-chevron {
    color: #212529;
}

.sg-header-impersonating .navbar-toggler-icon {
    filter: invert(1);
}

.sg-stop {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    background: #212529;
    color: #f0ad4e;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.sg-stop:hover,
.sg-stop:focus {
    background: #000;
    color: #ffc66d;
    text-decoration: none;
}

/* -- phone and small tablet (the rules of css/base.css apply too) --------- */

@media (min-width: 993px) {
    .sg-toggler {
        display: none !important;
    }
}

@media (max-width: 992px) {
    /* The row keeps to the width of the screen (2026-10-04: at 390 px it was 485 px wide and
       the whole page scrolled sideways): the team pill shrinks, its name ends in "...". */
    .sg-header {
        width: 100%;
        max-width: 100vw;
    }

    .sg-header-row {
        flex-wrap: nowrap !important;
        gap: 6px;
        min-height: 48px;
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }

    .sg-header .navbar-brand img {
        height: 24px;
    }

    .sg-header-right {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        gap: 6px;
    }

    .sg-team-switcher {
        min-width: 0;
        flex: 0 1 auto;
    }

    .sg-switch {
        height: 36px;
        min-width: 0;
        max-width: 100%;
    }

    .sg-switch-name {
        max-width: none;
        min-width: 0;
    }

    .sg-toggler {
        flex: 0 0 auto;
        margin-right: 0 !important;
    }

    .sg-avatar-button {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
    }

    /* On a phone only the icon of "Stop impersonating"; its label stays for screen readers. */
    .sg-stop-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .sg-stop {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .sg-header .sg-nav .nav-link {
        height: auto;
        padding: 0.6rem 0.75rem;
        border: 0;
    }

    .sg-header .sg-nav .nav-link.active {
        box-shadow: inset 3px 0 0 #5aa9ff;
    }
}

/* The group headings of the HORUS menu (2026-10-04). */
.sg-menu .dropdown-header {
    padding: 0.35rem 1rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #868e96;
}

/* -- "More" (2026-10-04): the HORUS menu with the shield, or the menu of the team, next to the team pill -- */

.sg-more-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 10px;
    border-radius: 8px;
    color: #c8cdd2;
    text-decoration: none;
    white-space: nowrap;
}

.sg-more-toggle:hover,
.sg-more-toggle:focus,
.sg-more-toggle[aria-expanded="true"],
.sg-more-toggle.active {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
}

.sg-header-impersonating .sg-more-toggle {
    color: #3d2c06;
}

.sg-header-impersonating .sg-more-toggle:hover,
.sg-header-impersonating .sg-more-toggle[aria-expanded="true"],
.sg-header-impersonating .sg-more-toggle.active {
    color: #000;
    background: rgba(0, 0, 0, 0.1);
}

@media (max-width: 992px) {
    /* On a phone only the icon of "More". */
    .sg-more-text,
    .sg-more-toggle .sg-chevron {
        display: none;
    }

    .sg-more-toggle {
        width: 40px;
        padding: 0;
        justify-content: center;
    }
}
