/* ---- Pane Tree Layout ---- */

.pane-branch {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.pane-branch-vertical {
  flex-direction: row;
}

.pane-branch-horizontal {
  flex-direction: column;
}

.pane-slot {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ---- Resize Handles ---- */

.pane-resize-handle {
  flex: 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: var(--bg-secondary);
}

.pane-resize-vertical {
  cursor: col-resize;
  width: 4px;
}

.pane-resize-horizontal {
  cursor: row-resize;
  height: 4px;
}

.pane-resize-handle::after {
  content: "";
  background: var(--border);
}

.pane-resize-vertical::after {
  width: 1px;
  height: 100%;
}

.pane-resize-horizontal::after {
  height: 1px;
  width: 100%;
}

.pane-resize-handle:hover::after {
  background: var(--accent);
}

/* ---- Pane Group (leaf container) ---- */

.pane-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.pane-group-active {
  box-shadow: inset 2px 0 0 var(--accent);
}

.pane-drop-hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.pane-branch-horizontal > .pane-slot > .pane-group.pane-group-active {
  box-shadow: inset 0 2px 0 var(--accent);
}

.pane-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ---- Mini Tab Bar (auto-show when 2+ tabs) ---- */

.pane-tab-bar {
  display: flex;
  gap: 1px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  height: 28px;
  align-items: stretch;
}

.pane-tab-bar::-webkit-scrollbar {
  display: none;
}

.pane-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: transparent;
  border: none;
  color: var(--fg-secondary);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  max-width: 150px;
}

.pane-tab:hover {
  background: var(--bg-highlight);
}

.pane-tab-active {
  color: var(--fg-primary);
  background: var(--bg-primary);
  border-bottom: 2px solid var(--accent);
}

.pane-tab-repo-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.pane-tab-repo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pane-tab-repo-name {
  font-size: 9px;
  color: var(--fg-muted);
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-tab-promote {
  opacity: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--fg-muted);
  transition: opacity 0.1s, color 0.1s;
}

.pane-tab:hover .pane-tab-promote {
  opacity: 0.5;
}

.pane-tab:hover .pane-tab-promote:hover {
  opacity: 1;
  color: var(--fg-primary);
}

.pane-tab-promoted {
  opacity: 1 !important;
  color: var(--accent);
}

.pane-tab-globe {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  opacity: 0.8;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  transition: opacity 0.1s;
}

.pane-tab-globe:hover {
  opacity: 1;
}

.pane-tab-close {
  opacity: 0;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pane-tab:hover .pane-tab-close {
  opacity: 0.6;
}

.pane-tab-close:hover {
  opacity: 1 !important;
  background: var(--bg-highlight);
}

/* ---- Tab type coloring (mirrors main TabBar) ---- */

.pane-tab-diff {
  background: linear-gradient(to bottom, rgba(var(--tab-diff-rgb), 0.1), rgba(var(--tab-diff-rgb), 0.05));
  border-bottom: 2px solid rgba(var(--tab-diff-rgb), 0.3);
}
.pane-tab-diff:hover {
  background: linear-gradient(to bottom, rgba(var(--tab-diff-rgb), 0.15), rgba(var(--tab-diff-rgb), 0.08));
}
.pane-tab-diff.pane-tab-active {
  background: linear-gradient(to bottom, rgba(var(--tab-diff-rgb), 0.25), rgba(var(--tab-diff-rgb), 0.15));
  border-bottom-color: rgb(var(--tab-diff-rgb));
}

.pane-tab-edit {
  background: linear-gradient(to bottom, rgba(var(--tab-edit-rgb), 0.1), rgba(var(--tab-edit-rgb), 0.05));
  border-bottom: 2px solid rgba(var(--tab-edit-rgb), 0.3);
}
.pane-tab-edit:hover {
  background: linear-gradient(to bottom, rgba(var(--tab-edit-rgb), 0.15), rgba(var(--tab-edit-rgb), 0.08));
}
.pane-tab-edit.pane-tab-active {
  background: linear-gradient(to bottom, rgba(var(--tab-edit-rgb), 0.25), rgba(var(--tab-edit-rgb), 0.15));
  border-bottom-color: var(--accent);
}

.pane-tab-md {
  background: linear-gradient(135deg, rgba(var(--tab-md-rgb), 0.1), rgba(var(--tab-md-rgb), 0.05));
  border-bottom: 2px solid rgba(var(--tab-md-rgb), 0.3);
}
.pane-tab-md:hover {
  background: linear-gradient(135deg, rgba(var(--tab-md-rgb), 0.15), rgba(var(--tab-md-rgb), 0.08));
}
.pane-tab-md.pane-tab-active {
  background: linear-gradient(135deg, rgba(var(--tab-md-rgb), 0.2), rgba(var(--tab-md-rgb), 0.1));
  border-bottom-color: #22c55e;
}

.pane-tab-panel {
  background: linear-gradient(135deg, rgba(var(--tab-panel-rgb), 0.1), rgba(var(--tab-panel-rgb), 0.05));
  border-bottom: 2px solid rgba(var(--tab-panel-rgb), 0.3);
}
.pane-tab-panel:hover {
  background: linear-gradient(135deg, rgba(var(--tab-panel-rgb), 0.15), rgba(var(--tab-panel-rgb), 0.08));
}
.pane-tab-panel.pane-tab-active {
  background: linear-gradient(135deg, rgba(var(--tab-panel-rgb), 0.2), rgba(var(--tab-panel-rgb), 0.1));
  border-bottom-color: #a78bfa;
}

/* ---- Tab Content (mount all, show active) ---- */

.pane-tab-content {
  display: none;
  width: 100%;
  height: 100%;
}

.pane-tab-content-active {
  display: flex;
  flex-direction: column;
}

/* ---- Empty Pane Placeholder ---- */

.pane-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--fg-secondary);
  font-size: 13px;
  opacity: 0.5;
}
