/* ═══════════════════════════════════════════════════════════════
   MOBILE NAVIGATION — Bottom tab bar
   Only active on mobile (< 768px). Desktop untouched.
   ═══════════════════════════════════════════════════════════════ */

/* ── Nav Bar ──────────────────────────────────────────────────── */

.cm-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: var(--ui-panel, #1e1e2e);
    border-top: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    z-index: 8000;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Bottom nav permanently hidden on Chart page */
@media (max-width: 767px) {
    .cm-nav {
        display: none !important;
    }
}

/* ── Tab Button ───────────────────────────────────────────────── */

.cm-nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    background: transparent;
    border: none;
    border-top: 2px solid transparent;
    color: var(--ui-muted, rgba(255, 255, 255, 0.45));
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    padding: 0;
    position: relative;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.cm-nav-tab:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ui-fg, #e0e0e0);
}

.cm-nav-tab:active {
    background: rgba(255, 255, 255, 0.06);
}

/* ── Active Tab ───────────────────────────────────────────────── */

.cm-nav-tab--active {
    border-top-color: #26a69a;
    color: #26a69a;
    background: rgba(38, 166, 154, 0.06);
}

/* ── Icon ─────────────────────────────────────────────────────── */

.cm-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.cm-nav-icon svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* ── Label ────────────────────────────────────────────────────── */

.cm-nav-label {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

/* ── Touch optimization ───────────────────────────────────────── */

@media (hover: none) and (pointer: coarse) {
    .cm-nav-tab {
        min-height: 48px;
    }
}

/* ── Reduced motion ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .cm-nav-tab {
        transition: none;
    }
}

/* ── Dark mode: adjust border ─────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    .cm-nav {
        border-top-color: rgba(255, 255, 255, 0.06);
    }
}

@media (prefers-color-scheme: light) {
    .cm-nav {
        background: rgba(255, 255, 255, 0.96);
        border-top-color: rgba(0, 0, 0, 0.08);
        color: #6b7280;
    }
    .cm-nav-tab {
        color: #6b7280;
    }
    .cm-nav-tab:hover {
        color: #374151;
        background: rgba(0, 0, 0, 0.04);
    }
    .cm-nav-tab--active {
        color: #26a69a;
        background: rgba(38, 166, 154, 0.06);
    }
}

/* ── Landscape (short viewport) ───────────────────────────────── */

@media (max-height: 500px) and (max-width: 767px) {
    .cm-nav {
        height: 44px;
    }
    .cm-nav-label {
        display: none;
    }
    .cm-nav-icon svg {
        width: 20px;
        height: 20px;
    }
}
