/* ─────────────────────────────────────────────────────────────────
   KarmaFlex Bottom Nav  v1.0.0
   Mobile-only app-style bottom bar. Hidden entirely on desktop.
   ───────────────────────────────────────────────────────────────── */

:root {
    --kfbn-accent: #6c47ff;
    --kfbn-accent-hover: #5535e0;

    --kfbn-bg: #14141cf2;
    --kfbn-border: rgba(255,255,255,.1);
    --kfbn-text: #f4f4fa;
    --kfbn-text-dim: #8d8d9c;
}

@media (prefers-color-scheme: light) {
    :root:not([data-kfbn-mode]) {
        --kfbn-bg: #fffffff2;
        --kfbn-border: rgba(0,0,0,.08);
        --kfbn-text: #1a1a22;
        --kfbn-text-dim: #8a8a96;
    }
}

:root[data-kfbn-mode="light"] {
    --kfbn-bg: #fffffff2;
    --kfbn-border: rgba(0,0,0,.08);
    --kfbn-text: #1a1a22;
    --kfbn-text-dim: #8a8a96;
}
:root[data-kfbn-mode="dark"] {
    --kfbn-bg: #14141cf2;
    --kfbn-border: rgba(255,255,255,.1);
    --kfbn-text: #f4f4fa;
    --kfbn-text-dim: #8d8d9c;
}

/* ── Bar shell ───────────────────────────────────────────────────── */

.kfbn-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999990;
    display: none;

    background: var(--kfbn-bg);
    border-top: 1px solid var(--kfbn-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    padding: 6px 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));

    box-shadow: 0 -2px 16px rgba(0,0,0,.08);
}

@media (max-width: 768px) {
    .kfbn-bar {
        display: flex;
        align-items: stretch;
        justify-content: space-between;
    }

    body {
        padding-bottom: 64px;
    }
}

/* ── Nav items ───────────────────────────────────────────────────── */

.kfbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    text-decoration: none !important;
    color: var(--kfbn-text-dim);
    border-radius: 12px;
    transition: color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}

.kfbn-item:active {
    background: color-mix(in srgb, var(--kfbn-accent) 10%, transparent);
}

.kfbn-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    line-height: 0;
}
.kfbn-icon svg {
    width: 100%;
    height: 100%;
}

.kfbn-label {
    font-size: 10.5px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: .01em;
    white-space: nowrap;
}

/* ── Active state ────────────────────────────────────────────────── */

.kfbn-item-active {
    color: var(--kfbn-accent);
}
.kfbn-item-active .kfbn-icon svg {
    stroke-width: 2.3;
}

/* ── Fallback for browsers without color-mix() ──────────────────── */

@supports not (background: color-mix(in srgb, red 10%, transparent)) {
    .kfbn-item:active {
        background: rgba(108, 71, 255, .12);
    }
}

/* ── Trending virtual page (basic, theme-agnostic styling) ────────── */

.kfbn-trending-page {
    max-width: 720px;
    margin: 40px auto;
    padding: 0 20px;
}
.kfbn-trending-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 24px;
}
.kfbn-trending-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.kfbn-trending-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.kfbn-trending-rank {
    font-size: 14px;
    font-weight: 700;
    color: #9a9aa8;
    width: 24px;
    flex-shrink: 0;
    text-align: center;
}
.kfbn-trending-link {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}
.kfbn-trending-link:hover { text-decoration: underline; }
.kfbn-trending-views {
    font-size: 13px;
    color: #9a9aa8;
    flex-shrink: 0;
}
.kfbn-trending-empty {
    color: #9a9aa8;
    padding: 20px 0;
}
