/* ============================================
   Tab Bar - 底部导航
   ============================================ */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-height);
  background: var(--tabbar-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-tabbar);
  padding-bottom: var(--safe-bottom);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out);
}

.tabbar-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.tabbar-brand {
  display: none;
}

.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  min-height: 44px;
  cursor: pointer;
  position: relative;
  transition: color var(--duration-fast);
  color: var(--text-muted);
  padding: 2px 0 3px;
}

.tabbar-item.active {
  color: var(--tabbar-active);
}

.tab-icon {
  width: 21px;
  height: 21px;
  margin-bottom: 2px;
  object-fit: contain;
  transition: transform var(--duration-normal) var(--ease-out);
}

/* 默认 & 选中图标切换 */

.tabbar-item.active .tab-icon {
  transform: scale(1.08);
}

/* 推荐Tab 中间指示器 */

.tab-label {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  line-height: 1.1;
}

/* ---- "NEW" 角标 ----
   底栏本身已经很好点，问题是新入口混在四个同级图标里没有任何区分度。
   角标只在用户还没进过该页面时显示，进过一次就不再出现——长期挂着的
   "NEW" 会变成背景噪音，反而拉低整条底栏的信噪比。 */

.tab-badge {
  position: absolute;
  top: 1px;
  left: 50%;
  z-index: 1;
  /* line-height 等于盒高来居中，而不是 flex 或上下 padding 凑。
     flex 居中的是「行盒」，但纯大写文本的墨迹只占行盒上半部分（基线以下的
     降部空间空着），结果看着偏高——实测偏了 2.7px。用 line-height 时浏览器
     分配半行距会把字体自身的 ascent/descent 算进去，大写文本正好落在视觉
     中心，且不依赖手调的魔法数字。 */
  display: inline-block;
  /* 盒高取偶数：大写 NEW 在 8px 字号下墨迹正好 6px 高，奇数盒高无论如何
     都会剩下半个像素，只能 4/5 或 5/4 地偏一边。16px 时上下各 5px。 */
  height: 16px;
  margin-left: 4px;
  padding: 0 6px;
  line-height: 16px;
  text-align: center;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #f7e1a0, #d89a2a);
  box-shadow: 0 2px 9px rgba(216, 154, 42, 0.5);
  color: #1a1206;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.06em;
  pointer-events: none;
}

/* 数量角标：红底白字，和金色的 NEW 区分开——一个是「有东西等你」，
   一个是「这里是新功能」，两种语气不该长得一样。 */
.tab-badge--count {
  min-width: 18px;
  padding: 0 5px;
  background: var(--color-primary);
  box-shadow: 0 2px 9px rgba(var(--color-primary-rgb), 0.55);
  color: #fff;
  font-size: 9px;
  letter-spacing: 0;
}

/* 读屏软件会把它读成 "NEW feature"，视觉上只保留 NEW。 */
.tab-badge em {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 带角标时图标提亮一点，让这一格整体比邻居更显眼。
   必须限定在移动端：桌面端 Create 是金色实心药丸，图标要跟着药丸用深色，
   而这条选择器权重 (0,3,0) 会盖掉桌面端的设定。 */
@media (max-width: 767px) {
  .tabbar-item:has(.tab-badge):not(.active) .tab-icon {
    color: rgba(255, 255, 255, 0.78);
  }
}

/* For You 模式移动端智能底栏 (与 Home/Profile 样式完全一致，仅做平滑淡入淡出) */
#app.is-tab-foryou .tabbar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#app.is-tab-foryou .tabbar.tabbar--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (min-width: 768px) {
  .tabbar,
  #app.is-tab-foryou .tabbar {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    height: 64px;
    padding-bottom: 0;
    border-top: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--tabbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0;
    box-shadow: none;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 100;
  }

  .tabbar.tabbar--transparent .tab-icon,
  .tabbar.tabbar--transparent .tab-label,
  #app.is-tab-foryou .tabbar .tab-icon,
  #app.is-tab-foryou .tabbar .tab-label {
    filter: none;
  }

  .tabbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    justify-content: flex-end;
    gap: 4px;
  }

  .tabbar-brand {
    display: block;
    margin-right: auto;
    color: #fff;
    font-size: 21px;
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.4px;
  }

  .tabbar-item {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 16px;
    flex-direction: row;
    gap: 8px;
    border-radius: 10px;
  }

  .tabbar-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .tab-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 0;
  }

  .tab-label {
    font-size: 14px;
  }

  }