/* ═══════════════════════════════════════════════════════════════════════
   Bottom navigation bar для мобильных (<= 640px).
   На десктопе — скрыт. Каркас навеян tmk v0.13.0, адаптирован под tmm.
   ═══════════════════════════════════════════════════════════════════════ */

.bottom-nav { display: none; }
.header__title-mobile { display: none; }

@media (max-width: 640px) {
  /* На мобиле прячем верхнюю навигацию (центральная часть шапки)
     и dropdown'ы — навигация уезжает в нижнюю панель. */
  .header__nav { display: none !important; }
  .header__user .nav-dropdown { display: none !important; }

  /* Мобильный заголовок раздела — слева, тапается, сворачивает тулбар. */
  .header__title-mobile {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-fg);
    cursor: pointer;
    padding: 0 6px;
    min-height: 48px;
    user-select: none;
  }
  .header__title-mobile__chevron {
    font-size: 12px;
    color: var(--color-fg-muted);
    transition: transform 0.15s;
  }
  .header__title-mobile[aria-expanded="false"] .header__title-mobile__chevron {
    transform: rotate(-90deg);
  }
  #main.toolbar-collapsed .toolbar,
  #main.toolbar-collapsed .filters {
    display: none !important;
  }

  /* Контейнеру даём место под нижним баром, чтобы контент не уезжал. */
  #main {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  /* ── Нижняя панель навигации ───────────────────────────────────────── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-card, #fff);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06);
  }
  .bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    line-height: 1;
    color: var(--color-fg-muted);
    cursor: pointer;
    padding: 6px 0;
    position: relative;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  .bottom-nav__item.active {
    color: var(--color-primary);
    font-weight: 600;
  }
  .bottom-nav__item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--color-primary);
    border-radius: 0 0 2px 2px;
  }
  .bottom-nav__icon {
    font-size: 20px;
    line-height: 1;
    position: relative;
  }
  .bottom-nav__label {
    font-size: 11px;
    line-height: 1;
  }
  .bottom-nav__badge {
    position: absolute;
    top: -4px;
    right: -10px;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .bottom-nav__badge[hidden] { display: none; }
  .bottom-nav__badge--info { background: #3b82f6; }
}

/* ── Bottom-sheet «Ещё» — лист снизу со ссылками админки/профиля ───── */
@media (max-width: 640px) {
  .bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: stretch;
  }
  .bottom-sheet {
    background: var(--color-card, #fff);
    border-radius: 12px 12px 0 0;
    width: 100%;
    padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px)) 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18);
  }
  .bottom-sheet__handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-border);
    margin: 6px auto 12px;
  }
  .bottom-sheet__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    font-size: 15px;
    color: var(--color-fg);
    border-top: 1px solid var(--color-border);
    cursor: pointer;
    background: transparent;
    width: 100%;
    text-align: left;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .bottom-sheet__item:first-child { border-top: none; }
  .bottom-sheet__item:hover { background: var(--color-bg, #f9fafb); }
  .bottom-sheet__item__icon { font-size: 20px; }
}
