/* responsive.css — адаптивность для Telephon
   Подключить ПОСЛЕДНИМ в index-full.html:
   <link rel="stylesheet" href="responsive.css">
*/

/* ════════════════════════════════════════════════════════════
   ПЛАНШЕТ  768px – 1024px
════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* Сужаем левую панель */
  .sidebar {
    min-width: 260px !important;
    max-width: 300px !important;
  }

  /* Панель профиля справа скрывается */
  .profile-panel,
  .right-panel {
    display: none;
  }
}

/* ════════════════════════════════════════════════════════════
   МОБИЛЬНЫЙ  < 768px
════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Главный экран: одна колонка ── */
  #main-screen {
    flex-direction: column !important;
  }

  /* ── Боковая панель — занимает весь экран, скрывается когда открыт чат ── */
  .sidebar {
    width: 100vw !important;
    min-width: unset !important;
    max-width: unset !important;
    height: 100vh;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.25s ease;
  }

  /* Когда открыт чат — сдвигаем сайдбар влево */
  body.chat-open .sidebar {
    transform: translateX(-100%);
  }

  /* ── Область чата — весь экран ── */
  .chat-area,
  .main-content {
    width: 100vw !important;
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  body.chat-open .chat-area,
  body.chat-open .main-content {
    transform: translateX(0);
  }

  /* ── Кнопка «назад» в хедере чата ── */
  .chat-header-back {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    background: none;
    border: none;
    margin-right: 8px;
    flex-shrink: 0;
  }

  /* На десктопе прячем кнопку назад */
  .chat-header-back {
    display: none;
  }

  /* ── Нижний навбар (таббар) ── */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 200;
    justify-content: space-around;
    align-items: center;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-secondary);
    transition: color 0.2s;
  }

  .bottom-nav-item.active,
  .bottom-nav-item:hover {
    color: var(--gradient-start);
  }

  .bottom-nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
  }

  /* ── Убираем боковые таббы (они в нижнем навбаре) ── */
  .nav-tabs,
  .sidebar-tabs {
    display: none !important;
  }

  /* ── Сайдбар — паддинг снизу под таббар ── */
  .sidebar {
    padding-bottom: 56px;
  }

  /* ── Чат — паддинг снизу под таббар ── */
  .chat-area,
  .main-content {
    padding-bottom: 56px;
  }

  /* ── Инпут сообщений — адаптируем ── */
  .message-input-area,
  .input-area {
    padding: 8px;
    gap: 8px;
  }

  .message-input,
  #message-input {
    font-size: 16px; /* предотвращаем зум на iOS */
  }

  /* ── Модальные окна ── */
  .modal-content,
  .modal-box {
    width: 95vw !important;
    max-width: unset !important;
    margin: 0 auto;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* ── Auth экран ── */
  .auth-container {
    width: 95vw !important;
    padding: 28px 20px !important;
    border-radius: 16px;
  }

  /* ── Звонок — на весь экран ── */
  #call-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  /* ── Шапка чата ── */
  .chat-header {
    padding: 10px 12px;
  }

  .chat-header-title {
    font-size: 15px;
  }

  /* ── Сообщения — уже пузыри ── */
  .message-bubble {
    max-width: 85% !important;
  }

  /* ── Список чатов — крупнее тап-зона ── */
  .chat-item,
  .user-item {
    min-height: 60px;
    padding: 10px 14px;
  }

  /* ── Скрываем ресайз-хэндл панели ── */
  .resize-handle {
    display: none !important;
  }

  /* ── Профиль — одна колонка ── */
  .profile-grid,
  .profile-columns {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }

  /* ── Сообщение о том что чат не выбран — скрываем на мобиле ── */
  .no-chat-selected {
    display: none !important;
  }
}

/* ════════════════════════════════════════════════════════════
   ОЧЕНЬ МАЛЕНЬКИЙ ЭКРАН  < 360px
════════════════════════════════════════════════════════════ */
@media (max-width: 359px) {
  .auth-header h1 {
    font-size: 36px;
  }

  .auth-container {
    padding: 20px 14px !important;
  }

  .bottom-nav-item .nav-label {
    display: none;
  }
}

/* ════════════════════════════════════════════════════════════
   JS-ХУКИ — добавляются через app.js:
   - body.chat-open    когда открыт чат
   - .bottom-nav       нижний навбар (рендерится в HTML)
   - .chat-header-back кнопка назад (рендерится в HTML)
════════════════════════════════════════════════════════════ */
