/* ============================================
   _collapsible.css
   Collapsible Section, Section Title Bar, Section Body,
   Bottom Panel (VS Code Terminal style)
   ============================================ */

/* ============================================
   Collapsible Section
   ============================================ */

.collapsible-section {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  /* Default fallback - actual heights calculated by usePanelSizing */
  flex: 1 1 0;
  min-height: 0;
  /* Smooth transitions for expand/collapse */
  transition: height 150ms ease-out, flex 150ms ease-out;
}

/* Disable transitions during resize drag */
body.resizing .collapsible-section {
  transition: none;
}

/* Collapsed: only show title bar */
.collapsible-section.collapsed {
  flex: 0 0 auto !important;
  height: auto !important;
}

/* When height is calculated/set, use it exactly */
.collapsible-section.has-height {
  /* Height set via inline style */
  overflow: hidden;
}

.collapsible-section.has-height .section-body {
  flex: 1;
  overflow-y: auto;
}

.section-title-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  /* Match VS Code native sidebar item styling */
  padding: 0 4px 0 0;
  background: transparent;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  height: 26px;
  min-height: 26px;
  border-left: none;
  transition: background var(--transition-fast);
}

.section-title-bar:hover {
  background: var(--vscode-list-hoverBackground, rgba(255, 255, 255, 0.04));
}

.section-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Match VS Code native expand/collapse icon sizing */
  width: 20px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--vscode-foreground, var(--text-primary));
  cursor: pointer;
  transition: color var(--transition-fast);
}

.section-title {
  flex: 1;
  /* Match VS Code native sidebar item exactly */
  font-family: var(--vscode-font-family, var(--font-sans));
  font-size: var(--vscode-font-size, 13px);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--vscode-foreground, var(--text-primary));
}

.section-loading {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  margin-left: 4px;
}

.section-loading svg {
  animation: spin 1s linear infinite;
}

.section-badge {
  /* Match VS Code native badge styling */
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 1px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 16px;
}

.section-badge.filter-badge {
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 500;
}

.section-badge .clear-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 2px;
  opacity: 0.7;
}

.section-badge .clear-filter-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.2);
}

.section-error-count,
.section-warning-count {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: var(--font-size-xs);
  padding: 1px 4px;
  border-radius: 4px;
  min-height: 16px;
}

.section-error-count {
  color: var(--error);
  background: rgba(243, 139, 168, 0.15);
}

.section-warning-count {
  color: var(--warning);
  background: rgba(249, 226, 175, 0.15);
}

.section-warning-message {
  display: flex;
  align-items: center;
  color: var(--warning);
  opacity: 0.8;
  cursor: help;
}

.section-warning-message:hover {
  opacity: 1;
}

.section-body {
  /* Expand to fill section and scroll */
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* For flex-grow sections, body should expand and scroll */
.collapsible-section.flex-grow .section-body {
  flex: 1;
  overflow-y: auto;
}

.section-resize-handle {
  height: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  cursor: ns-resize;
  color: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.collapsible-section:hover .section-resize-handle {
  opacity: 0.6;
}

.section-resize-handle:hover {
  opacity: 1;
  background: var(--bg-tertiary);
}

.section-resize-handle:active {
  background: var(--accent);
  opacity: 1;
}

/* ============================================
   Bottom Panel (VS Code Terminal style)
   ============================================ */

.bottom-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.bottom-panel-resize {
  height: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.bottom-panel:hover .bottom-panel-resize {
  opacity: 1;
}

.bottom-panel-resize:hover {
  background: var(--accent);
}

.bottom-panel-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-sm);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.bottom-tabs-left {
  display: flex;
  gap: 2px;
}

.bottom-tab {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.bottom-tab:hover {
  color: var(--text-secondary);
}

.bottom-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.bottom-tabs-right {
  display: flex;
  gap: var(--spacing-xs);
}

.bottom-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.bottom-panel-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.bottom-panel-content {
  flex: 1;
  overflow-y: auto;
}

.bottom-panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--spacing-sm);
  color: var(--text-muted);
}

.bottom-panel-placeholder.terminal-style {
  align-items: flex-start;
  padding: var(--spacing-md);
  font-family: var(--font-mono);
  font-size: var(--font-size-md);
}

.terminal-prompt {
  color: var(--ctp-green);
}

.terminal-output {
  color: var(--text-secondary);
}
