/* ==========================================================================
   MERCEA — GLOBAL NAVIGATION
   ========================================================================== */

.global-header {
    position: relative;
    z-index: 100;
    width: 100%;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
}

.global-header-inner {
    display: flex;
    align-items: center;
    gap: 28px;

    width: 100%;
    max-width: 1680px;
    min-height: var(--header-height, 58px);

    margin: 0 auto;
    padding: 0 24px;
}


/* ==========================================================================
   MERCEA WORDMARK
   ========================================================================== */

.brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;

    font-family: var(--font-brand);
    font-size: 27px;
    font-weight: 800;
    letter-spacing: 3.2px;
    line-height: 1;

    color: var(--brand-ivory);
    text-decoration: none;
    white-space: nowrap;
}


/* ==========================================================================
   PRIMARY NAVIGATION
   ========================================================================== */

.global-navigation {
    display: flex;
    align-items: center;
    gap: 22px;

    flex: 1;
    min-width: 0;

    overflow-x: auto;
    scrollbar-width: none;
}

.global-navigation::-webkit-scrollbar {
    display: none;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;

    min-height: 42px;

    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.65px;
    text-transform: uppercase;

    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;

    transition: color 150ms ease;
}

.nav-link:hover:not(.disabled),
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.disabled {
    opacity: 0.4;
    cursor: default;
}


/* ==========================================================================
   HEADER ACTIONS
   ========================================================================== */

.header-actions {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;

    margin-left: auto;
}

.guest-header-actions,
.constituent-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.guest-header-actions[hidden],
.constituent-header-actions[hidden] {
    display: none;
}

.header-signin,
.header-register {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 36px;
    padding: 0 15px;

    border: 1px solid var(--border-secondary);
    border-radius: 24px;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
    text-decoration: none;

    transition:
        background 150ms ease,
        color 150ms ease;
}

.header-signin {
    color: var(--text-primary);
    background: transparent;
}

.header-signin:hover {
    background: var(--bg-hover);
}

.header-register {
    background: var(--brand-ivory);
    border-color: var(--brand-ivory);
    color: var(--bg-primary);
}

.header-register:hover {
    opacity: 0.9;
}


/* ==========================================================================
   CONSTITUENT ACCOUNT BUTTON
   ========================================================================== */

.account-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    min-height: 36px;
    padding: 0 12px;

    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 24px;

    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;

    cursor: pointer;

    transition:
        background 150ms ease,
        color 150ms ease;
}

.account-menu-toggle:hover,
.account-menu-toggle.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.account-menu-toggle svg {
    display: block;
    flex-shrink: 0;
}

#header-constituent-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================================
   ACCOUNT DROPDOWN
   ========================================================================== */

.account-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;

    width: 260px;
    max-width: calc(100vw - 24px);
    padding: 6px;

    background: var(--bg-elevated);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;

    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

.account-menu[hidden],
#admin-menu-section[hidden] {
    display: none;
}

.account-menu-heading {
    padding: 10px 12px;

    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.9px;
    text-transform: uppercase;

    color: var(--text-muted);
}

.account-menu-item {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 38px;
    padding: 9px 12px;

    background: transparent;
    border: none;
    border-radius: 4px;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;

    cursor: pointer;

    transition:
        background 150ms ease,
        color 150ms ease;
}

.account-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.account-menu-divider {
    height: 1px;
    margin: 5px 6px;
    background: var(--border-primary);
}


/* ==========================================================================
   CONSTITUENT IDENTITY
   ========================================================================== */

.account-menu-identity {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
}

.account-menu-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.account-menu-email {
    font-size: 11px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.account-menu-verification {
    margin-top: 5px;
    font-size: 10px;
    color: #d4a76a;
}

.account-menu-verification.verified {
    color: var(--positive);
}


/* ==========================================================================
   SIGN OUT
   ========================================================================== */

.signout-button {
    color: var(--negative);
}

.signout-button:hover {
    background: rgba(229, 115, 120, 0.08);
    color: var(--negative);
}

.signout-button:disabled {
    opacity: 0.5;
    cursor: wait;
}


/* ==========================================================================
   KEYBOARD ACCESSIBILITY
   ========================================================================== */

.global-header a:focus-visible,
.global-header button:focus-visible {
    outline: 2px solid var(--text-secondary);
    outline-offset: 3px;
}


/* ==========================================================================
   RESPONSIVE NAVIGATION
   ========================================================================== */

@media (max-width: 1250px) {

    .global-header-inner {
        gap: 20px;
    }

    .global-navigation {
        gap: 14px;
    }

    .nav-link {
        font-size: 10px;
    }
}

@media (max-width: 1000px) {

    .global-header-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0 12px;

        padding: 10px 16px 0;
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
    }

    .header-actions {
        grid-column: 2;
        grid-row: 1;
    }

    .global-navigation {
        grid-column: 1 / -1;
        grid-row: 2;

        gap: 22px;
        margin-top: 6px;
    }

    .nav-link {
        min-height: 38px;
        font-size: 11px;
    }
}

@media (max-width: 600px) {

    .global-header-inner {
        padding: 10px 12px 0;
        gap: 0 8px;
    }

    .brand {
        font-size: 21px;
        letter-spacing: 2px;
    }

    .guest-header-actions {
        gap: 6px;
    }

    .header-signin,
    .header-register {
        min-height: 32px;
        padding: 0 10px;
        font-size: 10px;
    }

    .global-navigation {
        gap: 18px;
    }

    .account-menu-toggle {
        min-height: 32px;
        padding: 0 10px;
    }

    #header-constituent-name {
        max-width: 70px;
    }
}

@media (max-width: 360px) {

    .brand {
        font-size: 18px;
        letter-spacing: 1px;
    }

    .header-signin,
    .header-register {
        padding: 0 7px;
    }
}