/* Amazon-style fixed bottom tab bar — customer portal */
:root {
    --ca-lnav-h: 54px;
    --ca-lnav-pad: 4px;
    --ca-lnav-ink: #131921;
    --ca-lnav-muted: #565959;
    --ca-lnav-active: #1d7232;
    --ca-lnav-line: #e7e7e7;
    --ca-lnav-max: var(--kf-app-shell-max, 430px);
    --ca-lnav-bg: #ffffff;
    --ca-lnav-dock: calc(var(--ca-lnav-h) + 2 * var(--ca-lnav-pad) + 8px);
    --kf-floating-cart-size: 58px;
    --kf-floating-cart-nav-gap: 12px;
    --kf-floating-cart-bottom: calc(
        var(--ca-lnav-dock, 0px)
        + var(--kf-floating-cart-nav-gap)
        + env(safe-area-inset-bottom, 0px)
    );
}

.ca-lnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: min(100vw, var(--ca-lnav-max));
    z-index: 1100;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    min-height: calc(var(--ca-lnav-h) + env(safe-area-inset-bottom, 0px));
    padding: var(--ca-lnav-pad) 2px calc(var(--ca-lnav-pad) + env(safe-area-inset-bottom, 0px));
    padding-left: max(2px, env(safe-area-inset-left, 0px));
    padding-right: max(2px, env(safe-area-inset-right, 0px));
    box-sizing: border-box;
    background: var(--ca-lnav-bg);
    border-top: 1px solid var(--ca-lnav-line);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    /* No transform — transforms + visualViewport fighting break Chrome mobile fixed bars. */
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.ca-lnav--amazon {
    gap: 0;
}

.ca-lnav::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--kf-solid-orange, #ea580c);
    pointer-events: none;
    z-index: 2;
}

.ca-lnav__link {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 6px 2px 4px;
    text-decoration: none;
    color: var(--ca-lnav-ink);
    font-family: var(--kf-app-font-family), system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.ca-lnav__link:active {
    opacity: 0.72;
}

.ca-lnav__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: inherit;
}

.ca-lnav__icon svg,
.ca-lnav__photo {
    width: 22px;
    height: 22px;
    display: block;
}

.ca-lnav__photo {
    object-fit: contain;
}

body.with-login-bottom-nav {
    --kf-floating-cart-bottom: calc(
        var(--ca-lnav-dock, 0px)
        + var(--kf-floating-cart-nav-gap, 12px)
        + env(safe-area-inset-bottom, 0px)
    );
}

body.with-login-bottom-nav:not(:has(.ca-lnav)) {
    --ca-lnav-dock: 0px;
    --kf-floating-cart-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.ca-lnav__label {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
}

.ca-lnav__link--active,
.ca-lnav__link[aria-current='page'] {
    color: var(--ca-lnav-active);
}

.ca-lnav__link--active .ca-lnav__label,
.ca-lnav__link[aria-current='page'] .ca-lnav__label {
    font-weight: 700;
}

/* Badges — Amazon-like dots / counts on icons */
.ca-lnav__badge {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    box-sizing: border-box;
}

.ca-lnav__badge--count,
.ca-lnav__badge--dot {
    top: 2px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e11d2e;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    border: 1.5px solid #fff;
}

.ca-lnav__badge--wallet {
    top: 1px;
    right: calc(50% - 22px);
    min-width: 18px;
    max-width: 36px;
    height: 14px;
    padding: 0 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #1d7232;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    border: 1.5px solid #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ca-lnav__badge[hidden] {
    display: none !important;
}

@media (max-width: 767.98px) {
    :root {
        --ca-lnav-max: 100%;
    }

    .ca-lnav {
        width: 100%;
        max-width: none;
    }
}

@media (min-width: 768px) {
    :root {
        --ca-lnav-max: var(--kf-app-shell-max, 430px);
    }

    .ca-lnav {
        border-radius: 12px 12px 0 0;
        border-left: 1px solid var(--ca-lnav-line);
        border-right: 1px solid var(--ca-lnav-line);
    }
}

@media (max-width: 360px) {
    .ca-lnav__label {
        font-size: 9px;
    }

    .ca-lnav__icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Blinkit-style View cart pill — bottom-center above bottom nav */
.kf-floating-cart {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(
        var(--ca-lnav-dock, 0px)
        + var(--kf-floating-cart-nav-gap, 12px)
        + env(safe-area-inset-bottom, 0px)
    );
    top: auto;
    z-index: 1120;
    display: flex;
    justify-content: center;
    width: max-content;
    max-width: calc(100% - 32px);
    margin: 0 auto;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

.kf-floating-cart[hidden] {
    display: none !important;
}

.kf-floating-cart__btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    pointer-events: auto;
    background: linear-gradient(180deg, #ffe566 0%, #ffd400 55%, #f5c400 100%);
    color: #1a1a1a;
    border: 1px solid rgba(201, 162, 0, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 8px 22px rgba(245, 196, 0, 0.48);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kf-floating-cart:active .kf-floating-cart__btn {
    transform: scale(0.97);
}

.kf-floating-cart__thumb {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #a16207;
}

.kf-floating-cart__photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kf-floating-cart__icon {
    width: 22px;
    height: 22px;
    stroke: #a16207;
}

.kf-floating-cart__copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    line-height: 1.15;
}

.kf-floating-cart__title {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #1a1a1a;
}

.kf-floating-cart__meta,
.kf-floating-cart__badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: rgba(26, 26, 26, 0.78);
}

body.bh-pay-sheet-open .kf-floating-cart {
    display: none !important;
}

.kf-floating-cart__meta[hidden],
.kf-floating-cart__badge[hidden] {
    display: none !important;
}

.kf-floating-cart__chev {
    display: inline-flex;
    flex: 0 0 auto;
    color: #1a1a1a;
    margin-left: 2px;
}

@media (min-width: 768px) {
    .kf-floating-cart {
        left: 0;
        right: 0;
        margin: 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kf-floating-cart__btn {
        transition: none;
    }
}

/* Portal pages with bottom nav: keep FAB above the dock */
body.with-login-bottom-nav .kf-floating-cart,
body.with-login-bottom-nav:has(header.kph .kph-farmer-thanks) .kf-floating-cart,
body.with-login-bottom-nav:has(header.kph .kph-storenav) .kf-floating-cart,
body.with-login-bottom-nav:has(header.kph .kph-quicktabs) .kf-floating-cart {
    top: auto;
    bottom: calc(
        var(--ca-lnav-dock, 0px)
        + var(--kf-floating-cart-nav-gap, 12px)
        + env(safe-area-inset-bottom, 0px)
    );
}

body.with-login-bottom-nav .ca-wrap {
    padding-bottom: calc(24px + var(--ca-lnav-h) + env(safe-area-inset-bottom, 0px));
}

body.with-login-bottom-nav .kf-sheet {
    padding-bottom: calc(22px + var(--ca-lnav-h) + env(safe-area-inset-bottom, 0px));
}

body.bh-page.with-login-bottom-nav .bh-bar {
    bottom: calc(var(--ca-lnav-dock) + env(safe-area-inset-bottom, 0px));
    z-index: 850;
}

body.bh-page.with-login-bottom-nav .bh-shell {
    padding-bottom: calc(70px + var(--ca-lnav-dock) + var(--safe-b));
}

@media (min-width: 768px) {
    body.bh-page.with-login-bottom-nav .bh-bar {
        left: 0;
        right: 0;
        width: min(100vw, var(--ca-lnav-max));
        max-width: var(--ca-lnav-max);
        margin-left: auto;
        margin-right: auto;
        border-left: 1px solid rgba(0, 0, 0, 0.12);
        border-right: 1px solid rgba(0, 0, 0, 0.12);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            inset 1px 0 0 rgba(255, 255, 255, 0.04),
            inset -1px 0 0 rgba(0, 0, 0, 0.1);
    }
}
