/* ============================================
   BOTTOM NAVIGATION — Mobile Only
   Fixed bar with 5 nav items + kategori overlay
   ============================================ */

/* ── Bar Container ── */
.bottom-nav {
    display: none;
    /* hidden on desktop */
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
    }

    /* ── Main Bar ── */
    .bottom-nav-bar {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: end;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
        padding: 6px 0;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }

    /* ── Nav Item ── */
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 4px 0 2px;
        text-decoration: none;
        color: #94a3b8;
        font-size: 0.62rem;
        font-weight: 500;
        letter-spacing: 0.01em;
        transition: color 0.2s ease, transform 0.15s ease;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        border: none;
        background: none;
        position: relative;
    }

    .bottom-nav-item i {
        font-size: 1.2rem;
        transition: transform 0.2s ease, color 0.2s ease;
        line-height: 1;
    }

    .bottom-nav-item span {
        line-height: 1.2;
        white-space: nowrap;
    }

    /* Active state */
    .bottom-nav-item.active {
        color: #0891b2;
    }

    .bottom-nav-item.active i {
        transform: scale(1.1);
    }

    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: -1px;
        left: 50%;
        transform: translateX(-50%);
        width: 28px;
        height: 3px;
        background: #0891b2;
        border-radius: 0 0 4px 4px;
    }

    /* Press effect */
    .bottom-nav-item:active {
        transform: scale(0.92);
    }

    /* ── Kategori Overlay ── */
    .bottom-nav-cat-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s;
    }

    .bottom-nav-cat-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .bottom-nav-cat-panel {
        position: fixed;
        bottom: 64px;
        left: 0;
        right: 0;
        z-index: 10000;
        background: #fff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
        max-height: calc(70vh - 64px);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
    }

    .bottom-nav-cat-overlay.open .bottom-nav-cat-panel {
        transform: translateY(0);
    }

    /* Panel header */
    .bottom-nav-cat-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px 12px;
        border-bottom: 1px solid #f1f5f9;
        flex-shrink: 0;
    }

    .bottom-nav-cat-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 700;
        color: #1e293b;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .bottom-nav-cat-header h3 i {
        color: #0891b2;
    }

    .bottom-nav-cat-close {
        width: 32px;
        height: 32px;
        border: none;
        background: #f1f5f9;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1rem;
        color: #64748b;
        transition: background 0.15s;
    }

    .bottom-nav-cat-close:hover {
        background: #e2e8f0;
    }

    /* Handle bar (drag indicator) */
    .bottom-nav-cat-handle {
        display: flex;
        justify-content: center;
        padding: 8px 0 0;
        flex-shrink: 0;
    }

    .bottom-nav-cat-handle span {
        width: 36px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 99px;
    }

    /* Panel body — scrollable */
    .bottom-nav-cat-body {
        overflow-y: auto;
        padding: 8px 16px 16px;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    /* Loading spinner */
    .bottom-nav-cat-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 40px 0;
        color: #94a3b8;
        font-size: 0.85rem;
        gap: 8px;
    }

    .bottom-nav-cat-loading i {
        animation: bnSpin 1s linear infinite;
    }

    @keyframes bnSpin {
        from {
            transform: rotate(0deg);
        }

        to {
            transform: rotate(360deg);
        }
    }

    /* Category grid */
    .bottom-nav-cat-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .bottom-nav-cat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 14px 6px 10px;
        background: #f8fafc;
        border-radius: 14px;
        text-decoration: none;
        color: #334155;
        transition: all 0.15s ease;
        border: 1.5px solid transparent;
    }

    .bottom-nav-cat-item:active {
        transform: scale(0.95);
        background: #f0fdfa;
        border-color: #0891b2;
    }

    .bottom-nav-cat-item img {
        width: 44px;
        height: 44px;
        object-fit: contain;
        border-radius: 10px;
    }

    .bottom-nav-cat-item .cat-icon-placeholder {
        width: 44px;
        height: 44px;
        background: linear-gradient(135deg, #e0f2fe, #cffafe);
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: #0891b2;
    }

    .bottom-nav-cat-item span {
        font-size: 0.7rem;
        font-weight: 600;
        text-align: center;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ── Body padding so content isn't hidden behind bar ── */
    body {
        padding-bottom: 64px !important;
    }

    /* ── Push WA float above the bottom nav ── */
    .whatsapp-float-mobile {
        bottom: 72px !important;
    }

    /* ── Hide old hamburger float — replaced by bottom nav ── */
    .hamburger-float {
        display: none !important;
    }
}

/* ── Desktop: ensure nothing shows ── */
@media (min-width: 769px) {

    .bottom-nav,
    .bottom-nav-cat-overlay {
        display: none !important;
    }
}