/* Setup Screen Module Categorizer v2 - injected by container patch */

/* ---- Toolbar ---- */
.sc-toolbar-wrapper {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sc-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 0.25rem;
}

.sc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: #ccc;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sc-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.sc-btn i { font-size: 0.75rem; }

.sc-btn-reset {
  color: #e88;
  border-color: rgba(255,100,100,0.25);
}
.sc-btn-reset:hover {
  background: rgba(255,80,80,0.2);
  color: #faa;
}

.sc-btn-add {
  margin-top: 0.5rem;
  border-style: dashed;
  width: 100%;
  justify-content: center;
}

/* ---- Flat list layout — cards are direct children of #modules-list ---- */
#modules-list.categorized {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: max-content;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Non-card elements span the full grid width */
.sc-cat-header-li,
.sc-toolbar-wrapper,
.sc-btn-add {
  grid-column: 1 / -1;
}

/* ---- Category header ---- */
.sc-cat-header-li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sc-cat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border-left: 4px solid var(--cat-color, #888);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}
.sc-cat-header:hover {
  background: rgba(0, 0, 0, 0.45);
}

.sc-cat-arrow {
  font-size: 0.75rem;
  color: #aaa;
  width: 1em;
  text-align: center;
  flex-shrink: 0;
}

.sc-cat-label {
  font-weight: bold;
  font-size: 1rem;
  color: #f0f0e0;
}

.sc-cat-count {
  color: #aaa;
  font-size: 0.85rem;
}

/* ---- Edit controls on header ---- */
.sc-cat-edit-ctrls {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 0.3rem;
}

.sc-cat-color-picker {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  background: none;
}
.sc-cat-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.sc-cat-color-picker::-webkit-color-swatch { border: none; border-radius: 2px; }

.sc-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  color: #aaa;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sc-btn-icon:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.sc-btn-icon:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 1px;
}
.sc-btn-delete:hover {
  background: rgba(255,60,60,0.25);
  color: #f66;
}

.sc-cat-rename-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  color: #f0f0e0;
  font-size: 1rem;
  font-weight: bold;
  padding: 0.15rem 0.35rem;
  outline: none;
  min-width: 120px;
}
.sc-cat-rename-input:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 1px;
}

/* ---- Collapsed cards (user toggle, separate from Foundry's .hidden) ---- */
li.package.module.sc-collapsed {
  display: none !important;
}

/* Prevent Foundry's filter from hiding our non-card elements */
#modules-list .sc-cat-header-li.hidden,
#modules-list .sc-toolbar-wrapper.hidden,
#modules-list .sc-btn-add.hidden {
  display: block !important;
}

/* ---- Drop target highlight ---- */
.sc-drop-active {
  background: rgba(255,255,255,0.06);
  outline: 2px dashed rgba(255,255,255,0.2);
  outline-offset: 2px;
}

/* ---- Drag handle (inside the card, not wrapping it) ---- */
.sc-drag-handle {
  display: none;
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  cursor: grab;
  font-size: 0.85rem;
  z-index: 2;
  padding: 4px 2px;
}
.sc-drag-handle:active { cursor: grabbing; }

.sc-edit-mode .sc-drag-handle { display: block; }
.sc-edit-mode li.package.module { padding-left: 22px; position: relative; }

/* Dragging state */
.sc-dragging {
  opacity: 0.4;
}

/* Dragging state */
.sc-dragging {
  opacity: 0.4;
}