/* 底部菜单（主页 / 商店 / 购物车 / 账户） */

#pf-bottomnav {
    --pf-bn-bg: #ffffff;
    --pf-bn-icon: #555555;
    --pf-bn-text: #555555;
    --pf-bn-badge: #e74c3c;
    --pf-bn-active: #e74c3c;
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    box-sizing: border-box;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: stretch;
    justify-content: space-around;
    background: var(--pf-bn-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

#pf-bottomnav .pf-bn-item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none !important;
    box-shadow: none !important;
    background: none !important;
    color: var(--pf-bn-text);
    -webkit-tap-highlight-color: transparent;
}

#pf-bottomnav .pf-bn-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pf-bn-icon);
    line-height: 0;
}

#pf-bottomnav .pf-bn-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

#pf-bottomnav .pf-bn-label {
    max-width: 100%;
    font-size: 11px;
    line-height: 1.2;
    color: var(--pf-bn-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#pf-bottomnav .pf-bn-cart-value {
    font-weight: 600;
}

/* 选中高亮：图标与文字同时变色 */
#pf-bottomnav .pf-bn-item.active .pf-bn-icon {
    color: var(--pf-bn-active);
}

#pf-bottomnav .pf-bn-item.active .pf-bn-label {
    color: var(--pf-bn-active);
    font-weight: 600;
}

#pf-bottomnav .pf-bn-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    box-sizing: border-box;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--pf-bn-badge);
    color: #ffffff;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    white-space: nowrap;
}

/* 开启底部菜单后，原购物车结算栏默认不再显示 */
body.pf-bottomnav-on .pf-cart-bar {
    display: none !important;
}

/* 显示范围：默认全端显示 */
body.pf-bottomnav-on #pf-bottomnav {
    display: flex;
}

/* 仅手机显示：桌面端隐藏 */
body.pf-bottomnav-on.pf-bn-mobile-only #pf-bottomnav {
    display: none;
}

/* 内容避让底部菜单 */
body.pf-bottomnav-on:not(.pf-bn-mobile-only) {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1024px) {
    body.pf-bottomnav-on #pf-bottomnav {
        display: flex;
    }

    body.pf-bottomnav-on.pf-bn-mobile-only #pf-bottomnav {
        display: flex;
    }

    body.pf-bottomnav-on {
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }
}

/* 产品详情页自动隐藏（放在最后，确保覆盖上面的显示规则） */
body.pf-bottomnav-on.pf-bn-hide-product #pf-bottomnav {
    display: none;
}

body.pf-bottomnav-on.pf-bn-hide-product {
    padding-bottom: 0;
}
