/* Hierarchical Category Styles */
.category-item {
  margin-bottom: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.category-item.refined {
  background-color: #f8f9fa;
}

.parent-category-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.category-header {
  display: flex;
  align-items: center;
  padding: 0px 12px 0 0;
  cursor: default;
}

.category-checkbox {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  margin: 0;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  position: relative;
  flex: 1;
}

.category-checkbox:hover {
  background-color: #f1f3f4;
}

.category-checkbox input[type="checkbox"] {
  display: none;
}

.category-checkbox .checkmark {
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-radius: 3px;
  margin-right: 8px;
  position: relative;
  display: inline-block;
  background: white;
  transition: all 0.2s ease;
}

.category-checkbox input[type="checkbox"]:checked + .checkmark {
  background-color: #007bff;
  border-color: #007bff;
}

.category-checkbox input[type="checkbox"]:checked + .checkmark::after {
  content: "✓";
  position: absolute;
  top: -2px;
  left: 2px;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.toggle-children {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  color: #666;
  margin-right: 8px;
}

.toggle-children:hover {
  background-color: transparent;
  color: #333;
}

.toggle-children svg {
  transition: transform 0.2s ease;
}

.toggle-children.expanded svg {
  transform: rotate(180deg);
}

.children-categories {
  margin-left: 0px;
  margin-top: 4px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 0;
  opacity: 0;
}

.children-categories.expanded {
  max-height: 500px;
  opacity: 1;
}

.children-categories.collapsed {
  max-height: 0;
  opacity: 0;
}

.child-category {
  padding: 6px 6px;
  margin-bottom: 0px;
  border-radius: 4px;
  font-size: 0.9em;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.child-category:hover {
  background-color: #e9ecef;
  border-left-color: #007bff;
}

.child-category.refined {
  background-color: #e7f3ff;
  border-left-color: #007bff;
}

.child-category .checkmark {
  width: 18px;
  height: 18px;
}

.no-subcategories {
  padding: 12px;
  color: #666;
  font-style: italic;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .category-checkbox {
    padding: 10px;
  }
  
  .children-categories {
    margin-left: 20px;
  }
  
  .child-category {
    padding: 8px 10px;
  }
}

/* Focus states for accessibility */
.category-checkbox input[type="checkbox"]:focus + .checkmark {
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.toggle-children:focus {
  /* outline: 2px solid rgba(0, 123, 255, 0.25); */
  outline-offset: 0px;
}
