/*
 * The icon picker's own sheet.
 *
 * One file, drawn in both editions, so every colour is read through the port's token
 * first and the starter's second (`var(--fv-surface, var(--surface, …))`) — each board
 * gets its own theme and the picker never introduces a colour of its own beyond the
 * neutral fallbacks for a board that defines neither.
 *
 * It has to be linked *after* the board's own sheet, the way the appearance layer is:
 * the field it decorates is a normal input, and the preview and button are additions
 * beside it rather than a control of their own.
 */

.icon-picker-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border: 1px solid var(--fv-border, var(--border, #d4d4d8));
  border-radius: var(--fv-radius-sm, var(--radius, 10px));
  background: var(--fv-surface-2, var(--surface-2, #f4f4f5));
  color: var(--fv-text, var(--text, #18181b));
  font-size: 0.95rem;
  line-height: 1;
  vertical-align: middle;
}

.icon-picker-preview.is-empty {
  color: var(--fv-text-subtle, var(--muted, #a1a1aa));
  border-style: dashed;
}

.icon-picker-button {
  flex: 0 0 auto;
  margin-left: 0.4rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--fv-border, var(--border, #d4d4d8));
  border-radius: var(--fv-radius-sm, var(--radius, 10px));
  background: var(--fv-surface, var(--surface, #fff));
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.icon-picker-button:hover {
  border-color: var(--fv-accent, var(--accent, #4f46e5));
  color: var(--fv-accent, var(--accent, #4f46e5));
}

.icon-picker-button[disabled] {
  cursor: default;
  opacity: 0.6;
}

/* --------------------------------------------------------------- the palette */

.icon-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 17, 23, 0.55);
}

.icon-picker-panel {
  display: flex;
  flex-direction: column;
  width: min(52rem, 100%);
  max-height: min(38rem, 90vh);
  overflow: hidden;
  border: 1px solid var(--fv-border, var(--border, #d4d4d8));
  border-radius: var(--fv-radius-lg, var(--radius, 12px));
  background: var(--fv-surface, var(--surface, #fff));
  color: var(--fv-text, var(--text, #18181b));
  box-shadow: var(--fv-shadow-lg, var(--shadow, 0 24px 60px rgba(0, 0, 0, 0.35)));
}

.icon-picker-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--fv-border, var(--border, #e4e4e7));
}

.icon-picker-search {
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--fv-border, var(--border, #d4d4d8));
  border-radius: var(--fv-radius-sm, var(--radius, 10px));
  background: var(--fv-surface, var(--surface, #fff));
  color: inherit;
  font: inherit;
}

.icon-picker-search:focus {
  outline: 2px solid var(--fv-accent, var(--accent, #4f46e5));
  outline-offset: 1px;
}

.icon-picker-styles {
  display: flex;
  gap: 0.25rem;
}

.icon-picker-style {
  padding: 0.3rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fv-surface-2, var(--surface-2, #f4f4f5));
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.icon-picker-style.is-active {
  background: var(--fv-accent, var(--accent, #4f46e5));
  color: var(--fv-accent-contrast, var(--accent-fg, #fff));
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr));
  gap: 0.35rem;
  padding: 0.75rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

.icon-picker-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: var(--fv-radius-sm, var(--radius, 8px));
  background: var(--fv-surface-2, var(--surface-2, #f4f4f5));
  color: inherit;
  font-size: 1.05rem;
  cursor: pointer;
}

.icon-picker-icon:hover,
.icon-picker-icon:focus-visible {
  border-color: var(--fv-accent, var(--accent, #4f46e5));
  color: var(--fv-accent, var(--accent, #4f46e5));
  outline: none;
}

.icon-picker-icon.is-current {
  border-color: var(--fv-accent, var(--accent, #4f46e5));
  background: var(--fv-accent-soft, var(--accent-soft, rgba(79, 70, 229, 0.12)));
}

.icon-picker-empty {
  grid-column: 1 / -1;
  margin: 1rem;
  text-align: center;
  color: var(--fv-text-muted, var(--muted, #71717a));
  font-size: 0.9rem;
}

.icon-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--fv-border, var(--border, #e4e4e7));
  color: var(--fv-text-muted, var(--muted, #71717a));
  font-size: 0.8rem;
}

.icon-picker-clear {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--fv-border, var(--border, #d4d4d8));
  border-radius: var(--fv-radius-sm, var(--radius, 8px));
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.icon-picker-clear:hover {
  border-color: var(--fv-danger, var(--danger, #dc2626));
  color: var(--fv-danger, var(--danger, #dc2626));
}
