/* Workstream K: color search swatches + collage sheet.
   Load AFTER styles.css (resolves the app's theme tokens). */

/* ---- color search: swatch row in the Search view ---- */
#colorrow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 10px;
  margin: 12px 0 4px;
}
#colorrow .sw {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
#colorrow .sw span {
  font-size: 11px;
  color: var(--text-2);
}
.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--hairline);
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s var(--spring), border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch:disabled { opacity: 0.6; transform: none; cursor: wait; }
#colorbackfill { margin-top: 10px; }

/* ---- collage maker ---- */
#lib-actions { margin: 12px 16px 0; }
@media (min-width: 700px) { #lib-actions { margin-left: 24px; margin-right: 24px; } }

.collage-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 12px;
}
.collage-sheet {
  background: var(--bg-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  width: min(720px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.collage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.collage-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
}
.collage-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.cpick {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: var(--elev);
}
.cpick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cpick.sel { border-color: var(--accent); }
.cbadge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.cpick:not(.sel) .cbadge { display: none; }
.collage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}
.collage-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}
.collage-controls select,
.collage-controls input[type="range"] { accent-color: var(--accent); }
.collage-bgseg { display: flex; gap: 6px; }
.collage-bgseg .ghost.active {
  border-color: var(--accent);
  color: var(--text);
}
.collage-preview {
  display: flex;
  justify-content: center;
  background:
    repeating-conic-gradient(var(--elev-2) 0% 25%, var(--elev) 0% 50%) 0 0 / 24px 24px;
  border-radius: 8px;
  padding: 12px;
}
.collage-preview canvas { max-width: 100%; height: auto; border-radius: 4px; }
.collage-actions { display: flex; gap: 10px; }
