/* نوار ناوبری پایین — فقط موبایل و تبلت (≤۱۰۲۴px)؛ در دسکتاپ منوی همبرگری */
.tabbar,
.tabbar-sheet {
  display: none;
}

@media (max-width: 1024px) {
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 150;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(74, 31, 150, 0.08);
  }

  /* خط نازک گرادیان لوگو بالای نوار */
  .tabbar::before {
    content: "";
    position: absolute;
    top: -1px;
    right: 18%;
    left: 18%;
    height: 2px;
    border-radius: 2px;
    background: var(--grad);
    opacity: 0.6;
  }

  body.has-tabbar {
    padding-bottom: calc(52px + env(safe-area-inset-bottom));
  }

  /* منوی همبرگری و فوتر در موبایل/تبلت جای خود را به نوار پایین می‌دهند */
  body.has-tabbar .menu-toggle,
  body.has-tabbar #footer,
  body.has-tabbar .page-footer,
  body.has-tabbar .page-nav {
    display: none;
  }

  .tabbar-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 40px;
    padding: 0;
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .tabbar-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    font-size: 16px;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .tabbar-label {
    display: block;
    height: 11px;
    font-size: 10px;
    font-weight: 600;
    line-height: 11px;
  }

  .tabbar-item[aria-current="page"] {
    color: var(--brand);
  }

  .tabbar-item[aria-current="page"] .tabbar-icon {
    background: linear-gradient(135deg, rgba(47, 208, 255, 0.18), rgba(153, 101, 253, 0.22), rgba(255, 1, 255, 0.14));
    transform: translateY(-1px);
  }

  .tabbar-item[aria-current="page"] .tabbar-label {
    font-weight: 800;
  }

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

  .tabbar-item:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: -2px;
    border-radius: 12px;
  }

  /* برگه‌ی «بیشتر» از پایین بالا می‌آید */
  .tabbar-sheet:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 149;
    display: block;
  }

  .tabbar-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 8, 45, 0.35);
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .tabbar-sheet-panel {
    position: absolute;
    right: 8px;
    bottom: calc(58px + env(safe-area-inset-bottom));
    left: 8px;
    padding: 8px 10px 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    box-shadow: 0 -8px 30px rgba(74, 31, 150, 0.18);
    transform: translateY(24px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  }

  .tabbar-sheet.is-open .tabbar-sheet-backdrop { opacity: 1; }
  .tabbar-sheet.is-open .tabbar-sheet-panel { transform: none; opacity: 1; }

  .tabbar-sheet-grip {
    display: block;
    width: 38px;
    height: 4px;
    margin: 2px auto 8px;
    border-radius: 4px;
    background: var(--border);
  }

  .tabbar-sheet ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .tabbar-sheet a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 6px 10px;
    border-radius: 14px;
    color: var(--brand-ink);
    text-decoration: none;
  }

  .tabbar-sheet a:active,
  .tabbar-sheet a:hover {
    background: var(--brand-soft);
  }

  .tabbar-sheet a i {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 14px;
  }

  .tabbar-sheet strong {
    display: block;
    font-size: 13.5px;
  }

  .tabbar-sheet small {
    display: block;
    font-size: 11px;
    color: var(--muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tabbar-icon, .tabbar-sheet-panel, .tabbar-sheet-backdrop { transition: none; }
}
