/**
 * JUQOR — App Layout v2
 * 2 colunas (Telegram/WhatsApp Web) no desktop
 * 1 coluna com swap no mobile
 */

/* ══════════════════════════════════════
   CONTAINER PRINCIPAL
   ══════════════════════════════════════ */
#app {
  flex-direction: row !important;
  background: var(--bg0);
}

/* Sidebar — lista unificada */
#sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg1);
  flex-shrink: 0;
  border-right: 1px solid var(--b1);
}

/* Chat view — painel da direita */
.chat-view {
  display: none;
  flex-direction: column;
  height: 100%;
  background: var(--chat-bg);
  flex: 1;
  position: relative;
}
.chat-view.active { display: flex; }

/* Empty state desktop */
.chat-empty {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  background: var(--chat-bg);
}
.chat-empty-icon {
  width: 120px; height: 120px;
  border-radius: 30px;
  background: var(--bg2);
  border: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--t3);
}
.chat-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--t0);
  margin-bottom: 6px;
}
.chat-empty-sub {
  font-size: 13px;
  color: var(--t3);
  max-width: 300px;
  line-height: 1.5;
}
.chat-empty-e2e {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--a3);
  border-radius: var(--r-full);
  font-size: 10px;
  color: var(--a);
  font-weight: 600;
  letter-spacing: .5px;
}

/* ══════════════════════════════════════
   MOBILE (< 768px): 1 coluna com swap
   ══════════════════════════════════════ */
@media (max-width: 767px) {
  #sidebar {
    width: 100%;
    border-right: none;
  }
  .chat-view {
    position: absolute;
    inset: 0;
    z-index: 5;
    width: 100%;
  }
  .chat-empty { display: none !important; }

  /* Quando chat ativo, esconder sidebar */
  #app.chat-open #sidebar { display: none; }
}

/* ══════════════════════════════════════
   DESKTOP (>= 768px): 2 colunas lado a lado
   ══════════════════════════════════════ */
@media (min-width: 768px) {
  #sidebar {
    width: var(--sidebar-w);
    max-width: var(--sidebar-w);
  }
  .chat-view { position: relative; }

  /* Sem chat ativo → mostra empty state */
  #app:not(.chat-open) .chat-empty { display: flex; }
  #app:not(.chat-open) .chat-view { display: none; }

  /* No desktop, botão back do chat-header vira X de fechar */
  .chat-back-btn.desktop-close svg { transform: rotate(45deg); }
}

/* ══════════════════════════════════════
   DESKTOP GRANDE (>= 1280px): sidebar maior
   ══════════════════════════════════════ */
@media (min-width: 1280px) {
  :root { --sidebar-w: 380px; }
}
