/**
 * bottom-nav.css — single source of truth for the mobile bottom navigation.
 *
 * Loaded on every page that renders BottomNav (discover, category pages,
 * livefeed, portfolio, orders, watchlist, account). Consolidates what used to
 * be split between mobile.css (base bar) and discover-mobile.css (icons + bonds
 * popup), and adds the "you" account hub.
 *
 * Layout: discover · bonds▾ · livefeed · portfolio · you▾
 *   - bonds▾ opens a category sheet (government / corporate / gold / tax-free)
 *   - you▾   opens an account sheet (orders / watchlist / account)
 */

@media (max-width: 768px) {

    /* ── Bar ── */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px) saturate(1.4);
        -webkit-backdrop-filter: blur(20px) saturate(1.4);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10000;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* ── Items ── */
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        flex: 1;
        min-width: 0;
        padding: 6px 2px;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.35);
        font-size: 0.66rem;
        font-weight: 500;
        transition: color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    .bottom-nav-item.active {
        color: #fff;
    }

    .bottom-nav-item:hover {
        color: rgba(255, 255, 255, 0.7);
    }

    .bottom-nav-item.disabled {
        color: rgba(255, 255, 255, 0.2);
        pointer-events: none;
        cursor: default;
    }

    .bottom-nav-item .bottom-nav-icon {
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .bottom-nav-item .bottom-nav-icon svg {
        width: 18px;
        height: 18px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .bottom-nav-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-transform: lowercase;
        letter-spacing: 0.02em;
    }

    /* Chevron affordance on hub tabs (bonds / you) — a thin stroked line, not a filled wedge */
    .bottom-nav-item .bottom-nav-caret {
        display: inline-block;
        width: 8px;
        height: 5px;
        margin-left: 4px;
        vertical-align: middle;
        position: relative;
        top: -1px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        opacity: 0.5;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .bottom-nav-item.hub-open .bottom-nav-caret {
        opacity: 0.9;
        transform: rotate(180deg);
    }

    .bottom-nav-separator {
        display: none;
    }

    /* ── Popups (bonds category sheet + you account sheet) ── */
    .bonds-popup-overlay,
    .you-popup-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 10001;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .bonds-popup-overlay.visible,
    .you-popup-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .bonds-popup,
    .you-popup {
        position: fixed;
        bottom: 56px;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        z-index: 10002;
        background: rgba(20, 20, 20, 0.98);
        backdrop-filter: blur(24px) saturate(1.4);
        -webkit-backdrop-filter: blur(24px) saturate(1.4);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        padding: 16px;
        transform: translateY(20px);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    }

    .bonds-popup-overlay.visible .bonds-popup,
    .you-popup-overlay.visible .you-popup {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .bonds-popup-title,
    .you-popup-title {
        font-size: 0.65rem;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.35);
        text-transform: lowercase;
        letter-spacing: 0.04em;
        margin-bottom: 12px;
        padding-left: 4px;
    }

    .bonds-popup-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* You hub is a short menu — single column reads cleaner than a 2+1 grid */
    .you-popup-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bonds-popup-item,
    .you-popup-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.06);
        text-decoration: none;
        transition: background 0.2s ease, border-color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .bonds-popup-item:active,
    .you-popup-item:active {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.12);
    }

    .you-popup-item.active {
        background: rgba(255, 255, 255, 0.09);
        border-color: rgba(255, 255, 255, 0.16);
    }

    .bonds-popup-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .you-popup-icon {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(255, 255, 255, 0.6);
    }

    .you-popup-item.active .you-popup-icon {
        color: #fff;
    }

    .you-popup-icon svg {
        width: 17px;
        height: 17px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .bonds-popup-label,
    .you-popup-label {
        font-size: 0.82rem;
        font-weight: 500;
        color: var(--cb-text-secondary, rgba(255, 255, 255, 0.85));
        text-transform: lowercase;
    }
}

/* Hide the bar + popups on desktop — the top navbar takes over */
@media (min-width: 769px) {
    .bottom-nav,
    .bonds-popup-overlay,
    .you-popup-overlay {
        display: none !important;
    }
}
