/*! UpSEO Tab Bar 1.0 — نوار پایین موبایل و تبلت (زیر 1150px)
 *  جایگزین دکمه‌ی گرد شناور منو. چهار تب: ابزارها، دستیار، اعتبار، پروفایل.
 *  مارکاپ و اسکریپت در sidebar.php است. کلاس html.up-has-tabbar زودهنگام همان‌جا ست می‌شود.
 */
.up-tabbar { display: none; }

@media (max-width: 1150px) {
  html.up-has-tabbar body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important; }
  html.up-has-tabbar body.up-embed { padding-bottom: 0 !important; }
  html.up-has-tabbar .up-sb-fab { display: none !important; }   /* تب‌بار جای دکمه‌ی گرد را گرفته */

  html.up-has-tabbar .up-tabbar {
    display: flex;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 9400;                       /* زیر لایه‌ی تیره (100040) و کشو (100070) */
    align-items: stretch;
    justify-content: space-around;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--up-line, #e2e8f0);
    transition: transform .2s ease;
  }
  html.up-has-tabbar body.up-embed .up-tabbar { display: none; }
  /* وقتی کیبورد گوشی برای تایپ باز است، نوار روی فیلد نمی‌افتد */
  body.up-tb-hide .up-tabbar { transform: translateY(110%); }

  .up-tb {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--up-muted, #64748b);
    font: inherit;
    font-size: 11.5px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .up-tb svg { width: 22px; height: 22px; flex: none; }
  .up-tb span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .up-tb:hover { color: var(--up-text, #1e293b); }
  .up-tb[aria-current="page"] { color: var(--up-primary, #4f46e5); font-family: var(--up-font-strong, inherit); }
  .up-tb[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--up-primary, #4f46e5);
  }
  .up-tb .up-tb-pill {
    position: absolute;
    top: 6px;
    inset-inline-start: calc(50% + 6px);
    min-width: 18px;
    padding: 0 5px;
    height: 18px;
    border-radius: 999px;
    background: var(--up-primary, #4f46e5);
    color: #fff;
    font-size: 10.5px;
    line-height: 18px;
    text-align: center;
  }

  /* دکمه‌های شناور دیگر بالاتر از نوار می‌نشینند تا زیر آن نروند */
  html.up-has-tabbar body:not(.up-embed) #geminiChatWidget:not(.is-open) {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* اگر دستیار داخل سایدبار نیست، دکمه‌ی شناورش تکراری است؛ تب «دستیار» همان را باز می‌کند */
  html.up-has-tabbar #upseoCopilot:not(.is-open) .cp-launcher { display: none !important; }
}
