/* ── APP ─────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-primary);
  opacity: 0;
  transform: scale(1.01);
}
#app.visible {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ── SIDEBAR ─────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  flex-shrink: 0;
  z-index: 100;
}
.sidebar-top { padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px; margin-bottom: 2px; }

.chats-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chats-list::-webkit-scrollbar { width: 4px; }
.chats-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-bottom { padding: 8px 8px 10px; border-top: 1px solid var(--border); }

/* ── SIDEBAR OVERLAY ─────────────────────────── */
#sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── MAIN ────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  position: relative;
  background: var(--bg-primary);
}

/* ── TOP BAR ─────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 8px;
  position: relative;
  z-index: 10;
}
.topbar-actions { display: flex; gap: 4px; }

/* ── CHAT AREA ───────────────────────────────── */
#chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#chat-area::-webkit-scrollbar { width: 6px; }
#chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* ── WELCOME ─────────────────────────────────── */
#welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 24px;
  text-align: center;
}
.welcome-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 32px;
  letter-spacing: -0.02em;
}

/* ── MESSAGES ────────────────────────────────── */
#messages { display: none; padding: 20px 0 8px; }
#messages.visible { display: block; }

.message-group { max-width: 680px; margin: 0 auto; padding: 0 24px; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    transform: translateX(-100%);
    z-index: 200;
  }
  #sidebar.open { transform: translateX(0); }
  .welcome-title { font-size: 22px; }
  .topbar { padding: 8px 12px; }
  .message-group { padding: 0 16px; }
}
