/* Categories layout */
.categoriesList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.categorySection {
  /* Using container pattern */
  background: var(--spice-card);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.categoryHeader {
  /* Using expandable-header pattern */
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 8px 12px;
  border-radius: 4px;
  background: rgb(0 0 0 / 20%);
  transition: background 0.2s ease;
}

.categoryHeader:hover {
  background: rgb(255 255 255 / 10%);
}

.categoryTitle {
  /* Using section-title pattern */
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--spice-text);
  flex-grow: 1;
}

/* Subcategories */
.subcategorySection {
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 4px;
  overflow: hidden;
}

.subcategoryHeader {
  /* Using expandable-header pattern */
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 8px 12px;
  background: rgb(0 0 0 / 20%);
  transition: background 0.2s ease;
}

.subcategoryHeader:hover {
  background: rgb(255 255 255 / 10%);
}

.subcategoryTitle {
  /* Using section-subtitle pattern */
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  color: var(--spice-text);
  flex-grow: 1;
}

.subcategoryContent {
  padding: 12px;
  background: var(--spice-main);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Fixed tag layout - 3 columns with fixed width */
.tagList {
  display: grid;
  grid-template-columns: repeat(3, 200px); /* Fixed 200px width per column */
  gap: 12px;
  margin-bottom: 8px;
  justify-content: start; /* Align to left if container is wider */
}

.tagItem {
  /* Fixed width tag items with proper truncation */
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgb(0 0 0 / 20%);
  border-radius: 12px;
  padding: 8px 8px 8px 12px;
  font-size: 12px;
  cursor: move;
  transition: background-color 0.2s ease;
  gap: 8px;
  position: relative;
  min-height: 32px;
  width: 200px; /* Fixed width */
  max-width: 200px; /* Enforce max width */
  box-sizing: border-box;
  overflow: hidden; /* Hide overflow */
}

.tagItem:hover {
  background: rgb(255 255 255 / 10%);
}

.tagContent {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0; /* Allows text truncation */
  overflow: hidden; /* Hide overflow */
}

.tagName {
  color: var(--spice-text);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.tagActions {
  display: flex;
  gap: 2px;
  flex-shrink: 0; /* Prevents actions from shrinking */
  width: 70px; /* Fixed width for actions */
  justify-content: flex-end;
}

.tagAction {
  /* Using btn pattern */
  background: transparent;
  border: none;
  color: var(--spice-subtext);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  transition: color 0.2s ease, background 0.2s ease;
}

.tagAction:hover {
  color: var(--spice-text);
  background: rgb(255 255 255 / 10%);
}

.tagDelete:hover {
  color: white;
  background: rgb(255 0 0 / 30%);
}

/* Action buttons - using shared button pattern */
.actionButton {
  /* Using btn pattern */
  background: rgb(0 0 0 / 20%);
  color: var(--spice-text);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.actionButton:hover:not(:disabled) {
  background: rgb(255 255 255 / 10%);
}

.saveButton {
  /* Using btn--primary pattern */
  background: #1e90ff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.saveButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgb(0 0 0 / 20%);
}

.saveButton:hover:not(:disabled) {
  background: #1a7ee0;
}

.cancelButton {
  /* Using btn pattern */
  background: rgb(0 0 0 / 20%);
  color: var(--spice-text);
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cancelButton:hover {
  background: rgb(255 255 255 / 10%);
}

/* Form elements - using shared form pattern */
.input {
  /* Using form-input pattern */
  padding: 10px 12px;
  border-radius: 4px;
  background: var(--spice-main);
  border: 1px solid var(--spice-button-disabled);
  color: var(--spice-text);
  font-size: 14px;
  flex-grow: 1;
}

.input:focus {
  outline: none;
  border-color: rgb(255 255 255 / 30%);
}

.addCategorySection {
  border-top: 1px solid var(--spice-button-disabled);
  padding-top: 16px;
}

/* Expand/collapse icons - using shared pattern */
.expandIcon {
  /* Using expand-icon pattern */
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
  width: 10px;
  text-align: center;
  margin-right: 8px;
}

.expanded {
  transform: rotate(0deg);
}

/* Modal styles - using shared modal pattern */
.modalOverlay {
  /* Using modal-overlay pattern */
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  overflow: auto;
}

.modal {
  /* Using modal pattern */
  background: var(--spice-card);
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
  position: relative;
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modalHeader {
  /* Using modal-header pattern */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--spice-button-disabled);
}

.modalTitle {
  /* Using modal-title pattern */
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--spice-text);
}

.modalBody {
  /* Using modal-body pattern */
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modalFooter {
  /* Using modal-footer pattern */
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--spice-button-disabled);
  margin-top: auto;
}

/* Notifications - using shared notification pattern */
.modalNotification {
  /* Using notification pattern */
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e90ff;
  color: white;
  padding: 12px 16px;
  border-radius: 4px;
  z-index: 1001;
  box-shadow: 0 4px 12px rgb(0 0 0 / 40%);
  font-size: 14px;
  max-width: 80%;
  text-align: center;
  animation: slideDown 0.3s ease-out;
}

.modalNotification.error {
  background: #ff4c4c;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Drag and drop - using shared drag pattern */
.tagDragging {
  /* Using dragging pattern */
  opacity: 0.5;
  transform: scale(0.95);
  background: rgb(30 144 255 / 20%);
  border: 1px solid #1e90ff;
}

.tagDropTarget {
  /* Using drop-target pattern */
  background: rgb(30 144 255 / 30%);
  border: 1px solid #1e90ff;
  transform: scale(1.02);
}

.dragHandle {
  color: var(--spice-subtext);
  font-size: 12px;
  cursor: move;
  opacity: 0.6;
  transition: opacity 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  width: 12px; /* Fixed width for handle */
}

.dragHandle:hover {
  opacity: 1;
  color: var(--spice-text);
}

/* Prevent text selection during drag */
.tagItem.tagDragging * {
  user-select: none;
  pointer-events: none;
}
