/*
 * Shared styles for the item-picker panels (furniture, electrical).
 * Layout: header → search box → category chip row → grouped item list.
 * The picker is a fixed-width column anchored to the top-left of the canvas
 * and scrolls vertically when the content overflows.
 */

.palette {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--z-dropdown);
  width: 260px;
  max-height: 100%;
  background-color: var(--color-bg-elevated);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-md) 0;
  display: flex;
  flex-direction: column;
  opacity: 0.97;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.header {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}

/* Search input row with leading icon and clear button. */
.searchRow {
  position: relative;
  padding: var(--space-2) var(--space-3) var(--space-1);
}

.searchInput {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 26px 6px 26px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-input, #fff);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  outline: none;
  transition: border-color var(--transition-fast);
}

.searchInput:focus {
  border-color: var(--color-accent-400);
}

.searchIcon {
  position: absolute;
  left: calc(var(--space-3) + 8px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.searchClear {
  position: absolute;
  right: calc(var(--space-3) + 6px);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
}

.searchClear:hover {
  color: var(--color-text-primary);
}

/* Horizontal scrollable row of category filter chips. Scrollbar styling
   is inherited from the global rule in styles/global.css. */
.categoryChips {
  display: flex;
  gap: 4px;
  padding: var(--space-1) var(--space-3) var(--space-2);
  overflow-x: auto;
}

.categoryChip {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 11px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.categoryChip:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.categoryChipActive {
  background-color: var(--color-accent-100);
  border-color: var(--color-accent-300);
  color: var(--color-accent-700);
}

/* Scrollable item list area. */
.scrollArea {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--color-border);
}

.section {
  padding: var(--space-2) var(--space-3);
}

.sectionHeader {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  margin-bottom: var(--space-1);
}

.sectionCount {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-normal);
  margin-left: auto;
}

/* Item button — vertical layout (icon over label) for grid mode, horizontal
   for list mode. Both share the same active/hover treatment.
   `minmax(0, 1fr)` (instead of plain `1fr`) is crucial: it lets a column
   shrink below the intrinsic min-width of its contents. Without it, a long
   label like "Open Bookshelf 4" keeps the column as wide as the text and
   pushes the third column past the panel's right edge, where it gets clipped
   by `.palette { overflow: hidden }`. With `minmax(0, ...)` the ellipsis in
   `.itemLabel` actually triggers and the grid stays within 260px. */
.itemGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.itemBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  font-family: var(--font-family);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  min-height: 60px;
  text-align: center;
}

.itemBtn:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.itemBtnActive {
  background-color: var(--color-accent-50);
  border-color: var(--color-accent-300);
  color: var(--color-accent-700);
}

.itemIcon {
  font-size: 20px;
  line-height: 1;
}

.itemLabel {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.itemDims {
  font-size: 9px;
  color: var(--color-text-muted);
  line-height: 1;
}

.empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}
