/* ═══════════════════════════════════════════════════════════
   LAYOUT — Sidebar + Main 2-panel structure
   ═══════════════════════════════════════════════════════════ */

/* ── App shell ───────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  transition: transform var(--duration-med) var(--ease-out-expo);
}

.sidebar-header {
  padding: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-dark);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 1.2rem;
  color: #ffffff;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-1);
}

.sidebar-logo-sub {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.sidebar-actions {
  padding: var(--space-4) var(--space-6);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-6);
}

.sidebar-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-dark);
}

/* ── Mobile sidebar scrim ────────────────────────────────── */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--duration-med) ease;
  pointer-events: none;
}

.sidebar-scrim.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Main content ────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: var(--bg-primary);
}

/* ── Chat header ─────────────────────────────────────────── */
.chat-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  z-index: 50;
}

.chat-header .header-title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 0.9rem;
  letter-spacing: var(--tracking-tight);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) ease;
}

.menu-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ── Welcome section ─────────────────────────────────────── */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  overflow-y: auto;
  gap: var(--space-10);
}

/* ── Chat section ────────────────────────────────────────── */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8) var(--space-8);
  padding-bottom: var(--space-4);
  /* scroll-behavior: smooth — disabled, causes Firefox perf issues during streaming */
}

/* ── Input bar ───────────────────────────────────────────── */
.input-bar {
  padding: var(--space-4) 0 var(--space-6);
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  transition: border-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease;
  min-height: 48px;
  max-height: 160px;
}

.input-wrapper:focus-within {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.input-wrapper textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 140px;
  overflow-y: auto;
  padding: var(--space-1) 0;
}

.btn-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-normal) var(--ease-out-expo),
              opacity var(--duration-normal) ease;
  opacity: 0.3;
  flex-shrink: 0;
}

.btn-send.active {
  opacity: 1;
}

.btn-send.active:hover {
  transform: scale(1.08);
}

.btn-send svg {
  width: 18px;
  height: 18px;
}

/* ── Utility: hidden ─────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Health indicator ────────────────────────────────────── */
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.health-dot.online {
  background: var(--confidence-high);
  box-shadow: 0 0 6px rgba(45, 138, 78, 0.4);
}

.health-dot.offline {
  background: var(--confidence-low);
}
