/* DEALIX Native Navigation V7 — theme-bound translucent mobile material. Scope: the existing shell and Menu search button.
   No page scroll geometry is changed while the tab bar slides. Legacy chat,
   forum, modal and auth display:none rules continue to take priority. */
.desktop-search-slot[hidden], .dashboard-native-search { display: none !important; }
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    #desktop-shell-nav.native-search-docked {
        display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content;
        gap: 12px; align-items: center;
    }
    #desktop-shell-nav.native-search-docked .desktop-shell-menu { justify-self: start; }
    #desktop-shell-nav.native-search-docked .desktop-shell-links,
    #desktop-shell-nav.native-search-docked #desktop-header-toggle,
    #desktop-search-slot .header-search-icon,
    #desktop-search-slot #header-dismiss-btn { display: none !important; }
    #desktop-search-slot:not([hidden]) { display: block; min-width: 0; width: 100%; max-width: none; }
    #desktop-search-slot .header-search,
    #desktop-search-slot .search-container { width: 100% !important; max-width: none !important; min-width: 0 !important; box-sizing: border-box; }
    #desktop-shell-nav.native-search-docked #desktop-header-actions { justify-self: end; justify-content: flex-end; }
    #desktop-search-slot #header-search-input {
        height: 40px !important; min-height: 40px !important;
        width: 100% !important; max-width: none !important; box-sizing: border-box;
        padding-inline: 16px !important; border-radius: 14px !important;
    }
    #desktop-search-slot .search-results-dropdown {
        position: absolute !important; inset-inline: 0 !important;
        top: calc(100% + 8px) !important; bottom: auto !important;
        width: 100% !important; max-width: none !important;
        max-height: min(68vh, 620px, calc(100dvh - var(--app-menu-bar-h, 56px) - 16px)) !important;
        padding: 8px !important; border-radius: 18px !important; border: 1px solid var(--border) !important;
        background: var(--bg-modal, var(--bg-secondary)) !important;
        color: var(--text) !important; box-shadow: 0 16px 48px rgba(0,0,0,.22) !important;
        overflow-y: auto !important; overscroll-behavior: contain; z-index: 1500 !important;
    }
    #desktop-search-slot .search-results-dropdown.hidden { display: none !important; }
}
@media (min-width: 769px) and (max-width: 1000px) and (hover: hover) and (pointer: fine) {
    #desktop-shell-nav.native-search-docked { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
}
/* The selected application theme owns the surface hue. The bar adds only
   a translucent material and a single backdrop blur, not a replacement palette.
   Custom accent remains scoped to active navigation ink and its subtle tint. */
#app > #mobile-bottom-nav, .dxs .dx-nav-preview {
    --dx-nav-solid: var(--bg-secondary);
    --dx-nav-material: color-mix(in srgb, var(--bg-secondary) 68%, transparent);
    --dx-nav-selection: color-mix(in srgb, var(--bg) 40%, transparent);
    --dx-nav-rim: var(--border);
    --dx-nav-shadow: 0 5px 18px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.035);
    --dx-nav-idle-ink: color-mix(in srgb, var(--text) 90%, var(--text-secondary));
    --dx-nav-badge-edge: var(--dx-nav-solid);
}
body.theme-glass :is(#app > #mobile-bottom-nav, .dxs .dx-nav-preview) {
    /* Only the accessibility fallback needs an opaque Glass surface. */
    --dx-nav-solid: #111726;
}
body.theme-light :is(#app > #mobile-bottom-nav, .dxs .dx-nav-preview),
html[data-theme="light"] :is(#app > #mobile-bottom-nav, .dxs .dx-nav-preview) {
    --dx-nav-material: color-mix(in srgb, var(--bg-secondary) 74%, transparent);
    --dx-nav-selection: color-mix(in srgb, var(--text) 7%, transparent);
    --dx-nav-shadow: 0 4px 16px rgba(18,24,35,.09), inset 0 1px 0 rgba(255,255,255,.55);
}
/* Older browsers without color-mix or backdrop support retain readable theme
   surfaces. Do not simulate glass by lowering opacity on the whole tab bar. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    #app > #mobile-bottom-nav, .dxs .dx-nav-preview {
        --dx-nav-material: var(--dx-nav-solid);
        --dx-nav-selection: var(--bg-hover);
        --dx-nav-idle-ink: var(--text);
    }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #app > #mobile-bottom-nav, .dxs .dx-nav-preview {
        --dx-nav-material: var(--dx-nav-solid);
    }
}
/* The existing settings preview uses the very same material and ink. */
.dxs .dx-nav-preview {
    --dx-nav-preview-bg: var(--dx-nav-badge-edge);
    background: var(--dx-nav-material); border-color: var(--dx-nav-rim);
    box-shadow: var(--dx-nav-shadow); color: var(--dx-nav-idle-ink);
    padding: 4px; gap: 1px;
    font-family: -apple-system, BlinkMacSystemFont, var(--font-sans), sans-serif;
}
.dxs .dx-nav-preview-item { height: 53px; gap: 4px; }
.dxs .dx-nav-preview-item small { font-weight: 540; line-height: 1.18; letter-spacing: 0; }
.dxs .dx-nav-preview-item.is-active {
    background: var(--dx-nav-selection);
    color: var(--dealix-nav-active-ink, var(--primary-text, var(--primary)));
}
body.theme-light .dxs .dx-nav-preview { --dx-nav-preview-bg: var(--dx-nav-badge-edge); color: var(--dx-nav-idle-ink); }
html[data-dealix-nav-custom-accent] .dxs .dx-nav-preview-item.is-active {
    background: color-mix(in srgb, var(--dealix-nav-active-ink) 4%, var(--dx-nav-selection));
}
html[data-dealix-nav-custom-accent] body.theme-light .dxs .dx-nav-preview-item.is-active,
html[data-dealix-nav-custom-accent][data-theme="light"] .dxs .dx-nav-preview-item.is-active {
    background: color-mix(in srgb, var(--dealix-nav-active-ink) 5%, var(--dx-nav-selection));
}

@media (max-width: 768px) {
    :root { --mobile-bottom-nav-h: 63px; }
    #app > #mobile-bottom-nav {
        --mobile-bottom-nav-padding: 4px;
        --mobile-bottom-nav-gap: 1px;
        --mobile-bottom-selection-radius: 999px;
        --native-nav-fill: var(--dx-nav-material);
        --native-nav-selected: var(--dx-nav-selection);
        position: fixed; left: max(12px, env(safe-area-inset-left, 0px)) !important;
        right: max(12px, env(safe-area-inset-right, 0px)) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
        height: var(--mobile-bottom-nav-h) !important; min-height: var(--mobile-bottom-nav-h) !important;
        max-height: var(--mobile-bottom-nav-h) !important;
        padding: var(--mobile-bottom-nav-padding) !important; gap: var(--mobile-bottom-nav-gap) !important;
        border-radius: 999px !important; border: 1px solid var(--dx-nav-rim) !important;
        background: var(--native-nav-fill) !important; box-shadow: var(--dx-nav-shadow) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.10); backdrop-filter: blur(16px) saturate(1.10);
        overflow: visible !important;
        transform: translate3d(0,0,0) !important; opacity: 1;
        transition: transform 170ms cubic-bezier(.18,.85,.3,1), opacity 110ms ease-out, visibility 0s linear 0s !important;
    }
    #app > #mobile-bottom-nav::before {
        border: 0 !important; border-radius: 999px !important;
        inset-block: calc(var(--mobile-bottom-nav-padding) + 1px);
        background: var(--native-nav-selected) !important; box-shadow: none !important;
        transition: transform 180ms cubic-bezier(.18,.85,.3,1), opacity 105ms ease-out !important;
    }
    #mobile-bottom-nav > .mobile-bottom-item {
        min-height: 0 !important; height: 100% !important; border: 0 !important;
        border-radius: 999px !important; padding: 3px 1px !important; gap: 4px !important;
        background: transparent !important; box-shadow: none !important;
        color: var(--dx-nav-idle-ink) !important;
        font-family: -apple-system, BlinkMacSystemFont, var(--font-sans), sans-serif !important;
        text-shadow: none !important;
        transition: transform 78ms ease-out, color 90ms ease-out !important;
    }
    #mobile-bottom-nav > .mobile-bottom-item:active { transform: scale(.965); }
    #app > #mobile-bottom-nav .mobile-bottom-item .mobile-bottom-icon {
        /* A selected tab retains the same icon geometry and ink source as its label.
           Discrete V5 icon effects animate the inner vector, not this wrapper. */
        color: inherit !important; transform: none;
    }
    #mobile-bottom-nav .mobile-bottom-icon { transition: transform 120ms cubic-bezier(.18,.85,.3,1) !important; }
    #app > #mobile-bottom-nav > .mobile-bottom-item.active,
    #app > #mobile-bottom-nav > .mobile-bottom-item[aria-current="page"] { color: var(--dealix-nav-active-ink, var(--primary-text, var(--primary))) !important; }
    #mobile-bottom-nav .mobile-bottom-icon, #mobile-bottom-nav .mobile-bottom-icon > svg {
        width: 26px !important; min-width: 26px !important; height: 26px !important; min-height: 26px !important;
    }
    #mobile-bottom-nav .mobile-bottom-label {
        color: inherit !important; font-family: inherit !important; font-weight: 540 !important;
        font-size: 11px !important; line-height: 1.18 !important; letter-spacing: 0 !important;
    }
    #mobile-bottom-nav .mobile-bottom-badge {
        top: -4px !important; left: auto !important; right: auto !important;
        inset-inline-start: calc(100% - 6px) !important; inset-inline-end: auto !important;
        min-width: 17px !important; height: 17px !important;
        padding: 0 4px !important; font-weight: 650 !important; font-size: 10px !important;
        background: #ef4149; box-shadow: 0 0 0 1.5px var(--dx-nav-badge-edge);
        font-variant-numeric: tabular-nums;
    }
    #mobile-bottom-nav .mobile-bottom-item.active .mobile-profile-avatar { outline: none; box-shadow: 0 0 0 1px currentColor; }
    #app:is(.native-bottom-scroll-hidden,.native-bottom-keyboard) > #mobile-bottom-nav {
        transform: translate3d(0,calc(100% + env(safe-area-inset-bottom,0px) + 12px),0) !important;
        opacity: 0; visibility: hidden; pointer-events: none !important;
        transition: transform 145ms cubic-bezier(.4,0,.65,1), opacity 105ms ease-in, visibility 0s linear 145ms !important;
    }
    #app:is(.native-bottom-scroll-hidden,.native-bottom-keyboard) > #mobile-bottom-nav * { pointer-events: none !important; }
    /* The page's left utility mirrors the existing statistics button, without
       reparenting an element that would be destroyed on route changes. */
    #app .dashboard-home-header > .dashboard-native-search {
        display: inline-grid !important; place-items: center;
        position: absolute; inset-block-start: 0; inset-inline-start: 0;
        width: 44px; height: 44px; padding: 0; border-radius: 50%;
        border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
        cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    #app .dashboard-native-search:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
    #app .dashboard-native-search:active { background: var(--bg-hover); transform: scale(.95); }
    /* The original mobile header stays intact; only its compositor transition
       is shortened. The search input still receives focus synchronously in the
       user's click (important for the iOS on-screen keyboard). */
    #app.header-compact-mode > #global-header {
        transition: transform 135ms cubic-bezier(.2,.82,.25,1), opacity 90ms ease-out !important;
    }
    #app .dashboard-native-search { touch-action: manipulation; }
    #mobile-bottom-nav > .mobile-bottom-item { touch-action: manipulation; }
    /* Before the first authenticated route commits, don't flash the search bar. */
    #app:not(.header-revealed) > #global-header { visibility: hidden; pointer-events: none; }
}
@media (max-width: 360px) {
    :root { --mobile-bottom-nav-h: 60px; }
    #app > #mobile-bottom-nav { left: max(8px,env(safe-area-inset-left,0px)) !important; right: max(8px,env(safe-area-inset-right,0px)) !important; }
    #mobile-bottom-nav .mobile-bottom-icon, #mobile-bottom-nav .mobile-bottom-icon > svg { width: 24px !important; height: 24px !important; min-width: 24px !important; min-height: 24px !important; }
    #mobile-bottom-nav .mobile-bottom-label { font-size: 10.5px !important; }
}
@media (prefers-reduced-motion: reduce) {
    #app.header-compact-mode > #global-header,
    #app > #mobile-bottom-nav, #app > #mobile-bottom-nav::before, #app > #mobile-bottom-nav .mobile-bottom-item, #app > #mobile-bottom-nav .mobile-bottom-icon,
    #app:is(.native-bottom-scroll-hidden,.native-bottom-keyboard) > #mobile-bottom-nav { transition: none !important; }
}

/* Respect platform accessibility preferences without animating any filter. */
@media (prefers-reduced-transparency: reduce) {
    #app > #mobile-bottom-nav, .dxs .dx-nav-preview {
        --dx-nav-material: var(--dx-nav-solid);
    }
    #app > #mobile-bottom-nav {
        -webkit-backdrop-filter: none; backdrop-filter: none;
    }
}

/* Discrete icon motion: only the vector artwork (or the profile avatar) moves.
   The tab, label, hit target and counter keep their V3 geometry. No filter,
   layout or permanent will-change animation is added. */
@media (max-width: 768px) {
    #mobile-bottom-nav .mobile-bottom-icon > svg,
    #mobile-bottom-nav .mobile-bottom-icon > svg > :is(rect, path) {
        transform-box: fill-box;
        transform-origin: center;
    }
    #mobile-bottom-nav .mobile-profile-avatar { transform-origin: center; }
}

/* Local account preference: color is a validated CSSOM value, never a URL.
   The selected tint is subtle; all SVGs inherit the crisp text color. */
html[data-dealix-nav-custom-accent] { --dealix-nav-active-ink: var(--dealix-nav-accent-dark); }
html[data-dealix-nav-custom-accent][data-theme="light"], html[data-dealix-nav-custom-accent]:has(body.theme-light) {
    --dealix-nav-active-ink: var(--dealix-nav-accent-light);
}
@media (max-width: 768px) {
    html[data-dealix-nav-custom-accent] #app > #mobile-bottom-nav {
        --native-nav-selected: color-mix(in srgb, var(--dealix-nav-active-ink) 4%, var(--dx-nav-selection));
    }
    html[data-dealix-nav-custom-accent] body.theme-light #app > #mobile-bottom-nav,
    html[data-dealix-nav-custom-accent][data-theme="light"] #app > #mobile-bottom-nav {
        --native-nav-selected: color-mix(in srgb, var(--dealix-nav-active-ink) 5%, var(--dx-nav-selection));
    }
    html[data-dealix-nav-custom-accent] #mobile-bottom-nav > .mobile-bottom-item:focus-visible { outline-color: var(--dealix-nav-active-ink); }
    html[data-dealix-nav-custom-accent] #mobile-bottom-nav > .mobile-bottom-item.active .mobile-profile-avatar { outline: none; box-shadow: 0 0 0 1px var(--dealix-nav-active-ink); }
    html[data-dealix-nav-icon-motion="off"] #app > #mobile-bottom-nav .mobile-bottom-icon { transition: none !important; }
    html[data-dealix-nav-panel-motion="off"] #app > #mobile-bottom-nav,
    html[data-dealix-nav-panel-motion="off"] #app > #mobile-bottom-nav::before,
    html[data-dealix-nav-panel-motion="off"] #app > #mobile-bottom-nav .mobile-bottom-item,
    html[data-dealix-nav-panel-motion="off"] #app > #mobile-bottom-nav .mobile-bottom-icon,
    html[data-dealix-nav-panel-motion="off"] #app:is(.native-bottom-scroll-hidden,.native-bottom-keyboard) > #mobile-bottom-nav { transition: none !important; }
    html[data-dealix-nav-panel-motion="off"] #mobile-bottom-nav > .mobile-bottom-item:active { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    #mobile-bottom-nav > .mobile-bottom-item:active { transform: none; }
}
