/* ═══════════════════════════════════════════════════════════
   Diffusion Explorer — integrated dark-theme styles
   Uses CSS vars from base.html (:root)
   Module accent: #FD79A8 (ia-generativa)
   ═══════════════════════════════════════════════════════════ */

/* ── Root scope ── */
.df-root {
  --df-accent: #FD79A8;
  --df-accent-50: rgba(253,121,168,.50);
  --df-accent-25: rgba(253,121,168,.25);
  --df-accent-15: rgba(253,121,168,.15);
  --df-accent-08: rgba(253,121,168,.08);
  --df-accent-04: rgba(253,121,168,.04);
  --df-blue: #74b9ff;
  --df-blue-15: rgba(116,185,255,.15);
  --df-gold: #fdcb6e;
  --df-green: #55efc4;
  --df-green-15: rgba(85,239,196,.15);
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

/* ── Hero ── */
.df-hero { text-align: center; padding: 2.5rem 0 2rem; }
.df-hero-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .9rem; border-radius: 50px; font-size: .75rem; font-weight: 600;
  background: var(--df-accent-15); color: #fab1c4; margin-bottom: 1rem;
}
.df-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800;
  letter-spacing: -.03em; margin-bottom: .6rem;
}
.df-hero-sub {
  color: var(--text-secondary); font-size: .95rem; max-width: 660px;
  margin: 0 auto; line-height: 1.6;
}

/* ── Section ── */
.df-section {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 1.6rem 1.5rem; margin-bottom: 1.5rem;
  transition: border-color .3s;
}
.df-section:hover { border-color: var(--border-hover); }

.df-section-title {
  font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em;
  margin-bottom: .35rem; display: flex; align-items: center; gap: .6rem;
}
.df-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--df-accent-15); color: var(--df-accent);
  font-size: .85rem; font-weight: 700; flex-shrink: 0; font-family: var(--font-mono);
}
.df-section-sub {
  color: var(--text-secondary); font-size: .88rem; max-width: 680px;
  margin-bottom: 1rem; line-height: 1.5;
}

.df-section-header {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem;
}

/* ── Math section ── */
.df-math-section { background: transparent; border: none; padding: 0 0 1rem; }
.df-math-body {
  display: flex; flex-direction: column; gap: .8rem;
  color: var(--text-secondary); font-size: .9rem; line-height: 1.7;
}
.df-math-body strong { color: var(--text-primary); }
.df-math-block {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 1rem 1.2rem; text-align: center;
}
.df-math-block p { margin: .3rem 0; }

/* ── Controls row ── */
.df-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
}

/* Buttons */
.df-btn {
  padding: .45rem .9rem; font-size: .82rem; font-weight: 600;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  transition: all .2s; font-family: var(--font-sans);
}
.df-btn-primary {
  background: var(--df-accent); color: #fff;
}
.df-btn-primary:hover { background: #e96595; transform: translateY(-1px); }
.df-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.df-btn-ghost {
  background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary);
}
.df-btn-ghost:hover {
  border-color: var(--df-accent-25); color: var(--df-accent); background: var(--df-accent-04);
}
.df-btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

/* Tab buttons (schedule type) */
.df-btn-group {
  display: inline-flex; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}
.df-btn-tab {
  padding: .4rem .85rem; font-size: .8rem; font-weight: 600;
  border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: background .2s, color .2s; font-family: var(--font-sans);
}
.df-btn-tab:not(:last-child) { border-right: 1px solid var(--border-color); }
.df-btn-tab:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.df-btn-tab.active { background: var(--df-accent-15); color: var(--df-accent); }

/* Range slider */
.df-range {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; color: var(--text-secondary);
}
.df-range label { white-space: nowrap; font-weight: 500; }
.df-range input[type="range"] { width: 120px; accent-color: var(--df-accent); }
.df-range-val {
  font-weight: 700; font-family: var(--font-mono);
  min-width: 2rem; text-align: right; color: var(--text-primary);
}

/* ── Image selector cards ── */
.df-card-grid {
  display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem;
}
.df-card {
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-secondary);
  cursor: pointer; font-size: .85rem; font-weight: 600;
  transition: all .2s; text-align: center;
}
.df-card:hover {
  border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateY(-1px);
}
.df-card.selected {
  border-color: var(--df-accent); background: var(--df-accent-08);
  box-shadow: 0 0 16px var(--df-accent-08);
}

/* ── Pixel grid ── */
.df-pixel-grid-wrap {
  display: inline-flex; flex-direction: column; align-items: center; gap: .5rem;
}
.df-pixel-grid-wrap.compact { gap: .25rem; }
.df-pixel-canvas {
  border-radius: var(--radius-sm); display: block;
  image-rendering: pixelated;
}
.df-grid-label {
  font-size: .75rem; color: var(--text-secondary); text-align: center;
  line-height: 1.3; display: flex; flex-direction: column; gap: 1px;
}
.df-t-label {
  font-weight: 700; color: var(--text-primary); font-family: var(--font-mono);
  font-size: .72rem;
}
.df-ratio {
  font-size: .65rem; color: var(--text-muted); font-family: var(--font-mono);
}

/* ── Snapshot strip ── */
.df-snapshot-strip {
  display: flex; align-items: center; gap: .6rem;
  overflow-x: auto; padding: .5rem 0; scroll-snap-type: x mandatory;
}
.df-snapshot-strip > .df-pixel-grid-wrap { scroll-snap-align: center; flex-shrink: 0; }
.df-strip-arrow {
  font-size: 1.4rem; color: var(--df-accent-50); flex-shrink: 0; font-weight: 700;
}
.df-snapshot-strip.reverse .df-strip-arrow { color: var(--df-green); }

/* ── Chart ── */
.df-chart-wrap {
  background: rgba(255,255,255,.02); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: .8rem; overflow-x: auto;
}
.df-chart-svg { width: 100%; min-width: 460px; height: auto; display: block; }

/* ── Forward live preview ── */
.df-forward-live {
  display: flex; justify-content: center; padding: .5rem 0;
}

/* ── Training ── */
.df-training-steps {
  display: flex; flex-direction: column; gap: .4rem; margin-top: .8rem;
}
.df-train-step {
  display: flex; align-items: center; gap: .6rem; padding: .45rem .8rem;
  border-radius: var(--radius-sm); background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.04); font-size: .84rem;
  color: var(--text-secondary); transition: all .25s;
}
.df-train-step.done {
  border-color: var(--df-accent-15); background: var(--df-accent-04);
}
.df-step-icon { font-size: 1rem; flex-shrink: 0; }
.df-loss-value {
  font-family: var(--font-mono); font-weight: 700; color: var(--df-accent);
}

/* ── Chips (prompt selector) ── */
.df-chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.df-chip {
  padding: .35rem .8rem; border-radius: 50px;
  border: 1px solid var(--border-color); background: transparent;
  color: var(--text-secondary); cursor: pointer; transition: all .2s;
  font-size: .8rem; font-weight: 500; font-family: var(--font-sans);
}
.df-chip:hover {
  border-color: var(--df-accent-25); color: var(--text-primary); background: var(--df-accent-04);
}
.df-chip.active {
  background: var(--df-accent); border-color: var(--df-accent); color: #fff;
  box-shadow: 0 0 12px rgba(253,121,168,.35);
}

/* ── Embedding bar visualization ── */
.df-embedding-bar {
  display: flex; gap: .35rem; align-items: flex-end; height: 80px;
  padding: .5rem; background: rgba(255,255,255,.02); border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); margin-bottom: 1rem;
}
.df-emb-cell {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 3px; min-width: 28px;
}
.df-emb-fill {
  width: 100%; border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--df-accent-25), var(--df-accent));
  transition: height .3s;
}
.df-emb-cell span {
  font-size: .6rem; color: var(--text-muted); font-family: var(--font-mono);
}

/* ── CFG comparison ── */
.df-cfg-compare, .df-sampling-compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.df-cfg-col, .df-sampling-col {
  background: rgba(255,255,255,.02); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 1rem;
}
.df-cfg-col h4, .df-sampling-col h4 {
  font-size: .9rem; font-weight: 700; margin-bottom: .6rem;
}
.df-mini-strip {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  justify-content: center;
}
.df-sampling-info {
  font-size: .75rem; color: var(--text-muted); margin-bottom: .5rem;
}

/* ── Placeholder text ── */
.df-placeholder {
  text-align: center; color: var(--text-muted); font-size: .88rem;
  padding: 2rem 1rem; font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .df-section-header { flex-direction: column; align-items: flex-start; }
  .df-controls { width: 100%; }
  .df-range { width: 100%; }
  .df-range input[type="range"] { flex: 1; }
  .df-cfg-compare, .df-sampling-compare { grid-template-columns: 1fr; }
  .df-snapshot-strip { gap: .35rem; }
}
@media (max-width: 480px) {
  .df-root { padding: 1rem .75rem 2rem; }
  .df-card-grid { gap: .4rem; }
}
