/* ============================================================
   Jenna's World — composants secondaires (v7 « Charcoal Rose »)
   Scripts, presets Voice & Style, Lists, Referrals, aperçu persona.
   Aucune couleur en dur : tout vient des tokens de style.css.
   ============================================================ */

/* ---------- Éditeur d'étapes (page Scripts) ---------- */
.steps-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--step-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  transition: background var(--ease), border-color var(--ease);
}
.step-row:hover { background: var(--step-hover); border-color: var(--border-strong); }
.step-idx {
  color: var(--text3);
  font-size: 12px;
  font-weight: 600;
  min-width: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.step-preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text2);
  word-break: break-word;
}

/* ---------- Referrals ---------- */
.ref-link-row { display: flex; align-items: center; gap: 8px; }
.ref-link {
  flex: 1;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 5px 9px;
  color: var(--text2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ref-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 550;
  user-select: none;
}
.ref-details table { margin-top: 10px; }

.table-sm th, .table-sm td {
  padding: 6px 10px !important;
  font-size: 12px;
}
.inactive-row { opacity: 0.55; }

/* ============================================================
   Voice & Style — presets
   ============================================================ */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  align-items: start; /* chaque carte à sa hauteur — pas d'étirement */
}
.preset-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}
.preset-card:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.preset-card.in-use {
  border-color: var(--accent-border-hover);
  box-shadow: 0 0 0 1px var(--accent-border-soft), var(--shadow-md);
}
.preset-card.in-use::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px 110px at 100% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.preset-card.inactive { opacity: 0.6; }
.preset-card > * { position: relative; }

.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.preset-head h4 { font-size: 14.5px; font-weight: 620; letter-spacing: -0.016em; }
.preset-builtin {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
}
.preset-desc { font-size: 13px; color: var(--text2); margin: 0; line-height: 1.55; }
.preset-emojis { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.preset-emojis .ctx { color: var(--text3); margin-right: 8px; font-size: 12px; }
/* Aperçu des règles : dégradé de fin de zone pour que la coupe se lise
   comme « il y a la suite » et non comme un texte tronqué. */
.preset-rules-preview {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px 16px;
  margin: 0;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
}
.preset-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.preset-card-none { border-style: dashed; justify-content: flex-start; }
.preset-card-none .preset-actions { margin-top: auto; }

/* ---------- Progression de la fiche créatrice ---------- */
.progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--track-bg);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent-grad);
  transition: width 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Statut du persona ---------- */
.persona-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.persona-status-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Fiche créatrice sectionnée ---------- */
.creator-section {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px 8px;
  margin: 0 0 16px;
  background: var(--tint);
}
.creator-section legend {
  font-weight: 620;
  font-size: 13px;
  padding: 0 8px;
  color: var(--text);
}
.creator-section-hint { margin: -2px 0 12px; font-size: 12.5px; color: var(--text3); }

/* ---------- Aperçu du persona ---------- */
.preview-block { margin-bottom: 14px; }
.preview-block h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--text3);
}
.preview-block pre, .preview-full pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
}
.preview-full summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--accent);
  margin-bottom: 10px;
  user-select: none;
}

/* ============================================================
   Lists — cartes d'audience
   ============================================================ */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}
.list-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}
.list-card:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.list-card h4 { font-size: 14.5px; font-weight: 620; letter-spacing: -0.016em; }
.list-card .muted { font-size: 12.5px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
