/* ──────────────────────────────────────────────────────────────
   Каркас приложения: список чатов + полотно чата.
   Одна разметка на все размеры, меняется только поведение.
   ────────────────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
.app-shell > * { min-height: 0; }

/* ── заставка при запуске ────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg-deep);
  transition: opacity var(--dur-med) var(--ease), visibility var(--dur-med);
}
.boot--done { opacity: 0; visibility: hidden; }

.boot__text {
  font-family: var(--font-display, inherit);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
  animation: boot-in 520ms var(--ease-out) both;
}
@keyframes boot-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── панели ──────────────────────────────────────────────────── */
.sidebar {
  position: relative;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding-top: var(--safe-t);
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.chat-host {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}
.chat-host > .chat-pane { flex: 1; min-height: 0; }

.chat-pane {
  position: relative;
  z-index: var(--z-pane);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

/* мягкие фигуры на фоне полотна — как обои в мессенджере */
.chat-pane::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-color: var(--pattern-ink);
  -webkit-mask-image: url("../assets/bg-shapes.svg");
  mask-image: url("../assets/bg-shapes.svg");
  -webkit-mask-size: 380px 380px;
  mask-size: 380px 380px;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  opacity: .85;
  z-index: 0;
}
.chat-pane > * { position: relative; z-index: 1; }

/* ── мобильная раскладка ─────────────────────────────────────── */
@media (max-width: 860px) {
  .app-shell {
    display: block;
    position: relative;
  }

  .sidebar,
  .chat-host {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-right: 0;
    will-change: transform;
    transition: transform var(--dur-long) var(--ease-out), opacity var(--dur-med) var(--ease);
  }

  .sidebar { transform: translateX(0); }
  .chat-host {
    transform: translateX(100%);
    box-shadow: -12px 0 40px -18px rgba(0, 0, 0, .5);
  }

  /* список чатов */
  [data-view="list"] .sidebar { transform: translateX(0); }
  [data-view="list"] .chat-host { transform: translateX(100%); }

  /* открытый чат */
  [data-view="chat"] .sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
  }
  [data-view="chat"] .chat-host { transform: translateX(0); }
}

@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .sidebar, .chat-host { transition: none; }
}

/* пустое состояние полотна */
.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--text-2);
}
.empty-chat__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 22px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent);
  margin-bottom: 4px;
}
.empty-chat__badge svg { width: 34px; height: 24px; }
.empty-chat h2 { font-size: 1.15em; font-weight: 700; color: var(--text); }
.empty-chat p { font-size: .92em; max-width: 34ch; }
