/* Header nav styling. The condensed variant is applied when the hamburger menu is
   hidden and all nav items must fit on a single horizontal row. */

#header-container #menu-primary-navigation {
    gap: 1rem;
}

@media (max-width: 991.98px) {
    #header-container.nav-condensed #menu-primary-navigation {
        gap: 0.25rem;
    }

    #header-container.nav-condensed .nav-item {
        margin-inline: 0;
    }

    #header-container.nav-condensed .nav-link {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    #header-container.nav-condensed .navbar-brand {
        margin-right: 0.5rem;
    }

        #header-container.nav-condensed .navbar-brand .brand-logo {
            height: 36px;
            max-height: 36px;
            max-width: 120px;
        }
}

/* ----- Settings offcanvas -----
   Presented as a floating card pinned to the top-right rather than a full-height
   drawer, since the panel only ever holds a handful of links. */

.settings-offcanvas.offcanvas {
    top: 1rem;
    bottom: auto;
    height: auto;
    max-height: calc(100vh - 2rem);
    margin-right: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.125);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.175);
    overflow: hidden;
}

.settings-offcanvas .offcanvas-body {
    overflow-y: auto;
}

/* Identity block: confirms which account the settings apply to. */
.settings-offcanvas .settings-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.settings-offcanvas .settings-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
}

/* Long emails must truncate rather than widen the panel. */
.settings-offcanvas .settings-identity-text {
    min-width: 0;
}

.settings-offcanvas .settings-identity-text > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-offcanvas .settings-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6c757d;
}

/* Menu rows read as a list, not a form: no outline, tinted hover instead. */
.settings-offcanvas .settings-link {
    --bs-btn-border-color: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-border-color: transparent;
    --bs-btn-color: #212529;
    --bs-btn-hover-color: #212529;
    --bs-btn-hover-bg: rgba(0, 0, 0, 0.05);
    --bs-btn-active-bg: rgba(0, 0, 0, 0.08);
}

.settings-offcanvas .settings-link.active {
    --bs-btn-bg: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.settings-offcanvas .settings-link-danger {
    --bs-btn-color: var(--bs-danger);
    --bs-btn-hover-color: var(--bs-danger);
    --bs-btn-hover-bg: rgba(var(--bs-danger-rgb), 0.1);
    --bs-btn-active-bg: rgba(var(--bs-danger-rgb), 0.15);
}

/* Leading and trailing icons are set here so views don't inline font sizes. */
.settings-offcanvas .settings-link .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
}

.settings-offcanvas .settings-link .settings-link-chevron {
    font-size: 16px;
}

/* On small screens drop the floating treatment and fill the width. */
@media (max-width: 575.98px) {
    .settings-offcanvas.offcanvas {
        top: 0;
        height: 100%;
        max-height: none;
        width: 100%;
        margin-right: 0;
        border: 0;
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .settings-offcanvas.offcanvas {
        transition: none;
    }
}
