/* ======================================================================
   CASSIN AI — SHARED SIDEBAR STYLES
   Loaded by every internal HTML page that includes the standard sidebar.
   Pairs with /sidebar.js.
   ====================================================================== */

/* --- Sidebar shell -------------------------------------------------------- */
/* Layout strategy (fixes the "Recommendation Review moves when Brain Commands
   expands" bug): the sidebar is a fixed-height flex column that does NOT
   scroll. The nav fills the available middle space and scrolls INTERNAL-
   LY when its content overflows. The Brain Commands section sits at the
   bottom and never pushes the nav. Brand and footer never shrink.

   Note: each HTML page has its own INLINE `.sidebar` styles that would
   normally win the cascade. The `!important` markers below force the
   layout fix through. (Cleaner long-term: strip the inline sidebar
   styles from every page so this stylesheet is the only source.) */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w, 260px);
  height: 100vh;
  background: #0f1628;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;            /* the sidebar itself never scrolls */
}
.sidebar-brand {
  padding: 22px 22px 16px;
  border-bottom: 1px solid #1e2d45;
  flex-shrink: 0 !important;             /* never shrink */
}
.sidebar-brand-name { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.sidebar-brand-name span { color: #67e8f9; }
.sidebar-brand-sub { font-size: 10px; font-weight: 700; color: #3a5070; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav {
  padding: 10px 0;
  flex: 1 1 0 !important;                /* fill the middle */
  min-height: 0 !important;              /* allow shrinking so overflow-y: auto works */
  overflow-y: auto !important;           /* scroll internally when nav is taller than the slot */
}
.sidebar-section-label {
  padding: 14px 20px 6px;
  font-size: 9px; font-weight: 700; color: #3a5070; letter-spacing: 1px; text-transform: uppercase;
}
.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 22px; color: #7a8fb0; font-size: 13px; font-weight: 600;
  text-decoration: none; border-left: 3px solid transparent; transition: all 0.15s;
}
.sidebar-link:hover { color: #c7d8f0; background: rgba(255,255,255,0.04); }
.sidebar-link.active { color: #67e8f9; background: rgba(103,232,249,0.08); border-left-color: #67e8f9; }
.sidebar-link i { font-size: 15px; }
.sidebar-footer {
  padding: 14px 22px;
  border-top: 1px solid #1e2d45;
  font-size: 10px; color: #3a5070;
  flex-shrink: 0 !important;             /* never shrink */
}

/* --- Brain Commands section --------------------------------------------- */
.sidebar-commands {
  padding: 8px 16px 14px;
  border-top: 1px solid #1e2d45;
  flex-shrink: 0 !important;             /* sits at the bottom at its content height */
}
.sidebar-commands-label {
  font-size: 9px; font-weight: 700; color: #3a5070; letter-spacing: 1px; text-transform: uppercase;
  padding: 8px 4px 6px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.sidebar-commands-label:hover { color: #67e8f9; }
.sidebar-commands-label .chev {
  font-size: 11px; color: #3a5070;
  transition: transform 0.25s ease, color 0.15s;
}
.sidebar-commands-label[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sidebar-commands-label:hover .chev { color: #67e8f9; }
.sidebar-commands-body {
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
}
.sidebar-commands.collapsed .sidebar-commands-body { max-height: 0; opacity: 0; }
.sidebar-cmd {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; margin-bottom: 4px;
  background: #0a1020; border: 1px solid #1e2d45; border-radius: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 11px; color: #c4b5fd;
  cursor: pointer; transition: all 0.15s;
}
.sidebar-cmd:hover { background: #131c30; border-color: #67e8f9; color: #fff; }
.sidebar-cmd i.cmd-icon { font-size: 12px; color: #67e8f9; flex-shrink: 0; }
.sidebar-cmd .cmd-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-cmd .copy-hint { font-size: 9px; color: #3a5070; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.sidebar-cmd:hover .copy-hint { opacity: 1; }
.sidebar-cmd-sub { font-size: 10px; color: #3a5070; padding: 4px 8px 8px; line-height: 1.4; }

/* --- Mobile: hide sidebar, remove its left margin ----------------------- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main, .topnav { margin-left: 0 !important; }
}
