/* Mobile bottom navigation (floating bar with raised cart button) */

.km-bnav {
    display: none;
}

@media (max-width: 767px) {

    :root {
        --bottom-nav-height: calc(96px + env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: var(--bottom-nav-height);
    }

    .km-bnav {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 9999;

        display: flex;
        align-items: stretch;
        height: 66px;
        padding: 0 6px;

        background: rgba(255, 255, 255, 0.94);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        border: 1px solid rgba(15, 76, 143, 0.08);
        border-radius: 22px;
        box-shadow: 0 12px 32px rgba(15, 39, 71, 0.18), 0 2px 6px rgba(15, 39, 71, 0.06);
    }

    .km-bnav a {
        position: relative;
        flex: 1;
        min-width: 0;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;

        color: #8a94a6;
        font-family: "Poppins", sans-serif;
        font-size: 10.5px;
        font-weight: 500;
        line-height: 1;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.25s ease;
    }

    .km-bnav-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 30px;
        border-radius: 12px;
        font-size: 18px;
        transition: background-color 0.25s ease, transform 0.25s ease;
    }

    .km-bnav-avatar {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid transparent;
        transition: border-color 0.25s ease;
    }

    .km-bnav a:active .km-bnav-icon {
        transform: scale(0.9);
    }

    /* Active tab */

    .km-bnav a.active {
        color: #0f4c8f;
        font-weight: 600;
    }

    .km-bnav a.active .km-bnav-icon {
        background: #e8f1fb;
    }

    .km-bnav a.active .km-bnav-avatar {
        border-color: #0f4c8f;
    }

    .km-bnav a.active::after {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        width: 22px;
        height: 3px;
        transform: translateX(-50%);
        border-radius: 0 0 3px 3px;
        background: #e8792a;
    }

    /* Raised cart button */

    .km-bnav a.km-bnav-cart {
        justify-content: flex-end;
        padding-bottom: 11px;
    }

    .km-bnav a.km-bnav-cart::after {
        display: none;
    }

    .km-bnav-cart .km-bnav-icon {
        position: absolute;
        top: -24px;
        left: 50%;
        width: 58px;
        height: 58px;
        margin-left: -29px;

        color: #ffffff;
        font-size: 21px;
        border-radius: 50%;
        border: 5px solid #ffffff;
        background: linear-gradient(135deg, #1f6fc4 0%, #0f4c8f 100%);
        box-shadow: 0 8px 18px rgba(15, 76, 143, 0.40);
    }

    .km-bnav a.km-bnav-cart.active .km-bnav-icon {
        background: linear-gradient(135deg, #f0913f 0%, #e8792a 100%);
        box-shadow: 0 8px 18px rgba(232, 121, 42, 0.40);
    }

    .km-bnav-count {
        position: absolute;
        top: -4px;
        right: -6px;

        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 21px;
        height: 21px;
        padding: 0 5px;

        color: #ffffff;
        font-family: Arial, sans-serif;
        font-size: 10px;
        font-weight: 700;
        border: 2px solid #ffffff;
        border-radius: 999px;
        background: #e8792a;
    }

    .km-bnav-cart.active .km-bnav-count {
        background: #0f4c8f;
    }

    .km-bnav-count.bump {
        animation: km-bnav-bump 0.5s ease;
    }

    @keyframes km-bnav-bump {
        0%, 100% { transform: scale(1); }
        40% { transform: scale(1.35); }
    }

    .back-to-top {
        bottom: calc(96px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .km-bnav *,
    .km-bnav a {
        transition: none !important;
        animation: none !important;
    }
}
