/**
 * Нижняя панель навигации покупателя — всегда видна, в т.ч. при открытом чате.
 */
body { padding-bottom: 52px !important; }
.bottom-nav { display: flex !important; position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; box-sizing: border-box; background: var(--card); border-top: 1px solid var(--border); z-index: 2147483647 !important; padding: 6px 0 max(8px, env(safe-area-inset-bottom)); padding-left: max(0px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); justify-content: space-evenly; align-items: center; gap: 2px; flex-wrap: nowrap; pointer-events: auto; transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
/* При открытой модалке чата навигация остаётся кликабельной */
body:has(#cabinet-messenger-modal.open) .bottom-nav { z-index: 2147483647 !important; visibility: visible !important; opacity: 1 !important; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; text-decoration: none; font-size: 0.7rem; padding: 4px 6px; flex: 1; min-width: 0; -webkit-tap-highlight-color: transparent; tap-highlight-color: transparent; }
.bottom-nav .bottom-nav-label { display: block !important; visibility: visible !important; font-size: 0.65rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: inherit; -webkit-text-fill-color: inherit; }
.bottom-nav a:hover,
.bottom-nav a:active { color: #fff; -webkit-text-fill-color: #fff; }
.bottom-nav a.active { color: #27ae60 !important; -webkit-text-fill-color: #27ae60 !important; }
.bottom-nav a.bottom-nav-cart-disabled { opacity: 0.5; pointer-events: none; cursor: default; }
.bottom-nav a svg { width: 24px; height: 24px; fill: currentColor; flex-shrink: 0; }
.bottom-nav .cart-icon-wrap { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.bottom-nav .cart-icon-wrap .cart-num { display: none; min-width: 20px; height: 20px; padding: 0; background: #e74c3c; color: #fff !important; -webkit-text-fill-color: #fff !important; font-size: 0.75rem; font-weight: 700; border-radius: 50%; align-items: center; justify-content: center; }
.bottom-nav .cart-has-items .cart-num { display: inline-flex !important; }
.bottom-nav .nav-messenger-wrap, .nav .nav-messenger-wrap { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; min-width: 0; gap: 4px; }
.bottom-nav .nav-messenger-wrap svg { width: 24px; height: 24px; fill: currentColor; flex-shrink: 0; }
.bottom-nav .nav-messenger-wrap { position: relative; }
.bottom-nav .nav-messenger-wrap .messenger-badge { position: absolute; top: -4px; right: -6px; min-width: 20px; height: 20px; padding: 0; background: #e74c3c; color: #fff; font-size: 0.75rem; font-weight: 700; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.bottom-nav .cart-has-items { color: #fff !important; }
.bottom-nav .cart-has-items:hover { color: #fff !important; }
.bottom-nav .cart-has-items.active { color: #27ae60 !important; -webkit-text-fill-color: #27ae60 !important; }

@media (max-width: 768px) {
    /* Компактная панель: больше видно контента, пункты не уезжают за экран */
    body { padding-bottom: calc(48px + max(6px, env(safe-area-inset-bottom))) !important; }
    .bottom-nav {
        padding: 4px 2px max(6px, env(safe-area-inset-bottom));
    }
    .bottom-nav a { flex: 1; min-width: 0; padding: 2px 2px; font-size: clamp(0.55rem, 2.4vw, 0.72rem); flex-direction: column; gap: 2px; }
    .bottom-nav .bottom-nav-label { display: block !important; visibility: visible !important; font-size: clamp(0.55rem, 2.4vw, 0.72rem); line-height: 1.15; }
    .bottom-nav a svg { width: clamp(20px, 5vw, 24px); height: clamp(20px, 5vw, 24px); }
    .bottom-nav .nav-messenger-wrap svg { width: clamp(20px, 5vw, 24px); height: clamp(20px, 5vw, 24px); }
    .bottom-nav .cart-icon-wrap .cart-num { display: none; min-width: 18px; height: 18px; padding: 0; background: #e74c3c; color: #fff; font-weight: 700; font-size: 0.7rem; border-radius: 50%; align-items: center; justify-content: center; }
    .bottom-nav .cart-has-items .cart-num { display: inline-flex !important; }
    .nav-desktop { display: none !important; }
}

@media (max-width: 360px) {
    body { padding-bottom: calc(44px + max(4px, env(safe-area-inset-bottom))) !important; }
    .bottom-nav { padding: 2px 0 max(4px, env(safe-area-inset-bottom)); gap: 0; flex-wrap: nowrap; }
    .bottom-nav a { font-size: clamp(0.5rem, 2.8vw, 0.62rem); padding: 1px 1px; flex: 1; min-width: 0; gap: 1px; }
    .bottom-nav .bottom-nav-label { font-size: clamp(0.5rem, 2.8vw, 0.62rem); }
    .bottom-nav a svg { width: 20px; height: 20px; }
    .bottom-nav .nav-messenger-wrap svg { width: 20px; height: 20px; }
    .bottom-nav .nav-messenger-wrap .messenger-badge { min-width: 16px; height: 16px; font-size: 0.65rem; top: -2px; right: -4px; }
    .bottom-nav .cart-icon-wrap .cart-num { min-width: 16px; height: 16px; font-size: 0.6rem; }
}

/* Компьютерная версия: нижняя панель только для мобильных */
@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    body {
        padding-bottom: 0 !important;
    }
    /* Панели нет — модалка чата на всю высоту экрана */
    #cabinet-messenger-modal {
        bottom: 0 !important;
    }
}
