/* ── Carbon UI Shell  -  shared layout + navigation component ─── */

/* ── Shell header (always dark  -  both light and dark themes) ── */
.shell-header {
  height: 3rem; flex-shrink: 0;
  background: var(--gray-100, #161616);
  border-bottom: 1px solid var(--gray-80, #393939);
  display: flex; align-items: center;
  z-index: 100;
}
.shell-hamburger {
  width: 3rem; height: 3rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--gray-10, #f4f4f4);
  transition: background 0.1s;
}
.shell-hamburger:hover { background: var(--gray-80, #353535); }
.shell-brand {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0 1rem; height: 100%;
  text-decoration: none; color: var(--gray-10, #f4f4f4);
  border-right: 1px solid var(--gray-80, #393939);
}
.shell-brand-name { font-size: 0.875rem; color: var(--gray-10, #f4f4f4); white-space: nowrap; }
.shell-brand-name .brand-prefix  { font-weight: 300; color: rgba(244,244,244,0.85); }
.shell-brand-name .brand-product { font-weight: 600; color: var(--text-on-color, #fff); }
.shell-header-right { margin-left: auto; display: flex; align-items: center; height: 100%; }
.shell-icon-btn {
  width: 3rem; height: 3rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--gray-10, #f4f4f4);
  transition: background 0.1s;
}
.shell-icon-btn:hover { background: var(--gray-80, #353535); }
.shell-user-avatar {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--blue-60, #0f62fe); color: var(--text-on-color, #fff);
  font-size: 0.75rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.shell-user-avatar svg { width: 14px; height: 14px; }

/* ── User dropdown ──────────────────────────────────────────── */
.shell-user-btn-wrap { position: relative; }
.shell-user-dropdown {
  position: absolute; top: calc(100% + 4px); right: 0;
  width: 220px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 200;
}
.shell-dropdown-user {
  padding: 0.75rem 1rem 0.625rem;
}
.shell-dropdown-email {
  font-size: 0.75rem; color: var(--text-secondary);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shell-dropdown-divider { height: 1px; background: var(--border); margin: 0; }
.shell-dropdown-item {
  display: flex; align-items: center; gap: 0.625rem;
  width: 100%; padding: 0.625rem 1rem;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 0.875rem; text-decoration: none;
  transition: background 0.1s; text-align: left;
}
.shell-dropdown-item:hover { background: var(--hover-bg, rgba(0,0,0,0.06)); color: var(--text); }
html.dark .shell-dropdown-item:hover { background: rgba(255,255,255,0.08); }
.shell-dropdown-item svg { flex-shrink: 0; color: var(--text-secondary); }

/* ── Body row: sidenav + main content ─────────────────────── */
.shell-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* Every <main> inside the shell scrolls independently by default.
   Pages that manage their own internal scroll (e.g. chat, agents)
   override overflow via their own class selector. */
.shell-body > main { flex: 1; min-height: 0; overflow-y: auto; }

/* ── Left SideNav ──────────────────────────────────────────── */
.shell-sidenav {
  width: 256px; flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-x: hidden; overflow-y: auto;
  padding: 0.5rem 0;
  white-space: nowrap;
  transition: width 0.2s cubic-bezier(0.2, 0, 0.38, 0.9);
}
.shell-nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 400;
  color: var(--text-secondary); text-decoration: none;
  border-left: 4px solid transparent;
  transition: background 0.1s, color 0.1s, padding 0.2s, gap 0.2s;
}
.shell-nav-link svg { flex-shrink: 0; }
.shell-nav-link:hover { background: rgba(141,141,141,.12); color: var(--text); }
.shell-nav-link.active { border-left-color: var(--blue-60); background: rgba(15,98,254,.1); color: var(--blue-60); font-weight: 500; }
html.dark .shell-nav-link:hover { background: rgba(255,255,255,.08); color: var(--text); }
html.dark .shell-nav-link.active { border-left-color: var(--blue-40); background: rgba(120,169,255,.1); color: var(--blue-40); }
.shell-nav-label { overflow: hidden; }
.shell-nav-divider { height: 1px; background: var(--border); margin: 0.5rem 0; }

/* ── Collapsed sidenav  -  icon-only rail ────────────────────── */
/* Reserve 3rem via padding so content never shifts on hover */
.shell-body.nav-collapsed { position: relative; padding-left: 3rem; }
.shell-body.nav-collapsed .shell-sidenav {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3rem; z-index: 50;
  overflow: hidden;
}
.shell-body.nav-collapsed .shell-nav-link { padding: 0.75rem 0; justify-content: center; gap: 0; }
.shell-body.nav-collapsed .shell-nav-label { width: 0; opacity: 0; }

/* ── Hover-to-expand: overlays content, nothing shifts ─────── */
.shell-body.nav-collapsed .shell-sidenav:hover {
  width: 256px;
  box-shadow: 4px 0 16px rgba(0,0,0,0.12);
}
html.dark .shell-body.nav-collapsed .shell-sidenav:hover { box-shadow: 4px 0 16px rgba(0,0,0,0.35); }
.shell-body.nav-collapsed .shell-sidenav:hover .shell-nav-link { padding: 0.75rem 1rem; justify-content: flex-start; gap: 0.75rem; }
.shell-body.nav-collapsed .shell-sidenav:hover .shell-nav-label { width: auto; opacity: 1; }

/* ── Settings modal (shared) ────────────────────────────────── */
.settings-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.settings-box { background: var(--panel-bg); border: 1px solid var(--border); width: 520px; max-width: 95vw; height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.settings-box-head { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.settings-content { overflow-y: auto; padding: 1.5rem; background: var(--panel-bg); }
.settings-foot { border-top: 1px solid var(--border); padding: 0.875rem 1.5rem; display: flex; justify-content: flex-end; flex-shrink: 0; background: var(--panel-bg); }
