/* ============================================
   _packages.css
   Standard Library Panel, Package Cards, Package Filters,
   Package Groups, Package Children, Enum Dropdowns
   ============================================ */

/* Empty state improvements */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  color: var(--text-muted);
  font-size: var(--font-size-md);
  gap: var(--spacing-xs);
}

.empty-hint {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  opacity: 0.7;
}

/* ============================================
   Standard Library Panel
   ============================================ */

/* Extends .sidebar-panel from _base.css */
.stdlib-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.stdlib-toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs);
  border-bottom: 1px solid var(--vscode-panel-border, var(--border-subtle));
}
.stdlib-toolbar .search-box {
  flex: 1;
}
.stdlib-toolbar .search-box input {
  font-family: var(--font-sans);
  font-size: var(--vscode-font-size, 13px);
}

.stdlib-filters {
  display: flex;
  gap: 4px;
}

.stdlib-filters .filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.stdlib-filters .filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.stdlib-filters .filter-btn.active {
  background: var(--accent);
  color: var(--text-on-accent);
}

.stdlib-filters .filter-btn:not(:first-child).active {
  background: var(--filter-color);
  color: var(--text-on-accent);
}

.stdlib-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xs) 0;
}

/* Grouped view */
.stdlib-group {
  margin-bottom: 2px;
}

.stdlib-group-header {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  /* Match content item sizing */
  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;
  height: var(--row-height-tree-item);
  padding: 0 var(--spacing-sm);
  margin-bottom: 0;
  background: none;
  border: none;
  color: var(--vscode-foreground, var(--text-primary));
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s ease;
}

.stdlib-group-header:hover {
  background: var(--vscode-list-hoverBackground, rgba(255, 255, 255, 0.04));
}

.stdlib-group-header .group-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex-shrink: 0;
  color: var(--vscode-foreground, var(--text-primary));
}

.stdlib-group-header .group-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.stdlib-group-header .group-label {
  color: var(--vscode-foreground, var(--text-primary));
}

.stdlib-group-header .group-count {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0 6px;
  border-radius: var(--radius-sm);
}

.stdlib-group.collapsed .stdlib-group-header {
  margin-bottom: 0;
}

.stdlib-group-items {
  /* Container for items when expanded */
}

/* Search results (flat list mode) */
.stdlib-search-results {
  padding: 0;
}

.search-results-count {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
}

.stdlib-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xl);
  color: var(--text-muted);
  font-size: var(--font-size-md);
}

.stdlib-empty svg {
  opacity: 0.5;
}

/* Standard library card - styled as native tree item */
.stdlib-card {
  padding: 0;
  margin: 0;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.1s ease;
  border-left: none;
  margin-left: 16px; /* Indent under group header */
}

.stdlib-card:hover {
  background: var(--vscode-list-hoverBackground, rgba(255, 255, 255, 0.04));
}

.stdlib-card.selected {
  background: transparent;
}

.stdlib-card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--row-height-tree-item);
  padding: 0 var(--spacing-sm);
}

.stdlib-expand-icon,
.stdlib-expand-spacer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex-shrink: 0;
  color: var(--vscode-foreground, var(--text-primary));
}

.stdlib-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.stdlib-card-name {
  /* Match VS Code native tree item text */
  font-family: var(--font-sans);
  font-size: var(--vscode-font-size, 13px);
  font-weight: inherit;
  color: var(--vscode-foreground, var(--text-primary));
}

.stdlib-type-badge {
  font-size: var(--font-size-xxs);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
  margin-left: auto;
}

/* Expanded content - description aligns with name text */
.stdlib-card-description {
  margin-top: 2px;
  margin-bottom: var(--spacing-sm);
  /* Align text directly under item name (measured: name at 57px, so 40px margin from card + 17px card offset) */
  margin-left: 40px;
  padding-left: 0 !important;
  padding-right: var(--spacing-sm);
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
  color: var(--vscode-descriptionForeground, var(--text-muted));
  line-height: 1.4;
}

.stdlib-card-params,
.stdlib-card-exports {
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-xs);
}

.params-label,
.exports-label {
  color: var(--text-muted);
  margin-right: var(--spacing-xs);
}

.params-list,
.exports-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.param-item,
.export-item {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.param-type {
  color: var(--ctp-blue);
}

/* Usage code block */
.stdlib-card-usage {
  margin-top: var(--spacing-xs);
  /* Align box with item name (same as description: 40px) */
  margin-left: 40px;
  margin-right: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  background: var(--vscode-textCodeBlock-background, var(--bg-tertiary));
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.usage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: rgba(0,0,0,0.2);
  font-size: var(--font-size-xxs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.usage-code {
  padding: var(--spacing-sm);
  margin: 0;
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  color: var(--ctp-green);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* Actions */
.stdlib-card-actions {
  display: flex;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.stdlib-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: var(--font-size-xs);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.stdlib-action-btn:hover {
  background: var(--accent);
  color: var(--text-on-accent);
}

.stdlib-action-btn.primary {
  background: var(--success);
  color: var(--text-on-status);
}

.stdlib-action-btn.primary:hover {
  background: var(--ctp-teal);
}

/* Children tree view - flows naturally under parent */
.stdlib-card-children {
  margin-top: 0;
  margin-left: 16px;
  padding-left: 0;
  border-left: none;
}

.stdlib-child-node {
  /* Container for child nodes */
}

.stdlib-child-row {
  display: flex;
  align-items: center;
  gap: 4px;
  /* Match VS Code native tree item height */
  height: var(--row-height-tree-item);
  min-height: var(--row-height-tree-item);
  padding: 0 var(--spacing-sm);
  margin-left: 0;
  cursor: default;
  transition: background 0.1s ease;
  border-radius: 0;
}

.stdlib-child-row.expandable {
  cursor: pointer;
}

.stdlib-child-row:hover {
  background: var(--vscode-list-hoverBackground, rgba(255, 255, 255, 0.04));
}

.stdlib-child-row .expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: none;
  border: none;
  color: var(--vscode-foreground, var(--text-primary));
  cursor: pointer;
  flex-shrink: 0;
}

.stdlib-child-row .expand-btn:hover {
  color: var(--vscode-foreground, var(--text-primary));
}

.stdlib-child-row .expand-spacer {
  width: 16px;
  flex-shrink: 0;
}

.stdlib-child-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.stdlib-child-name {
  /* Match VS Code native tree item text */
  font-family: var(--font-sans);
  font-size: var(--vscode-font-size, 13px);
  font-weight: inherit;
  color: var(--vscode-foreground, var(--text-primary));
}

.stdlib-child-type {
  /* Type annotation - slightly muted */
  font-family: var(--font-sans);
  font-size: var(--vscode-font-size, 13px);
  color: var(--vscode-descriptionForeground, var(--text-muted));
  margin-left: auto;
}

.stdlib-child-children {
  /* Nested children */
  margin-left: 16px;
  padding-left: 0;
  border-left: none;
}

/* Enum parameter styles */
.stdlib-child-row.has-enum {
  cursor: pointer;
}

.stdlib-child-row.has-enum:hover .stdlib-child-name {
  color: var(--ctp-peach);
}

.stdlib-child-row .enum-expand {
  color: var(--ctp-peach);
}

.enum-count {
  font-size: var(--font-size-xxs);
  opacity: 0.8;
  margin-left: 4px;
}

/* Enum dropdown */
.enum-dropdown {
  margin: 4px 0 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 280px;
}

.enum-dropdown-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.enum-dropdown-header svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.enum-dropdown-header input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.enum-dropdown-header input::placeholder {
  color: var(--text-muted);
}

.enum-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-size-lg);
  line-height: 1;
  padding: 0 2px;
}

.enum-close-btn:hover {
  color: var(--text-primary);
}

.enum-dropdown-list {
  max-height: 180px;
  overflow-y: auto;
}

.enum-value-item {
  padding: 5px 10px;
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.enum-value-item:last-child {
  border-bottom: none;
}

.enum-value-item:hover {
  background: var(--bg-hover);
  color: var(--ctp-peach);
}

.enum-empty {
  padding: 12px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.enum-dropdown-footer {
  padding: 4px 8px;
  font-size: var(--font-size-xxs);
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  text-align: right;
}
