.search { padding: 8px 10px; }
.lib-list { flex: 1; overflow: auto; padding-bottom: 10px; min-height: 0; }
.examples-list {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 10px 10px; max-height: 160px; overflow: auto;
  border-bottom: 1px solid var(--line-soft); flex: none;
}
.example-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: start; background: var(--bg-raised);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 7px 10px; cursor: pointer; color: var(--text);
}
.example-item:hover { border-color: var(--accent); background: #212a34; }
.example-title { font-size: 12px; font-weight: 600; }
.example-desc { font-size: 11px; color: var(--muted); line-height: 1.3; }
html[dir="rtl"] .example-title,
html[dir="rtl"] .example-desc { font-family: var(--font-fa); }
.lib-cat > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 7px 12px; cursor: pointer; color: var(--muted); font-weight: 600; user-select: none; }
.lib-cat > summary::-webkit-details-marker { display: none; }
.lib-cat > summary:hover { color: var(--text); }
.lib-cat .chev { display: inline-flex; transition: transform .12s; transform: rotate(-90deg); }
.lib-cat[open] .chev { transform: none; }
.lib-cat .count { margin-left: auto; font-weight: 400; font-size: 11px; }
.lib-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 2px 10px 8px; align-items: stretch; }
.lib-item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 4px; background: var(--bg-raised); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 8px 4px 6px; cursor: grab; color: var(--text);
  min-height: 78px; box-sizing: border-box;
}
.lib-item:hover { border-color: var(--accent); background: #212a34; }
.lib-item:active { cursor: grabbing; }
.lib-icon, .lib-preview { width: 100%; height: 44px; display: flex; align-items: center; justify-content: center; flex: none; }
.lib-icon svg, .lib-preview svg { width: 100%; height: 100%; max-width: 56px; max-height: 44px; }
.lib-name {
  font-size: 11px; text-align: center; line-height: 1.25; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-height: 2.5em; width: 100%; word-break: break-word;
}
html[dir="rtl"] .lib-name { font-family: var(--font-fa); }
html[dir="rtl"] .lib-cat .count { margin-left: 0; margin-right: auto; }

/* Collapsible sections inside sidebars */
.sidebar-section { display: flex; flex-direction: column; min-height: 0; }
.sidebar-section.section-grow { flex: 1; min-height: 0; }
.section-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--line-soft);
  padding: 9px 12px; font-weight: 600; color: var(--text); cursor: pointer; text-align: start;
}
.section-toggle:hover { background: var(--bg-raised); }
.section-chev { display: inline-block; width: 1em; transition: transform .12s; font-size: 11px; color: var(--muted); }
.sidebar-section.collapsed .section-chev { transform: rotate(-90deg); }
.sidebar-section.collapsed .section-body { display: none; }
.section-body { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.sidebar-section.section-grow .section-body { flex: 1; }
.sidebar-section.section-grow .lib-list { flex: 1; }

/* Vertical resize handle between Examples and Components */
.section-resizer {
  height: 6px; cursor: row-resize; flex: none;
  background: transparent; position: relative; touch-action: none;
}
.section-resizer::after {
  content: ""; position: absolute; left: 12px; right: 12px; top: 2px; height: 2px;
  background: transparent; border-radius: 1px;
}
.section-resizer:hover::after, .section-resizer.active::after { background: var(--accent); }

.examples-list { max-height: none; border-bottom: 0; flex: 1; overflow: auto; }
.sidebar-section[data-section="examples"] .section-body { max-height: var(--examples-h, 180px); }
.sidebar-section[data-section="examples"].collapsed .section-body { max-height: none; }

/* Fully collapsed sidebars */
.sidebar.left.collapsed-bar,
.sidebar.right.collapsed-bar {
  width: 0 !important; min-width: 0 !important; overflow: hidden; border: 0; padding: 0;
}
.main.left-collapsed { grid-template-columns: 0 minmax(0, 1fr) var(--right-w); }
.main.right-collapsed { grid-template-columns: var(--left-w) minmax(0, 1fr) 0; }
.main.left-collapsed.right-collapsed { grid-template-columns: 0 minmax(0, 1fr) 0; }
html[dir="rtl"] .main.left-collapsed { grid-template-columns: 0 minmax(0, 1fr) var(--right-w); }
html[dir="rtl"] .main.right-collapsed { grid-template-columns: var(--left-w) minmax(0, 1fr) 0; }
