/* Split grid (frontend/chat/chat-split.js): port of the Control UI's split view
   (ui/src/styles/chat/startup-layout.css split rules, styles/chat/split-view.css,
   components/resizable-divider.ts). Colours map onto the ClawChats theme by meaning. */

.chat-split-view__drop-container {
  position: relative;
  display: flex;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-split-view {
  display: flex;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.chat-split-view__column {
  display: flex;
  flex-direction: column;
  min-width: min(320px, 100%);
  min-height: 0;
}

.chat-split-view__cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 200px;
  overflow: hidden;
}

.chat-split-view--narrow .chat-split-view__cell { min-height: 0; }
.chat-split-view--narrow .chat-split-view__cell--narrow-hidden,
.chat-split-view--narrow .chat-split-view__column--narrow-hidden,
.chat-split-view--narrow .chat-split-view__divider { display: none; }

/* The active cell: the others are desaturated and their header keeps only the title (Control UI hides
   .chat-pane__actions): a click there activates the pane, then its actions show. The page chrome stays.
   Hidden with visibility, so the header keeps its height and nothing moves when the pane activates. */
.chat-split-view.chat-split-view--active-cell > .chat-split-view__column > .chat-split-view__cell:not(.chat-split-view__cell--active) {
  filter: saturate(0.45);
}
.chat-split-view.chat-split-view--active-cell > .chat-split-view__column > .chat-split-view__cell:not(.chat-split-view__cell--active) .chat-pane__header
  :is(.team-bar, .chat-panel-layout-menu, .side-panel-btn, .chat-pane__header-sep) {
  visibility: hidden !important; /* over the layout menu's inline visibility (side-panel.js) */
}

/* The page chrome (sidebar toggle, bell, status) sits in the pane headers as their own items. */
.chat-pane__chrome { display: contents; }
.chat-pane__header .title { min-width: 0; }
/* As tall as the header holding the bell (32px + padding + border), so neighbouring headers line up. */
.chat-pane__header { min-height: 57px; }

/* Divider between columns (vertical) or cells (horizontal): a 6px gutter with a wider hit area and a
   centred hairline that thickens on hover, drag and keyboard focus (resizable-divider.ts). */
.chat-split-view__divider {
  position: relative;
  flex: 0 0 var(--resize-handle-size, 6px);
  width: var(--resize-handle-size, 6px);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
.chat-split-view__divider::before {
  content: "";
  position: absolute;
  inset: 0 -4px;
}
.chat-split-view__divider::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--border-color);
  transition: background 150ms ease-out, width 150ms ease-out;
}
.chat-split-view__divider:hover::after,
.chat-split-view__divider.dragging::after,
.chat-split-view__divider:focus-visible::after {
  width: 2px;
  background: currentColor;
}
.chat-split-view__divider:focus-visible { outline: 2px solid var(--text-muted); outline-offset: 2px; }
.chat-split-view__divider[data-orientation="horizontal"] {
  flex-basis: var(--resize-handle-size, 6px);
  width: auto;
  height: var(--resize-handle-size, 6px);
  cursor: row-resize;
}
.chat-split-view__divider[data-orientation="horizontal"]::before { inset: -4px 0; }
.chat-split-view__divider[data-orientation="horizontal"]::after {
  top: 50%;
  bottom: auto;
  left: 0;
  right: 0;
  width: auto;
  height: 1px;
  transform: translateY(-50%);
  transition: background 150ms ease-out, height 150ms ease-out;
}
.chat-split-view__divider[data-orientation="horizontal"]:hover::after,
.chat-split-view__divider[data-orientation="horizontal"].dragging::after,
.chat-split-view__divider[data-orientation="horizontal"]:focus-visible::after {
  width: auto;
  height: 2px;
}
body.chat-split-resizing { user-select: none; }
body.chat-split-resizing--col { cursor: col-resize; }
body.chat-split-resizing--row { cursor: row-resize; }
body.chat-split-resizing iframe { pointer-events: none; }

/* Where a chat dragged from the sidebar would go (Control UI split-view.css): half the cell on an
   edge ("Split"), or an outline round the whole cell ("Open here"). */
.chat-split-view__drop-indicator {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--accent-color) 65%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-color) 14%, transparent);
}
.chat-split-view__drop-indicator--center {
  border-color: transparent;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--accent-color);
}
.chat-split-view__drop-indicator-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 3px 10px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  .chat-split-view__drop-indicator {
    animation: chat-drop-indicator-in 0.12s ease;
    transition: left 0.14s ease, top 0.14s ease, width 0.14s ease, height 0.14s ease, opacity 0.12s ease;
  }
  @keyframes chat-drop-indicator-in { from { opacity: 0; } to { opacity: 1; } }
}
/* The split buttons show per layout (chat-split.js _syncSplitControls); .side-panel-btn sets display. */
.chat-pane__header .side-panel-btn[hidden] { display: none; }
/* The header's buttons keep their size; the title and tags give way (Control UI .chat-pane__header-trailing). */
.chat-pane__header :is(.side-panel-btn, .chat-panel-layout-menu) { flex-shrink: 0; }
/* Separates the side panel toggle from the split buttons; gone when no split button shows. */
.chat-pane__header-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border-color); flex: none; }
.chat-pane__header-sep:not(:has(~ .side-panel-btn:not([hidden]))) { display: none; }
