/* ═══════════════════════════════════════════════════════════════════════
   Bottom navigation bar + bottom-sheet (v0.13.0)
   Активна только на <=640px. На десктопе — display: none.
   ═══════════════════════════════════════════════════════════════════════ */

.bottom-nav { display: none; }

.header__title-mobile { display: none; }

@media (max-width: 640px) {
  /* ── Нижняя панель навигации ─────────────────────────────────────────── */
  .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(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 6px rgba(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(--text-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(--primary);
    font-weight: 600;
  }
  .bottom-nav__item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--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: var(--warning);
    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: var(--info); }

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

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

/* ── Bottom-sheet (для «Ещё») — модификатор существующей модалки ──────── */
@media (max-width: 640px) {
  .modal-overlay.modal--sheet {
    align-items: flex-end;
  }
  .modal--sheet .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto;
    max-height: 80vh;
    border-radius: 14px 14px 0 0;
    margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    animation: sheet-slide-up .18s ease;
  }
  @keyframes sheet-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .sheet-list { list-style: none; margin: 0; padding: 0; }
  .sheet-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
  }
  .sheet-list__item:last-child { border-bottom: none; }
  .sheet-list__item:active { background: var(--surface2); }
  .sheet-list__icon { font-size: 20px; width: 24px; text-align: center; }
  .sheet-list__danger { color: var(--danger); }
}
