/* ── WealthMeadow Shared App Navbar ───────────────────────────────────────── */

:root {
    --app-color: #6B7E52;
    --wm-nav-bg: #141914;
    --wm-nav-border: rgba(188, 170, 126, .55);
}

/* ── Nav shell ── */
.wm-navbar {
    background: var(--wm-nav-bg);
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 -2px 0 var(--app-color);
    position: sticky;
    top: 0;
    z-index: 100;
    min-width: 0;
}

/* The WealthMeadow home dashboard uses the shared public light/dark chrome. */
.wm-navbar--wealth {
    height: 86px;
    padding: 0 clamp(24px, 6vw, 104px);
    background: rgba(255, 254, 250, .98);
    border-bottom: 1px solid rgba(23, 61, 49, .12);
    box-shadow: none;
}
.wm-navbar--wealth .wm-nav-home { padding-right: 28px; color: #173d31; }
.wm-wealth-nav-wordmark { display: block; width: 290px; height: auto; }
.wm-wealth-nav-wordmark-dark { display: none; }
.wm-navbar--wealth .wm-nav-switcher { gap: 0; margin-left: 0; }
.wm-navbar--wealth .wm-nav-switch-btn {
    padding: 5px 16px;
    border-radius: 0;
    border-right: 1px solid rgba(23, 61, 49, .16);
    color: #173d31;
    font-size: 14px;
}
.wm-navbar--wealth .wm-nav-switch-btn .wm-app-mark { display: none; }
.wm-navbar--wealth .wm-nav-switch-btn:hover, .wm-navbar--wealth .wm-nav-switch-btn.active { background: transparent; color: #a77b26; }
.wm-navbar--wealth .wm-nav-right { gap: 0; }
.wm-navbar--wealth .wm-nav-link { padding: 5px 16px; color: #173d31; border-right: 1px solid rgba(23, 61, 49, .16); }
.wm-navbar--wealth .wm-nav-link:hover { color: #a77b26; background: transparent; }
.wm-navbar--wealth .wm-nav-theme { width: 38px; height: 38px; margin-left: 16px; border: 1px solid rgba(23, 61, 49, .18); border-radius: 50%; background: transparent; color: #315847; }
.wm-navbar--wealth .wm-nav-theme:hover { background: #edf1e8; }
.wm-navbar--wealth .wm-nav-avatar-inline { background: #b18735; color: #fffefa; }
.wm-navbar--wealth .wm-nav-signout-btn { color: #52685e; }
[data-theme="dark"] .wm-navbar--wealth { background: #0d1720; border-bottom-color: rgba(224, 239, 236, .14); }
[data-theme="dark"] .wm-navbar--wealth .wm-wealth-nav-wordmark-light { display: none; }
[data-theme="dark"] .wm-navbar--wealth .wm-wealth-nav-wordmark-dark { display: block; }
[data-theme="dark"] .wm-navbar--wealth .wm-nav-switch-btn, [data-theme="dark"] .wm-navbar--wealth .wm-nav-link { color: #eff5f5; border-color: rgba(224, 239, 236, .16); }
[data-theme="dark"] .wm-navbar--wealth .wm-nav-switch-btn:hover, [data-theme="dark"] .wm-navbar--wealth .wm-nav-switch-btn.active, [data-theme="dark"] .wm-navbar--wealth .wm-nav-link:hover { color: #f4dc8e; }
[data-theme="dark"] .wm-navbar--wealth .wm-nav-theme { border-color: rgba(224, 239, 236, .24); color: #f4dc8e; }
[data-theme="dark"] .wm-navbar--wealth .wm-nav-theme:hover { background: rgba(255,255,255,.08); }

.wm-beta-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px 10px;
    padding: 9px 16px;
    border-bottom: 1px solid rgba(154, 122, 62, .35);
    background: #f4ecd9;
    color: #4d4128;
    font-size: .84rem;
    line-height: 1.35;
    text-align: center;
}

.wm-beta-label {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #7d6030;
    color: #fff8e8;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.wm-beta-banner strong {
    color: #5f4821;
    font-weight: 700;
}

[data-theme="dark"] .wm-beta-banner {
    border-bottom-color: rgba(214, 182, 108, .3);
    background: #292318;
    color: #e7dcc3;
}

[data-theme="dark"] .wm-beta-label {
    background: #d6b66c;
    color: #201a10;
}

[data-theme="dark"] .wm-beta-banner strong {
    color: #f2d99d;
}

/* ── Left side ── */
.wm-nav-left {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1 1 auto;
    min-width: 0;
}

/* WealthMeadow home */
.wm-nav-home {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    text-decoration: none;
    padding: 4px 12px 4px 0;
    color: #f2e4bd;
    font-size: 0.98rem;
    font-weight: 500;
}

.wm-nav-home:hover {
    color: #fff2ce;
}

.wm-nav-home-label strong {
    font-weight: 800;
}

.wm-app-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--app-color);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
}
.wm-app-mark svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.wm-app-mark-wealth { color: #d6b66c; }
.wm-app-mark-budget { color: #9db77a; }
.wm-app-mark-invest { color: #7ba7ff; }
.wm-app-mark-retire { color: #c493ff; }
.wm-nav-switch-btn .wm-app-mark {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: transparent;
    border: none;
    color: currentColor;
    opacity: .82;
}
.wm-nav-switch-btn .wm-app-mark svg {
    width: 15px;
    height: 15px;
    stroke-width: 2.2;
}
.wm-nav-switch-btn:hover .wm-app-mark,
.wm-nav-switch-btn.active .wm-app-mark {
    opacity: 1;
}

/* App switcher */
.wm-nav-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    flex: 0 0 auto;
}

.wm-nav-switch-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    background: transparent;
    transition: background 0.15s, color 0.15s;
}

.wm-nav-switch-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}

.wm-nav-switch-btn.active {
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    cursor: default;
}

/* Active indicator strip */
.wm-nav-switch-btn.active {
    box-shadow: inset 0 -2px 0 var(--btn-color);
}

/* ── Right side ── */
.wm-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 0;
}

.wm-nav-link {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}

.wm-nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

/* Premium badge */
.wm-nav-premium {
    font-size: 0.72rem;
    font-weight: 700;
    color: #f5c542;
    background: rgba(245,197,66,0.12);
    border: 1px solid rgba(245,197,66,0.30);
    border-radius: 5px;
    padding: 3px 8px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Dark mode toggle */
.wm-nav-theme {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    color: #fff;
    transition: background 0.15s;
}

.wm-nav-theme:hover {
    background: rgba(255,255,255,0.16);
}

.wm-nav-theme .wm-theme-icon {
    display: block;
    height: 18px;
    width: 18px;
}

.wm-nav-theme .wm-theme-icon-sun,
[data-theme="dark"] .wm-nav-theme .wm-theme-icon-moon {
    display: none;
}

[data-theme="dark"] .wm-nav-theme .wm-theme-icon-sun {
    display: block;
}

/* User avatar + dropdown */
.wm-nav-user-wrap {
    position: relative;
}

.wm-nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--app-color);
    border: 2px solid rgba(255,255,255,0.20);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.wm-nav-avatar:hover {
    border-color: rgba(255,255,255,0.50);
}

.wm-nav-user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #1e2618;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    padding: 6px 0;
    display: none;
    z-index: 200;
}

.wm-nav-user-menu.open {
    display: block;
}

.wm-nav-user-name {
    padding: 8px 14px 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
}

.wm-nav-user-menu a {
    display: block;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.wm-nav-user-menu a:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.wm-nav-signout {
    color: #f87171 !important;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
}

.wm-nav-signout:hover {
    background: rgba(248,113,113,0.10) !important;
}

/* ── Inline avatar + username ── */
.wm-nav-avatar-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--app-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.wm-nav-account-label {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
}

/* ── Visible Sign Out button ── */
.wm-nav-signout-btn {
    display: inline-flex;
    align-items: center;
    font-family: inherit;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.70);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.wm-nav-signout-btn:hover {
    background: rgba(248,113,113,0.18);
    color: #fca5a5;
    border-color: rgba(248,113,113,0.35);
}

/* Mobile-only app section links. These mirror app-specific desktop links such
   as Budget's Insights/History/Help without crowding the top phone header. */
.wm-mobile-subnav {
    display: none;
}

.wm-mobile-subnav-link {
    text-decoration: none;
}

/* ── Responsive: hide switcher labels on small screens ── */
@media (max-width: 700px) {
    .wm-nav-switch-btn span { display: none; }
    .wm-nav-home-label       { display: none; }
    .wm-nav-link             { display: none; }

    .wm-mobile-subnav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 8px 12px;
        border-bottom: 1px solid rgba(188, 170, 126, .26);
        background: #20281f;
        background: color-mix(in srgb, var(--wm-nav-bg) 94%, white);
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    .wm-mobile-subnav-link {
        flex: 0 0 auto;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px 12px;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 999px;
        background: rgba(255,255,255,.07);
        color: rgba(255,255,255,.82);
        font-size: .8rem;
        font-weight: 700;
        white-space: nowrap;
    }
    .wm-mobile-subnav-link:hover,
    .wm-mobile-subnav-link:focus-visible {
        color: #fff;
        background: rgba(255,255,255,.13);
        outline: none;
    }
}

@media (max-width: 500px) {
    .wm-navbar {
        padding: 0 8px;
        gap: 4px;
    }
    .wm-nav-left {
        flex: 1 0 auto;
        min-width: 156px;
    }
    .wm-nav-home { padding-right: 4px; }
    .wm-nav-switcher {
        display: flex;
        gap: 2px;
        margin-left: 2px;
    }
    .wm-nav-switch-btn { padding: 6px; }
    .wm-nav-switch-btn .wm-app-mark {
        width: 20px;
        height: 20px;
    }
    .wm-nav-right { gap: 5px; }
    .wm-nav-premium { display: none; }
    .wm-nav-theme { padding: 6px; }
    .wm-nav-signout-btn {
        width: 36px;
        height: 32px;
        justify-content: center;
        padding: 0;
        font-size: 0;
        color: rgba(255,255,255,0.78);
    }
    .wm-nav-signout-btn::after {
        content: "Out";
        font-size: .72rem;
        font-weight: 800;
        line-height: 1;
    }
}
