/* ==========================================================================
   底部导航栏：悬浮液态玻璃（原生 CSS，无框架）
   配合 /components/bottom-nav.php + /js/bottom-nav.js 使用
   ========================================================================== */

/* 面板显隐：用 !important 兜底，避免页面自身的 display 规则覆盖 hidden */
[data-nav-panel][hidden] { display: none !important; }

/* ---------- 外壳：固定悬浮 + 适配底部安全区（避开 iPhone 小黑条） ---------- */
.bnav {
    position: fixed;
    left: 12px;                      /* 左右留边，不贴死屏幕边缘 */
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    display: flex;
    align-items: stretch;
    padding: 5px;
    border-radius: 24px;
    overflow: hidden;                /* 裁住涟漪与流光，跟随大圆角 */
    isolation: isolate;              /* 自建层叠上下文，避免和页面 z-index 互相干扰 */
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
}
.bnav, .bnav * { box-sizing: border-box; }

/* ---------- 玻璃层：毛玻璃 + 半透明 + 细白边框 + 柔和阴影 ---------- */
.bnav-glass {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.22);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    backdrop-filter: blur(24px) saturate(200%);
    border: 0.5px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 0.5px rgba(60, 60, 67, 0.06),
                0 8px 28px rgba(0, 0, 0, 0.14),
                inset 0 1px 0 rgba(255, 255, 255, 0.7);
    will-change: transform;
}

/* ---------- 液态流动：两层缓慢漂移的高光 ----------
   只用 transform 动画（合成层，不重排不重绘），刻意不去动画 backdrop-filter 的模糊量
   ——那样每帧都要重新模糊整块区域，中低端手机会掉帧。 */
.bnav-glass::before,
.bnav-glass::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    will-change: transform;
}
.bnav-glass::before {
    width: 180px; height: 180px; left: -40px; top: -70px;
    animation: bnavFlowA 9s ease-in-out infinite;
}
.bnav-glass::after {
    width: 150px; height: 150px; right: -40px; bottom: -70px;
    animation: bnavFlowB 11s ease-in-out infinite;
}
@keyframes bnavFlowA {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(60px, 10px, 0) scale(1.15); }
}
@keyframes bnavFlowB {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1.1); }
    50%      { transform: translate3d(-52px, -8px, 0) scale(0.95); }
}

/* ---------- 导航条目：图标 + 文字，横向均分 ---------- */
.bnav-item {
    position: relative;
    z-index: 1;                      /* 压在玻璃层之上 */
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 46px;
    padding: 5px 2px;
    border: 0;
    background: none;
    border-radius: 19px;
    overflow: hidden;                /* 裁住涟漪 */
    font-family: inherit;
    font-size: 11px;
    line-height: 1;
    color: #8e8e93;                  /* 未选中：浅灰 */
    text-decoration: none;           /* 条目可能是 <a>，去掉下划线 */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.bnav-icon {
    display: block;
    width: 22px;
    height: 22px;
    /* 弹簧曲线：点下去有轻微回弹 */
    transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bnav-icon svg { display: block; width: 100%; height: 100%; }

.bnav-label {
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* 选中态：文字变蓝 + 图标轻微放大上浮 */
.bnav-item.is-active { color: #3853e3; }
.bnav-item.is-active .bnav-icon { transform: scale(1.18) translateY(-1px); }

/* 按下反馈 */
.bnav-item:active .bnav-icon { transform: scale(0.92); }

/* ---------- 液态涟漪：从点击点扩散 ---------- */
.bnav-ripple {
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 83, 227, 0.28), rgba(56, 83, 227, 0) 70%);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    will-change: transform, opacity;
    animation: bnavRipple 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes bnavRipple {
    to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---------- 切换时：玻璃层轻微液态涌动形变 ---------- */
.bnav.is-surging .bnav-glass {
    animation: bnavSurge 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bnavSurge {
    0%   { transform: scale(1, 1); }
    35%  { transform: scale(1.015, 0.94); }
    70%  { transform: scale(0.995, 1.03); }
    100% { transform: scale(1, 1); }
}

/* ---------- 尊重系统「减弱动效」设置，同时避免低电量/低端机掉帧 ---------- */
@media (prefers-reduced-motion: reduce) {
    .bnav-glass::before,
    .bnav-glass::after,
    .bnav.is-surging .bnav-glass,
    .bnav-ripple { animation: none !important; }
}
