/* ============================================================
   Workspace Shell — Three-column SPA layout
   ============================================================ */

/* Shell container: full height below header + tab bar */
.workspace-shell {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 65px - 44px); /* header + tab bar heights */
  overflow: hidden;
  background: var(--bg-primary, #0d1117);
}

/* ── AI pane (left) ───────────────────────────────────────── */
.ws-ai-pane {
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

/* Override fixed-position from global-ai-chat.css */
.workspace-shell .scitex-ai-panel.workspace-sidebar {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  height: 100% !important;
  box-shadow: none !important;
  border-right: 1px solid var(--border-default, #30363d) !important;
}

/* ── Worktree pane (middle) ────────────────────────────────── */
.ws-worktree-pane {
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.workspace-shell #ws-worktree-sidebar {
  position: relative;
  height: 100%;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: 250px;
  background: var(--bg-secondary, #161b22);
  border-right: 1px solid var(--border-default, #30363d);
  overflow: visible;
}

.workspace-shell #ws-worktree-sidebar.collapsed {
  width: 40px;
  overflow: hidden;
}

/* ── Module pane (right, flex-grow) ────────────────────────── */
.ws-module-pane {
  flex: 1;
  min-width: 0;
  height: 100%; /* Cap at workspace-shell height — prevents app content from exceeding viewport */
  overflow: auto;
  position: relative;
}

/* Loading indicator */
.ws-module-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  color: var(--text-muted, #8b949e);
  font-size: 0.9rem;
}

/* Worktree sidebar header (expanded/collapsed labels) */
.workspace-shell #ws-worktree-sidebar .sidebar-title-expanded {
  display: none;
}
.workspace-shell #ws-worktree-sidebar:not(.collapsed) .sidebar-title-expanded {
  display: inline;
}
.workspace-shell #ws-worktree-sidebar:not(.collapsed) .sidebar-title {
  display: none;
}

/* Prevent body margin-left from global AI panel fixed-position rules */
body.scitex-ai-present #main-content:has(.workspace-shell) {
  margin-left: 0 !important;
}
body.scitex-ai-open #main-content:has(.workspace-shell) {
  margin-left: 0 !important;
}
