/*
 * App shell: a full-viewport two-column layout for signed-in pages. The sidebar
 * holds navigation and the conversation list; the main pane fills the rest.
 * References tokens from theme.css, so light/dark is automatic.
 */
.app-shell__inner {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}
/* Mobile chrome is hidden on desktop. */
.app-mobile-bar__toggle,
.app-shell__backdrop {
  display: none;
}

/* Sidebar -------------------------------------------------------------- */
.app-sidebar {
  flex: 0 0 16rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem;
  background: var(--color-surface-raised);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}
.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-decoration: none;
  padding: 6px 8px 10px;
}
/* App icon before the "Assistant" wordmark (the SVG carries its own coral fill
   and rounded corners). */
.app-sidebar__brand-mark {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: block;
}
.app-sidebar__new {
  display: block;
  width: 100%;
  text-align: center;
}
.app-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
/* Small square bullet leading each section link (Projects, Memories, Settings). */
.app-sidebar__link::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--color-text-muted);
}
.app-sidebar__link:hover {
  background: var(--color-secondary-hover);
}
.app-sidebar__section-label {
  text-transform: uppercase;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  padding: 14px 11px 6px;
}
/* Scroll region holding the Recent + Archived conversation lists; the brand,
   nav, and footer stay fixed above/below it. */
.app-sidebar__lists {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}
.app-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}
.app-sidebar__conversation {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
}
.app-sidebar__conversation-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-sidebar__conversation:hover {
  background: var(--color-secondary-hover);
}
.app-sidebar__conversation--active {
  background: var(--color-secondary-active);
  font-weight: 600;
}
.app-sidebar__conversation--archived {
  color: var(--color-text-muted);
}
/* "All archived" link below the capped Archived list. */
.app-sidebar__more-link {
  display: block;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-decoration: none;
}
.app-sidebar__more-link:hover {
  color: var(--color-text);
}
.app-sidebar__unread-dot {
  color: var(--color-accent);
  flex: 0 0 auto;
}
.app-sidebar__footer {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.app-sidebar__user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-width: 0;
}
.app-sidebar__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main pane ------------------------------------------------------------ */
.app-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
}
/* Conversation pages: the pane itself doesn't scroll; the page inside manages
   its own regions (slim header / scrolling messages / pinned composer). */
.app-main--conversation {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Narrow screens: the sidebar slides in over a backdrop. */
@media (max-width: 700px) {
  .app-mobile-bar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 30;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: 16rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .app-shell--sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-shell--sidebar-open .app-shell__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.35);
  }

  /* Reserve room for the fixed toggle so scrollable page content isn't hidden
     under it. */
  .app-main {
    padding-top: 3.5rem;
  }
  /* The conversation pane is a fixed-height flex column — a top band would just
     be dead whitespace. Clear the toggle horizontally on the header instead. */
  .app-main--conversation {
    padding-top: 0;
  }
  .app-main--conversation .conversation-view__header {
    padding-left: 3.5rem;
  }
}

/* Honor reduced-motion: don't slide the drawer across the screen. */
@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    transition: none;
  }
}
