/* === Bottom navigation (tablet + mobile only) === */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    align-items: stretch;
    gap: 6px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    /* Background uses near-opaque alpha (0.97/0.99) so we don't need a
       backdrop-filter blur — that was forcing a full repaint of the area
       behind the nav on every scroll frame, which felt very laggy. */
    background: linear-gradient(180deg, rgba(14, 22, 34, 0.97) 0%, rgba(8, 14, 22, 0.99) 100%);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
}

.bottom-nav-scroll {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.bottom-nav-scroll::-webkit-scrollbar { display: none; }

.bottom-nav-item {
    /* grow=1, shrink=1, basis=0 → all cards share the available width evenly.
       min-width acts as a floor; once total min-widths exceed the container
       the .bottom-nav-scroll parent simply scrolls horizontally. */
    flex: 1 1 0;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(191, 212, 255, 0.04);
    color: var(--text);
    text-decoration: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    scroll-snap-align: start;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    background: rgba(191, 212, 255, 0.12);
    border-color: var(--primary);
    color: var(--primary);
}

.bottom-nav-icon {
    position: relative;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(191, 212, 255, 0.06);
    color: var(--primary);
    font-size: 16px;
}

.bottom-nav-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    image-rendering: pixelated;
}

.bottom-nav-label {
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

.bottom-nav-basket {
    flex: 0 0 auto;
    min-width: 88px;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    color: #0c1626;
    border: none;
    box-shadow: 0 6px 16px rgba(191, 212, 255, 0.25);
}

.bottom-nav-basket:hover {
    background: linear-gradient(135deg, var(--primary-soft), var(--primary));
    color: #0c1626;
}

.bottom-nav-basket .bottom-nav-icon {
    background: rgba(255, 255, 255, 0.45);
    color: #0c1626;
}

.bottom-nav-bubble {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #2a2a10;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0e1622;
}

@media (max-width: 1024px) {
    .bottom-nav { display: flex; }

    /* Make sure page content isn't hidden behind the fixed bar */
    body { padding-bottom: 92px; }
    body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 768px) {
    .bottom-nav-item { min-width: 64px; font-size: 11px; }
    .bottom-nav-icon { width: 30px; height: 30px; font-size: 14px; }
    .bottom-nav-icon img { width: 26px; height: 26px; }
    .bottom-nav-basket { min-width: 76px; }
}

@media (max-width: 480px) {
    .bottom-nav { padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 5px; }
    .bottom-nav-scroll { gap: 5px; }
    .bottom-nav-item { min-width: 56px; padding: 7px 6px; font-size: 10px; gap: 3px; }
    .bottom-nav-icon { width: 26px; height: 26px; font-size: 13px; }
    .bottom-nav-icon img { width: 22px; height: 22px; }
    .bottom-nav-basket { min-width: 64px; }
    body { padding-bottom: 84px; }
    body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 360px) {
    .bottom-nav { padding: 7px 7px calc(7px + env(safe-area-inset-bottom, 0px)); gap: 4px; }
    .bottom-nav-scroll { gap: 4px; }
    .bottom-nav-item { min-width: 48px; padding: 6px 5px; font-size: 9px; gap: 3px; }
    .bottom-nav-icon { width: 24px; height: 24px; font-size: 12px; }
    .bottom-nav-icon img { width: 20px; height: 20px; }
    .bottom-nav-basket { min-width: 56px; }
    .bottom-nav-bubble { top: -5px; right: -6px; height: 16px; min-width: 16px; font-size: 9px; padding: 0 4px; border-width: 1px; }
    body { padding-bottom: 78px; }
    body { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
}
