/* ── Modifiers Panel ────────────────────────────────────── */

.modifiers-panel {
  max-width: 900px;
}

/* ── Toast ── */
.mod-toast {
  position: fixed;
  top: 16px;
  right: 24px;
  background: #059669;
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: mod-toast-in 0.25s ease-out;
}
@keyframes mod-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mod-dismiss-btn {
  margin-left: 12px;
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 700;
  font-size: 14px;
  color: inherit;
}

/* ── Intro ── */
.mod-intro {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.mod-intro p {
  color: #64748b;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.mod-dirty-badge {
  flex-shrink: 0;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ── Factor Group Card ── */
.mod-group {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.mod-group-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: #fafbfc;
}
.mod-group-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.mod-group-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #1e293b);
}
.mod-group-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim, #64748b);
}

/* ── Value Section (young, mature, local, etc.) ── */
.mod-value-section {
  border-bottom: 1px solid #f1f5f9;
}
.mod-value-section:last-child {
  border-bottom: none;
}
.mod-value-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 4px;
}
.mod-value-icon {
  font-size: 14px;
}
.mod-value-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1e293b);
  flex: 1;
}
.mod-save-group-btn {
  background: var(--accent, #4F46E5);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mod-save-group-btn:hover { opacity: 0.85; }
.mod-save-group-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Modifier Row ── */
.mod-slider-list {
  padding: 2px 20px 14px;
}
.mod-row {
  padding: 10px 0 6px;
  border-bottom: 1px solid #f8fafc;
  transition: opacity 0.2s;
}
.mod-row:last-child { border-bottom: none; }
.mod-row-disabled { opacity: 0.4; }
.mod-row-dirty {
  background: #fffbeb;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
}
.mod-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mod-ch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mod-ch-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #1e293b);
  min-width: 90px;
}
.mod-empty {
  padding: 12px 0;
  color: #94a3b8;
  font-size: 13px;
  font-style: italic;
}

/* ── Slider ── */
.mod-slider-wrap {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mod-slider-tick {
  font-size: 10px;
  color: #94a3b8;
  flex-shrink: 0;
  width: 24px;
  font-variant-numeric: tabular-nums;
}
.mod-slider-tick-neg { text-align: right; }
.mod-slider-tick-pos { text-align: left; }

.mod-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #fecaca 0%, #f1f5f9 50%, #bbf7d0 100%);
  outline: none;
  cursor: pointer;
}
.mod-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--slider-color, #94a3b8);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: grab;
  transition: transform 0.1s;
}
.mod-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.mod-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--slider-color, #94a3b8);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: grab;
}

/* ── Percentage Badge ── */
.mod-pct-badge {
  font-size: 13px;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  background: #f1f5f9;
}
.mod-pct-badge.pos { color: #059669; background: #ecfdf5; }
.mod-pct-badge.neg { color: #dc2626; background: #fef2f2; }

/* ── Toggle Switch ── */
.mod-toggle {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.mod-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.mod-toggle-track {
  display: block;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: #cbd5e1;
  transition: background 0.2s;
  position: relative;
}
.mod-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.mod-toggle input:checked + .mod-toggle-track {
  background: #4F46E5;
}
.mod-toggle input:checked + .mod-toggle-track::after {
  transform: translateX(16px);
}

/* ── Save Button (per row) ── */
.mod-save-btn {
  background: #4F46E5;
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.mod-save-btn:hover { opacity: 0.85; }
.mod-save-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Rationale Row ── */
.mod-row-bottom {
  margin-top: 4px;
  padding-left: 20px;
}
.mod-rationale {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  color: #64748b;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}
.mod-rationale:hover {
  background: #f8fafc;
}
.mod-rationale:focus {
  outline: none;
  border-color: #4F46E5;
  background: #fff;
  color: #1e293b;
}
.mod-rationale::placeholder {
  color: #94a3b8;
}

/* ── Preview Section ── */
.mod-preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  align-items: flex-end;
}
.mod-preview-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mod-preview-field label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mod-preview-field input,
.mod-preview-field select {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  min-width: 120px;
  color: var(--text, #1e293b);
  background: #fff;
}
.mod-preview-field input:focus,
.mod-preview-field select:focus {
  outline: none;
  border-color: #4F46E5;
}
.mod-preview-btn {
  background: var(--text, #1e293b);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mod-preview-btn:hover { opacity: 0.85; }
.mod-preview-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Preview Result ── */
.mod-preview-result {
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
}
.mod-preview-channels {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mod-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
}
.mod-preview-header-row {
  padding-bottom: 4px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 2px;
}
.mod-preview-ch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mod-preview-ch-dot-spacer {
  width: 10px;
  flex-shrink: 0;
}
.mod-preview-ch-name {
  font-weight: 500;
  min-width: 90px;
  flex: 1;
}
.mod-preview-ch-val {
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mod-preview-ch-arrow {
  color: #94a3b8;
  font-size: 12px;
  width: 16px;
  text-align: center;
}
.mod-preview-ch-diff {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 4px;
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.mod-preview-ch-diff.pos {
  color: #059669;
  background: #ecfdf5;
}
.mod-preview-ch-diff.neg {
  color: #dc2626;
  background: #fef2f2;
}
.mod-preview-ch-diff-spacer {
  min-width: 32px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .mod-row-top {
    flex-wrap: wrap;
  }
  .mod-slider-wrap {
    min-width: 100%;
    order: 10;
    margin-top: 4px;
  }
  .mod-preview-controls {
    flex-direction: column;
  }
  .mod-preview-field input,
  .mod-preview-field select {
    min-width: 100%;
  }
}
