/* ============================================================
   BOTTOM NAV — redesign (shadcn/ui zinc port, mirrors home.css)
   Rendered by module/sw-footer.php (logged-in users only).
   ============================================================ */

.bnav {
    --bn-bg: 240 10% 3.9%;
    --bn-fg: 0 0% 98%;
    --bn-muted: 240 3.7% 15.9%;
    --bn-muted-fg: 240 5% 64.9%;
    --bn-border: 240 3.7% 15.9%;
    --bn-primary: 0 0% 98%;
    --bn-primary-fg: 240 5.9% 10%;
    --bn-success: 142 71% 45%;
    --bn-ring: 240 4.9% 83.9%;
    --bn-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    position: fixed;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 460px;
    z-index: 9998;
    font-family: var(--bn-font);
    box-sizing: border-box;
}

.bnav *,
.bnav *::before,
.bnav *::after { box-sizing: border-box; }

body.light-mode .bnav {
    --bn-bg: 0 0% 100%;
    --bn-fg: 240 10% 3.9%;
    --bn-muted: 240 4.8% 95.9%;
    --bn-muted-fg: 240 3.8% 46.1%;
    --bn-border: 240 5.9% 90%;
    --bn-primary: 240 5.9% 10%;
    --bn-primary-fg: 0 0% 98%;
    --bn-success: 142 76% 30%;
    --bn-ring: 240 10% 3.9%;
}

.bnav__bar {
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 6px;
    border-radius: 20px;
    background: hsl(var(--bn-bg) / .82);
    border: 1px solid hsl(var(--bn-border));
    box-shadow:
        inset 0 1px 0 hsl(0 0% 100% / .04),
        0 12px 32px -12px rgba(0, 0, 0, .6),
        0 2px 8px rgba(0, 0, 0, .16);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
}

body.light-mode .bnav__bar {
    background: hsl(var(--bn-bg) / .92);
    box-shadow:
        0 12px 32px -16px rgba(15, 23, 42, .25),
        0 1px 3px rgba(15, 23, 42, .06);
}

/* ---------- regular items ---------- */

.bnav .bnav__item {
    flex: 1 1 0;
    min-width: 0;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 14px;
    background: transparent;
    color: hsl(var(--bn-muted-fg)) !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .18s ease, color .18s ease;
}

.bnav .bnav__item .material-icons {
    font-size: 22px;
    line-height: 1;
    color: inherit !important;
    transition: transform .18s ease;
}

.bnav .bnav__item .bnav__label {
    color: inherit !important;
    font-size: .6875rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .01em;
    white-space: nowrap;
}

.bnav .bnav__item.is-active {
    background: hsl(var(--bn-muted));
    color: hsl(var(--bn-fg)) !important;
    box-shadow: inset 0 0 0 1px hsl(var(--bn-border));
}

.bnav .bnav__item.is-active .bnav__label { font-weight: 600; }

@media (hover: hover) {
    .bnav .bnav__item:not(.is-active):hover {
        background: hsl(var(--bn-muted) / .55);
        color: hsl(var(--bn-fg)) !important;
    }
}

.bnav .bnav__item:active .material-icons { transform: scale(.9); }

/* ---------- center action ---------- */

.bnav .bnav__cta {
    flex: 0 0 68px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 14px;
    background: hsl(var(--bn-primary));
    color: hsl(var(--bn-primary-fg)) !important;
    text-decoration: none !important;
    box-shadow:
        inset 0 1px 0 hsl(0 0% 100% / .14),
        0 1px 2px rgba(0, 0, 0, .2);
    -webkit-tap-highlight-color: transparent;
    transition: transform .18s ease, box-shadow .18s ease;
}

.bnav .bnav__cta .material-icons {
    font-size: 22px;
    line-height: 1;
    color: inherit !important;
}

.bnav .bnav__cta .bnav__label {
    color: inherit !important;
    font-size: .6875rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .01em;
    white-space: nowrap;
}

@media (hover: hover) {
    .bnav .bnav__cta:hover {
        transform: translateY(-1px);
        box-shadow:
            inset 0 1px 0 hsl(0 0% 100% / .14),
            0 6px 16px -6px rgba(0, 0, 0, .45);
    }
}

.bnav .bnav__cta:active { transform: scale(.97); }

.bnav .bnav__cta.is-done {
    background: hsl(var(--bn-success) / .14);
    color: hsl(var(--bn-success)) !important;
    box-shadow: inset 0 0 0 1px hsl(var(--bn-success) / .35);
    cursor: default;
}

/* ---------- focus ---------- */

.bnav .bnav__item:focus-visible,
.bnav .bnav__cta:focus-visible {
    outline: 2px solid hsl(var(--bn-ring) / .8);
    outline-offset: 2px;
}

/* ---------- responsive ---------- */

@media (min-width: 992px) {
    .bnav {
        max-width: 480px;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }
    .bnav__bar { padding: 7px; border-radius: 22px; }
    .bnav .bnav__item,
    .bnav .bnav__cta { min-height: 52px; }
    .bnav .bnav__cta { flex-basis: 72px; }
    .bnav .bnav__item .bnav__label,
    .bnav .bnav__cta .bnav__label { font-size: .71875rem; }
}

@media (max-width: 767px) {
    .bnav {
        width: calc(100% - 16px);
        max-width: 420px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    .bnav .bnav__item,
    .bnav .bnav__cta { min-height: 48px; }
    .bnav .bnav__cta { flex-basis: 64px; }
    .bnav .bnav__item .material-icons,
    .bnav .bnav__cta .material-icons { font-size: 21px; }
    .bnav .bnav__item .bnav__label,
    .bnav .bnav__cta .bnav__label { font-size: .625rem; }
}

@media (max-width: 380px) {
    .bnav { width: calc(100% - 12px); }
    .bnav__bar { padding: 5px; border-radius: 18px; }
    .bnav .bnav__item,
    .bnav .bnav__cta { min-height: 46px; padding: 5px 2px; }
    .bnav .bnav__cta { flex-basis: 58px; }
    .bnav .bnav__item .bnav__label,
    .bnav .bnav__cta .bnav__label { font-size: .5625rem; }
}

/* keep page content clear of the fixed bar */
body:has(.bnav) { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }

@media (min-width: 992px) {
    body:has(.bnav) { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
    body:has(.bnav) { padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px)) !important; }
}

@media (max-width: 767px) {
    body:has(.bnav) { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }
}

@media (max-width: 380px) {
    body:has(.bnav) { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important; }
}

@media (prefers-reduced-motion: reduce) {
    .bnav * { transition: none !important; }
}
