/* ============================================================
   УТИЛИТЫ
   ============================================================ */
.mobile-only { display: none; }

/* ============================================================
   МОБИЛЬНЫЙ АДАПТИВ (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .app-container {
    position: relative;
    overflow: hidden;
  }

  /* ── Таббар ──────────────────────────────────────────────── */
  .sidebar-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 200;
    justify-content: space-between;
    align-items: center;
  }

  .nav-top {
    flex-direction: row;
    flex: 1;
    justify-content: space-evenly;
    padding: 0;
    align-items: center;
  }

  .nav-bottom {
    flex-direction: row;
    gap: 0;
    padding: 0;
    align-items: center;
  }

  /* Кнопки навигации в таббаре */
  .nav-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
  }

  /* Скрываем: логотип, changelog, настройки (они дублируются в профиле) */
  .nav-logo,
  #changelog-btn,
  #nav-settings {
    display: none;
  }

  /* Аватар-кнопка профиля — выравниваем с иконками */
  .nav-avatar {
    width: 34px;
    height: 34px;
  }

  /* Dropdown профиля — прямо над кнопкой аватара, у правого края */
  .user-menu { position: relative; }

  .user-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    right: -4px;
    left: auto;
    transform: none;
    width: 240px;
    max-width: calc(100vw - 16px);
    border-radius: var(--r-lg);
    box-shadow: 0 -2px 20px rgba(0,0,0,0.12);
  }

  /* ── Панели контента и чата ──────────────────────────────── */
  .content-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    width: 100%;
    z-index: 100;
    transform: translateX(0);
    transition: transform 0.25s ease;
  }

  .content-panel.mobile-hidden {
    transform: translateX(-100%);
    pointer-events: none;
  }

  .chat-area {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    z-index: 110;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    background: var(--bg);
  }

  .chat-area.mobile-visible {
    transform: translateX(0);
  }

  /* ── Правая панель — слайд снизу ─────────────────────────── */
  .right-panel {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    z-index: 150;
  }

  /* ── Сообщения ───────────────────────────────────────────── */
  .msg-group { max-width: 85%; }

  /* ── Мобильные кнопки ────────────────────────────────────── */
  .mobile-only { display: flex; }

  /* Шапка чата — скрываем инфо-кнопку, она не нужна на мобильных */
  #chat-info-btn { display: none; }

  /* Поле ввода — чуть меньше отступы */
  .input-zone { padding: 8px 12px 10px; }

  /* Модалки — занимают почти весь экран */
  .modal-box {
    margin: 12px;
    max-width: calc(100vw - 24px);
    border-radius: var(--r-xl);
  }

  /* Шапка панели — крестик закрытия виден только на мобильных */
  #close-panel-btn { display: flex; }
}

/* ── Маленькие телефоны (≤480px) ──────────────────────────── */
@media (max-width: 480px) {
  .msg-group { max-width: 92%; }

  .auth-wrapper { padding: 16px; }
  .auth-card    { padding: 20px 16px; }
  .field-row    { grid-template-columns: 1fr; }

  /* Таббар чуть выше для маленьких экранов */
  .sidebar-nav  { height: 58px; }
  .content-panel,
  .chat-area    { bottom: 58px; }
  .right-panel  { bottom: 58px; }

  .nav-btn      { width: 40px; height: 40px; }
}

/* ── Планшет (769px–1024px) ───────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar-nav {
    width: 52px;
    padding: 12px 6px;
  }

  .nav-btn svg { width: 19px; height: 19px; }

  .content-panel { width: 260px; }

  .right-panel   { width: 220px; }

  .msg-group     { max-width: 75%; }
}
