/* ==========================================================================
   BrainerBot — Navigation Shell
   Mobile (<768px): fixed bottom nav, messenger-style 5 tabs
   Desktop (>=768px): sticky top nav, logo left + links center + account right
   ========================================================================== */

/* ------- Mobile top strip (logo + profile only) ---------------------------- */
.bb-topbar-mobile {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    height: var(--bb-nav-top);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--bb-border);
}
@media (min-width: 768px) { .bb-topbar-mobile { display: none; } }

.bb-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--bb-font-display);
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--bb-text);
}
.bb-logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 4px 12px rgba(234, 88, 12, .25);
}
.bb-topbar-desktop .bb-logo-mark { width: 32px; height: 32px; border-radius: 10px; }
.bb-logo-word { color: var(--bb-text); }
.bb-logo-word em { font-style: italic; color: var(--bb-primary); font-weight: 500; }

.bb-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--bb-border);
    background: var(--bb-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bb-text-muted);
    overflow: hidden;
    transition: border-color .2s ease;
}
.bb-avatar-btn:hover { border-color: var(--bb-primary); color: var(--bb-primary); }
.bb-avatar-btn.is-authed { border-color: var(--bb-primary); }
.bb-avatar-btn .bb-avatar-fallback {
    font-weight: 600;
    color: var(--bb-primary);
    font-size: 14px;
}

/* Bottom-nav profile: replace SVG icon with round picture when signed in */
.bb-nav-avatar-img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--bb-primary);
    box-shadow: 0 1px 3px rgba(234, 88, 12, .25);
}
.bb-nav-avatar-initial {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bb-primary);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ------- Desktop top nav --------------------------------------------------- */
.bb-topbar-desktop {
    display: none;
}
@media (min-width: 768px) {
    /* Top nav is permanently fixed (same as mobile bottom nav). Reserve
       space for it ONLY on pages that actually render the shared nav —
       pay.html / delivery.html use their own minimal checkout header. */
    body:has(.bb-topbar-desktop) { padding-top: var(--bb-nav-top); }

    .bb-topbar-desktop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 40;
        display: flex;
        align-items: center;
        padding: 14px 24px;
        height: var(--bb-nav-top);
        background: rgba(255, 255, 255, .82);
        backdrop-filter: saturate(140%) blur(12px);
        -webkit-backdrop-filter: saturate(140%) blur(12px);
        border-bottom: 1px solid var(--bb-border);
    }
    .bb-topbar-desktop .bb-logo { font-size: 22px; }
}

.bb-topbar-desktop-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
}
.bb-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: auto;
}
.bb-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--bb-text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color .2s ease, background .2s ease;
    position: relative;
}
.bb-nav-link:hover { color: var(--bb-text); background: var(--bb-surface-2); }
.bb-nav-link[aria-current="page"] {
    color: var(--bb-primary);
    background: var(--bb-primary-soft);
}
.bb-nav-link .bb-nav-icon { width: 18px; height: 18px; }

.bb-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* ------- Mobile bottom nav ------------------------------------------------- */
.bb-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-top: 1px solid var(--bb-border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--bb-nav-bottom) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 768px) { .bb-bottomnav { display: none; } }

.bb-bottomnav-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    color: var(--bb-text-faint);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    position: relative;
    background: transparent;
    border: none;
    transition: color .18s ease;
}
.bb-bottomnav-item .bb-nav-icon {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    transition: stroke-width .18s ease, transform .18s ease;
}
.bb-bottomnav-item[aria-current="page"] {
    color: var(--bb-primary);
}
.bb-bottomnav-item[aria-current="page"] .bb-nav-icon {
    stroke-width: 2.4;
    transform: translateY(-1px);
}
/* Active pill indicator above icon */
.bb-bottomnav-item[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--bb-primary);
}
/* Unread badge */
.bb-bottomnav-item .bb-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--bb-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff;
}
