/* ========================================
   NAVIGATION HEADER STYLES
   Clean, theme-like implementation
   ======================================== */

.br-nav.br-portal-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: transparent;

    margin: 0 0 24px 0;

    width: 100%;
}

.br-nav-container {
    width: 100%;
    max-width: 95%;           /* NEW: constrain content width */
    padding: 0 34px;             /* inner left/right margin */
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    gap: 16px;
}


/* Logo */
.br-nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.br-nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 40px;
}

.br-logo-img {
    height: 32px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Menu */
.br-nav-menu {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.br-nav-items {
    display: flex;
    flex-direction: row;
    align-items: center;           /* fix vertical alignment */
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.br-nav-item {
    display: inline-flex;
    align-items: center;           /* fix vertical alignment */
    margin: 0;
    padding: 0;
}

/* Links */

.br-nav-link {
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    height: 40px; /* pill height */
    color: var(--br-text, #111827);
    text-decoration: none;
    border-radius: 999px;
    transition: var(--br-transition, all 0.2s ease);
    font-size: 15px;
    font-weight: 500;
    line-height: 1;        /* important: no extra baseline */
    white-space: nowrap;
    cursor: pointer;
}


.br-nav-item.active .br-nav-link {
    color: var(--br-primary, #1B3C57);
    background: rgba(27, 60, 87, 0.06);
}

.br-nav-link:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--br-primary, #1B3C57);
}

/* CTA */
.br-nav-cta {
    background: var(--br-primary, #1B3C57);
    color: #ffffff !important;
    font-weight: 600;
}

.br-nav-cta:hover {
    background: var(--br-primary-dark, #0B2C47);
}

/* Mobile toggle (unchanged) */

.br-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: 8px;
}

.br-nav-toggle span {
    width: 24px;
    height: 3px;
    background: var(--br-text, #333333);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ========================================
   Account dropdown (plugin header)
   ======================================== */

.br-nav-account {
    position: relative;
}

.br-nav-account-toggle {
    all: unset;                         /* wipe theme/button defaults */
    box-sizing: border-box;

    /* Rebuild as a pill, independent of .br-nav-link quirks */
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 16px;
    height: 40px;
    border-radius: 999px;
    cursor: pointer;

    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--br-text, #111827);
    line-height: 1;
    white-space: nowrap;
    transition: var(--br-transition, all 0.2s ease);
}

/* Keep the same hover style as other links */
.br-nav-account-toggle:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--br-primary, #1B3C57);
}

.br-nav-account-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    height: 100%;            /* match the 40px pill */
    line-height: 1;
    margin: 0;
    padding: 0;
}

.br-nav-account-name {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    /* kill any inherited height/line-height weirdness */
    height: auto;
    line-height: 1;
}
.br-nav-account-caret {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.7;
}


.br-nav-account-toggle svg {
    display: block;
}

.br-nav-account-name {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.br-nav-account-caret {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.7;
}

/* Dropdown panel */
.br-nav-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 180px;
    background: var(--br-surface, #ffffff);
    border-radius: var(--br-radius-sm, 8px);
    box-shadow: var(--br-shadow-lg, 0 8px 24px rgba(15,23,42,0.16));
    border: 1px solid var(--br-outline, #e5e7eb);
    padding: 4px 0;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: var(--br-transition, all 0.18s ease);
    z-index: 1100;
}

.br-nav-account.open .br-nav-dropdown,
.br-nav-account:hover .br-nav-dropdown,
.br-nav-account:focus-within .br-nav-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}


/* Dropdown items */
.br-nav-dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 14px;
    font-size: 14px;
    color: var(--br-on-surface, #111827);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
}

.br-nav-dropdown-item:hover {
    background: rgba(15,23,42,0.04);
}

.br-nav-dropdown-logout {
    color: #b91c1c;
}

.br-nav-dropdown-logout:hover {
    background: #fef2f2;
    color: #991b1b;
}


/* Hamburger toggle */
.br-nav-toggle {
    display: none; /* desktop hidden */
    padding: 8px;
    margin-left: 8px;
    border: none;
    background: none;
    cursor: pointer;
}

.br-nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: var(--br-text, #111827);
    transition: var(--br-transition, all 0.2s ease);
}

.br-nav-toggle-bar + .br-nav-toggle-bar {
    margin-top: 5px;
}

/* When menu open, animate into "X" */
.br-nav-menu-is-open .br-nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.br-nav-menu-is-open .br-nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.br-nav-menu-is-open .br-nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile layout */
@media (max-width: 768px) {
    /* Turn the header into a 2-row grid:
       row 1: [hamburger] [logo] [empty]
       row 2: full-width menu
    */
    .br-portal-header .br-nav-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        padding: 0 16px;
    }

    /* Brand centered in the top row */
    .br-portal-header .br-nav-brand {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
    }

    /* Hamburger toggle visible and on the left for LTR */
    .br-portal-header .br-nav-toggle {
        display: inline-flex;
        grid-column: 1;
        grid-row: 1;
        justify-self: flex-start;
        align-items: center;
        padding: 8px;
        margin: 0;
    }

    /* RTL: move hamburger to the right instead */
    [dir="rtl"] .br-portal-header .br-nav-toggle {
        grid-column: 3;
        justify-self: flex-end;
    }

    /* Menu goes to second row, full width */
    .br-portal-header .br-nav-menu {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        display: none; /* default closed */
    }

    .br-portal-header .br-nav-menu.is-open {
        display: block;
    }

    .br-portal-header .br-nav-items {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .br-portal-header .br-nav-item {
        width: 100%;
    }

    .br-portal-header .br-nav-link {
        width: 100%;
        text-align: left;
        border-radius: 8px;
    }

    [dir="rtl"] .br-portal-header .br-nav-link {
        text-align: right;
    }
}


/* RTL support */

[dir="rtl"] .br-nav-menu {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .br-nav-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .br-nav-account-caret {
    margin-left: 0;
    margin-right: 4px;
}
