/* ============================================================
   底部导航栏组件 — 样式
   纯 CSS，零依赖，可自定义颜色和尺寸
   ============================================================ */

:root {
  /* —— 在这里改颜色 —— */
  --bn-primary: #00A0E9;        /* 主色（按钮/返回顶部背景色） */
  --bn-primary-hover: #0090D2; /* 主色悬停 */
  --bn-text: #999;             /* 默认文字色 */
  --bn-text-active: #00A0E9;   /* 选中文字色 */
  --bn-bg: #fff;                /* 导航栏背景 */
  --bn-icon-size: 22px;         /* 图标大小 */
  --bn-font-size: 11px;         /* 文字大小 */
  --bn-nav-height: 60px;        /* 导航栏高度 */
}

/* 导航栏外层容器 */
.bn-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1002;
  background: var(--bn-bg);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  display: flex;
  justify-content: space-around;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/* 单个菜单项 */
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: var(--bn-font-size);
  color: var(--bn-text);
  text-decoration: none;
  cursor: pointer;
  transition: color .25s ease;
  background: none;
  border: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.bn-item svg {
  width: var(--bn-icon-size);
  height: var(--bn-icon-size);
}
.bn-item span {
  line-height: 1.2;
}
.bn-item:hover,
.bn-item.active {
  color: var(--bn-text-active);
}
.bn-item.active {
  font-weight: 600;
}

/* 返回顶部按钮（居中悬浮） */
.bn-backtop {
  position: absolute;
  left: 50%; top: -24px;
  transform: translateX(-50%);
  width: 56px; height: 56px;
  background: var(--bn-primary);
  color: #fff;
  border: 4px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease, background .25s ease, transform .25s ease;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
}
.bn-backtop.show {
  opacity: 1;
  visibility: visible;
}
.bn-backtop:hover {
  background: var(--bn-primary-hover);
  transform: translateX(-50%) translateY(-2px);
}
.bn-backtop svg {
  width: 22px; height: 22px;
}

/* 内嵌 iframe 容器 */
.bn-frame {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1001;
  background: #fff;
}
.bn-frame.open {
  display: flex;
  flex-direction: column;
}
.bn-frame-bar {
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--bn-primary);
  color: #fff;
}
.bn-frame-close {
  width: 28px; height: 28px;
  border: 0;
  background: rgba(255,255,255,.25);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bn-frame-close:hover {
  background: rgba(255,255,255,.4);
}
.bn-frame-title {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bn-frame-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  touch-action: pan-y;             /* 允许触摸纵向滚动（防宿主页拦截触摸） */
  overscroll-behavior: contain;    /* 滚到顶/底不把滚动传给宿主页 */
}

/* iframe 打开时禁止页面滚动 */
html.bn-open,
body.bn-open {
  overflow: hidden;
}

/* body 底部留出导航栏高度 */
body.bn-mounted {
  padding-bottom: var(--bn-nav-height);
}

/* 移动端适配 */
@media (max-width: 480px) {
  .bn-backtop {
    width: 48px; height: 48px;
    top: -18px;
    border-width: 3px;
  }
  .bn-backtop svg {
    width: 18px; height: 18px;
  }
}

/* ============================================================
   防宿主样式污染（移植到其他网站时必开）
   宿主站常有 a{color:#fff!important} / svg{fill:#fff} 类全局规则，
   图标 stroke=currentColor 跟随文字色，一旦 color 被改成白色，
   白底导航上字和图标全部隐形。以下 !important 锁死导航内部颜色。
   ============================================================ */
.bn-nav .bn-item,
.bn-nav .bn-item:link,
.bn-nav .bn-item:visited {
  color: var(--bn-text) !important;
  -webkit-text-fill-color: var(--bn-text) !important;
  font-size: var(--bn-font-size) !important;
}
.bn-nav .bn-item:hover,
.bn-nav .bn-item.active {
  color: var(--bn-text-active) !important;
  -webkit-text-fill-color: var(--bn-text-active) !important;
}
.bn-nav .bn-item svg,
.bn-nav .bn-item svg * {
  color: inherit !important;   /* 防 a *{color:#fff!important} 直接命中 path */
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2;
}
.bn-nav .bn-item span {
  display: inline !important;
  width: auto !important;
  max-width: none !important;
  overflow: visible !important;
  font-size: var(--bn-font-size) !important;
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
}
/* 返回顶部按钮：同样防宿主 svg 污染（箭头是描边线，被 fill:#fff 强填会变白色色块） */
.bn-nav .bn-backtop {
  background: var(--bn-primary) !important;
  color: #fff !important;
}
.bn-nav .bn-backtop:hover {
  background: var(--bn-primary-hover) !important;
}
.bn-nav .bn-backtop svg,
.bn-nav .bn-backtop svg * {
  fill: none !important;
  stroke: #fff !important;
  stroke-width: 2 !important;
}
