/* === CATEGORY SIDEBAR TREE === */

.category-sidebar {
  padding: 0.75rem 1rem;
  background-color: #fafafa;
  border-right: 1px solid #eee;
  min-width: 260px; /* slightly wider to fit long names */
}

/* Headline */
.category-sidebar h5 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* List reset & nesting */
.category-sidebar ul {
  margin: 0;
  padding-left: 0;
}

.category-sidebar ul ul {
  margin-top: 0.25rem;
  margin-left: 0.75rem;
  border-left: 1px dotted #ddd;
  padding-left: 0.75rem;
}

/* Category link base */
.category-sidebar a.category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  padding: 4px 8px;
  color: #333;
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Hover & active states */
.category-sidebar a.category-link:hover {
  background-color: #f0f0f0;
  color: #0a58ca;
}

.category-sidebar a.category-link.active {
  background-color: #e9ecef;
  color: #0d6efd;
  font-weight: 600;
}

/* Category name and count */
.category-sidebar a.category-link span {
  display: inline-block;
}

.category-sidebar a.category-link span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80%;
}

.category-sidebar a.category-link .badge {
  flex-shrink: 0;
  background-color: #f2f2f2 !important;
  color: #555 !important;
  font-weight: 500;
  min-width: 32px;
  text-align: center;
}

/* Collapse toggle buttons (▾ ▸) */
.category-sidebar button.btn-link {
  color: #666;
  font-size: 0.9rem;
  text-decoration: none;
}

.category-sidebar button.btn-link:hover {
  color: #000;
}

/* Spacing between list items */
.category-sidebar li {
  margin-bottom: 0.25rem;
}

/* Make sidebar adaptive on smaller screens */
@media (max-width: 768px) {
  .category-sidebar {
    border-right: none;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }
}
