/* ============================================================
   ImgCruncher — Pipeline component (chips + step panels + results)
   Loaded only on pipeline-enabled tool pages via $extraCss.
   ============================================================ */

.pipe-files { font-size: .875rem; color: var(--text-muted); margin: .75rem 0 0; min-height: 1em; }

/* Step chips */
.pipe-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: 1rem; }
.pipe-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--primary); color: #fff;
  border-radius: 999px; padding: .35rem .85rem;
  font-size: .85rem; font-weight: 600;
}
.pipe-chip .pipe-n {
  background: rgba(255,255,255,.25); border-radius: 50%;
  width: 1.15rem; height: 1.15rem; display: inline-flex;
  align-items: center; justify-content: center; font-size: .7rem;
}
.pipe-chip-x {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 0 0 .1rem; opacity: .8;
}
.pipe-chip-x:hover { opacity: 1; }
.pipe-add-wrap { position: relative; }
.pipe-add {
  background: none; border: 1.5px dashed var(--border); color: var(--text-muted);
  border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: border-color .2s, color .2s;
}
.pipe-add:hover { border-color: var(--primary); color: var(--primary); }
.pipe-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  background: var(--bg, #fff); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12); padding: .35rem; min-width: 160px;
}
.pipe-menu.open { display: block; }
.pipe-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: .5rem .7rem; font-size: .875rem; color: var(--text); cursor: pointer;
  border-radius: 6px; font-family: var(--font);
}
.pipe-menu button:hover { background: var(--primary-light, #eff6ff); color: var(--primary); }

/* Step option panels */
.pipe-panel {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .9rem 1rem 1rem; margin-top: .75rem; background: var(--bg, #fff);
}
.pipe-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .65rem;
}
.pipe-panel-title { font-size: .875rem; font-weight: 700; color: var(--text); }
.pipe-panel-title .pipe-n { color: var(--primary); margin-right: .15rem; }
.pipe-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 0 .2rem;
}
.pipe-remove:hover { color: #dc2626; }
.pipe-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .75rem 1rem; align-items: start;
}
.pipe-grid .pipe-wide, .pipe-grid .pipe-hint { grid-column: 1 / -1; }
.pipe-hint { font-size: .8rem; color: var(--text-muted); margin: 0; }

.pipe-run { width: 100%; margin-top: 1.25rem; }

/* Results */
.pipe-results { text-align: left; }
.pipe-row {
  display: flex; align-items: center; gap: .9rem;
  padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.pipe-row:last-of-type { border-bottom: none; }
.pipe-row img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); flex-shrink: 0; background: #f1f5f9;
}
.pipe-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.pipe-row-main strong {
  font-size: .875rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pipe-row-main span { font-size: .8rem; color: var(--text-muted); }
.pipe-row-note { font-style: normal; }
.pipe-row-err { color: #dc2626; }
.pipe-badge {
  display: inline-block; background: #dcfce7; color: #15803d;
  border-radius: 6px; padding: 0 .4rem; font-size: .75rem; font-weight: 700;
}
.pipe-dl { padding: .5rem .9rem; font-size: .8rem; flex-shrink: 0; }
.pipe-foot {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap; padding-top: .9rem; margin-top: .25rem;
}
.pipe-foot span { font-size: .875rem; font-weight: 600; color: var(--text); }

@media (max-width: 480px) {
  .pipe-row { flex-wrap: wrap; }
  .pipe-row img { width: 44px; height: 44px; }
  .pipe-dl { width: 100%; text-align: center; }
  .pipe-foot button { width: 100%; }
}

/* Color swatch inputs need explicit box, the shared width:100% rule flattens them */
.pipe-grid input[type="color"] { width: 72px; height: 42px; padding: 3px; cursor: pointer; }

/* One-tap presets */
.pipe-presets { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: 1rem; }
.pipe-presets-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-right: .15rem; }
.pipe-preset {
  background: var(--primary-light, #eff6ff); border: 1px solid transparent; color: var(--primary);
  border-radius: 999px; padding: .32rem .8rem; font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: background .2s, border-color .2s, color .2s;
}
.pipe-preset:hover { border-color: var(--primary); }
.pipe-preset.active { background: var(--primary); color: #fff; }
