/**
 * Bottom Navigation v2 — floating capsule (global)
 * Requires class: bottom-nav bottom-nav-v2
 */

.bottom-nav.bottom-nav-v2 {
    --bottom-nav-active: #22FF88;
    --bottom-nav-surface-fallback: rgba(58, 58, 60, 0.94);
    --bottom-nav-surface: rgba(72, 72, 74, 0.82);
    --bottom-nav-border: rgba(255, 255, 255, 0.16);
    --bottom-nav-inactive: rgba(255, 255, 255, 0.62);

    position: fixed;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    right: auto;
    width: 92%;
    max-width: none;
    height: 64px !important;
    padding: 0 8px;
    padding-bottom: 0;
    border-radius: 999px;
    border: 1px solid var(--bottom-nav-border);
    background: var(--bottom-nav-surface-fallback);
    background: var(--bottom-nav-surface);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: visible;
    z-index: 1000;
    transform: translateX(-50%) translateZ(0);
    -webkit-transform: translateX(-50%) translateZ(0);
    will-change: width, height, transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: width 250ms ease, height 250ms ease, transform 250ms ease;
}

.bottom-nav.bottom-nav-v2.bottom-nav--compact {
    width: 82%;
    height: 56px !important;
    transform: translateX(-50%) scale(0.92) translateZ(0);
    -webkit-transform: translateX(-50%) scale(0.92) translateZ(0);
}

.bottom-nav.bottom-nav-v2 .nav-item {
    position: relative;
    color: var(--bottom-nav-inactive);
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
    height: 100%;
    padding: 4px 2px;
    gap: 2px;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

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

.bottom-nav.bottom-nav-v2 .nav-item.active,
.bottom-nav.bottom-nav-v2 .nav-item.active .nav-icon {
    color: var(--bottom-nav-active);
}

.bottom-nav.bottom-nav-v2 .nav-item:active {
    transform: scale(0.95);
    transition: transform 200ms ease;
}

.bottom-nav.bottom-nav-v2 .nav-icon {
    font-size: 18px !important;
    margin-bottom: 1px !important;
    height: auto !important;
    flex-shrink: 0;
}

.bottom-nav.bottom-nav-v2 .nav-label {
    color: inherit;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: nowrap;
    width: auto !important;
    max-width: 100%;
    font-size: clamp(8px, 2.35vw, 10px) !important;
    line-height: 1.15;
    letter-spacing: -0.15px;
    padding: 0 !important;
}

.bottom-nav.bottom-nav-v2.bottom-nav--compact .nav-label {
    font-size: clamp(7px, 2.1vw, 9px) !important;
    letter-spacing: -0.25px;
}

/* Help page: 5 tab */
.bottom-nav.bottom-nav-v2.bottom-nav-v2--five .nav-label {
    font-size: clamp(7px, 1.9vw, 9px) !important;
    letter-spacing: -0.3px;
}

/* Clearance for floating nav */
body:has(.bottom-nav.bottom-nav-v2) {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* Fire TV / Smart TV: larger targets, no compact shrink */
body.firetv .bottom-nav.bottom-nav-v2,
body.smart-tv-detected .bottom-nav.bottom-nav-v2 {
    height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    width: 92%;
    transform: translateX(-50%) translateZ(0);
    -webkit-transform: translateX(-50%) translateZ(0);
}

body.firetv .bottom-nav.bottom-nav-v2.bottom-nav--compact,
body.smart-tv-detected .bottom-nav.bottom-nav-v2.bottom-nav--compact {
    width: 92%;
    height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    transform: translateX(-50%) translateZ(0);
    -webkit-transform: translateX(-50%) translateZ(0);
}

@media (min-width: 960px) {
    body.firetv .bottom-nav.bottom-nav-v2,
    body.smart-tv-detected .bottom-nav.bottom-nav-v2 {
        height: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
        padding: 10px 8px;
    }
}

/* Reduced motion: static sizing */
@media (prefers-reduced-motion: reduce) {
    .bottom-nav.bottom-nav-v2 {
        transition: none;
    }

    .bottom-nav.bottom-nav-v2.bottom-nav--compact {
        width: 92%;
        height: 64px !important;
        transform: translateX(-50%) translateZ(0);
        -webkit-transform: translateX(-50%) translateZ(0);
    }
}
