/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bleu:       #1c3d6e;
  --bleu-clair: #2f6eb5;
  --bleu-pale:  #e8f0fb;
  --vert:       #1a7a4a;
  --orange:     #d4670a;
  --rouge:      #b91c1c;
  --gris-1:     #f4f6f9;
  --gris-2:     #e5e9ef;
  --gris-3:     #9ca3af;
  --gris-text:  #374151;
  --blanc:      #ffffff;
  --radius:     8px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--gris-1);
  color: var(--gris-text);
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--bleu);
  color: var(--blanc);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
}
header h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: .02em; }
header span { font-size: .8rem; opacity: .6; }

/* ── Steps bar ───────────────────────────────────────────────────────────── */
#steps-bar {
  background: var(--blanc);
  border-bottom: 1px solid var(--gris-2);
  padding: .75rem 2rem;
  display: flex;
  gap: 0;
  align-items: center;
}
.step {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--gris-3);
  font-weight: 500;
}
.step.active { color: var(--bleu-clair); }
.step.done   { color: var(--vert); }
.step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  background: var(--gris-2);
  color: var(--gris-3);
  flex-shrink: 0;
}
.step.active .step-num { background: var(--bleu-clair); color: var(--blanc); }
.step.done   .step-num { background: var(--vert); color: var(--blanc); }
.step-sep { width: 40px; height: 1px; background: var(--gris-2); margin: 0 .5rem; }

/* ── Main layout ─────────────────────────────────────────────────────────── */
main { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; }

.screen { display: none; }
.screen.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--bleu);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Drop zone ───────────────────────────────────────────────────────────── */
#drop-zone {
  border: 2px dashed var(--gris-2);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
#drop-zone:hover, #drop-zone.drag-over {
  border-color: var(--bleu-clair);
  background: var(--bleu-pale);
}
#drop-zone p { color: var(--gris-3); font-size: .9rem; margin-top: .5rem; }
#drop-zone .icon { font-size: 2.5rem; }
#file-info {
  display: none;
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: var(--bleu-pale);
  border-radius: var(--radius);
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
#file-info.hidden { display: none; }
#file-info .file-name { font-weight: 600; color: var(--bleu); }
#file-info .change-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--bleu-clair);
  cursor: pointer;
  font-size: .82rem;
  text-decoration: underline;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; flex: 1; }
label { font-size: .82rem; font-weight: 600; color: var(--bleu); }
select, input[type="text"] {
  padding: .55rem .75rem;
  border: 1px solid var(--gris-2);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--gris-text);
  background: var(--blanc);
  outline: none;
  transition: border-color .2s;
}
select:focus, input[type="text"]:focus { border-color: var(--bleu-clair); }

/* ── Participants ────────────────────────────────────────────────────────── */
#participants-count { font-size: .8rem; color: var(--gris-3); margin-left: auto; }
#participants-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; min-height: 20px; }

.participant-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .75rem;
  background: var(--gris-1);
  border-radius: 6px;
  font-size: .85rem;
}
.participant-item .badge {
  font-size: .7rem;
  padding: .1rem .45rem;
  border-radius: 99px;
  font-weight: 600;
}
.badge-membre  { background: var(--bleu-pale);      color: var(--bleu); }
.badge-invite  { background: #fef3e8;               color: var(--orange); }
.participant-item .role { color: var(--gris-3); font-size: .78rem; }
.participant-item .remove {
  margin-left: auto; background: none; border: none;
  color: var(--gris-3); cursor: pointer; font-size: 1rem; line-height: 1;
}
.participant-item .remove:hover { color: var(--rouge); }

.import-zone {
  border: 1px dashed var(--gris-2);
  border-radius: 6px;
  padding: .65rem 1rem;
  font-size: .82rem;
  color: var(--gris-3);
  cursor: pointer;
  text-align: center;
  margin-bottom: .75rem;
  transition: border-color .2s;
}
.import-zone:hover { border-color: var(--bleu-clair); color: var(--bleu-clair); }

.add-row { display: flex; gap: .5rem; }
.add-row input { flex: 1; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: .6rem 1.25rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--bleu); color: var(--blanc); }
.btn-primary:not(:disabled):hover { background: var(--bleu-clair); }
.btn-secondary { background: var(--gris-2); color: var(--gris-text); }
.btn-secondary:not(:disabled):hover { background: var(--gris-3); color: var(--blanc); }
.btn-success { background: var(--vert); color: var(--blanc); }
.btn-launch {
  width: 100%;
  padding: .9rem;
  font-size: 1rem;
  background: var(--bleu);
  color: var(--blanc);
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: background .2s;
}
.btn-launch:not(:disabled):hover { background: var(--bleu-clair); }
.btn-launch:disabled { opacity: .45; cursor: not-allowed; }

/* ── Screen 2 — Traitement ───────────────────────────────────────────────── */
.steps-list { display: flex; flex-direction: column; gap: .75rem; }
.step-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  background: var(--gris-1);
}
.step-item.pending { opacity: .45; }
.step-item.active  { background: var(--bleu-pale); }
.step-item.done    { background: #f0fdf4; }
.step-icon { font-size: 1.3rem; flex-shrink: 0; }
.step-label { font-size: .9rem; font-weight: 600; }
.step-sub   { font-size: .78rem; color: var(--gris-3); margin-top: .15rem; }

.pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.eta { text-align: center; color: var(--gris-3); font-size: .85rem; margin-top: 1.5rem; }

/* ── Screen 3 — Attribution ──────────────────────────────────────────────── */
.chips-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.chip {
  padding: .35rem .85rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--gris-2);
  color: var(--gris-3);
}
.chip.current { background: var(--bleu); color: var(--blanc); }
.chip.done    { background: var(--vert); color: var(--blanc); }

.speaker-card {
  border: 2px solid var(--gris-2);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  opacity: .55;
  transition: opacity .2s, border-color .2s;
}
.speaker-card.current { opacity: 1; border-color: var(--bleu-clair); }
.speaker-card.done    { opacity: 1; border-color: var(--vert); }

.speaker-card-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.25rem;
  background: var(--gris-1);
}
.speaker-id { font-weight: 700; color: var(--bleu); font-size: 1rem; }
.speaker-stats { font-size: .78rem; color: var(--gris-3); }
.speaker-assigned { font-size: .82rem; color: var(--vert); font-weight: 600; margin-left: auto; }
.speaker-edit { background: none; border: none; color: var(--bleu-clair); cursor: pointer; font-size: .78rem; text-decoration: underline; margin-left: .5rem; }

.speaker-card-body { padding: 1rem 1.25rem; }

.samples { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.play-btn {
  display: flex; align-items: center; gap: .35rem;
  padding: .3rem .65rem;
  border: 1px solid var(--gris-2);
  border-radius: 6px;
  background: var(--blanc);
  cursor: pointer;
  font-size: .78rem;
  color: var(--bleu);
  transition: background .15s;
}
.play-btn:hover { background: var(--bleu-pale); }
.play-btn.playing { background: var(--bleu-pale); border-color: var(--bleu-clair); }

.first-text {
  font-style: italic;
  font-size: .82rem;
  color: var(--gris-3);
  margin-bottom: .85rem;
  border-left: 3px solid var(--gris-2);
  padding-left: .75rem;
}

.speaker-select {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--gris-2);
  border-radius: 6px;
  font-size: .9rem;
  margin-bottom: .6rem;
}
.validate-btn {
  padding: .5rem 1.1rem;
  background: var(--bleu);
  color: var(--blanc);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}
.validate-btn:hover { background: var(--bleu-clair); }

/* ── Screen 4 — Génération ───────────────────────────────────────────────── */
.prompt-header { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.prompt-header select { flex: 1; }

#prompt-editor {
  width: 100%;
  min-height: 180px;
  padding: .75rem;
  border: 1px solid var(--gris-2);
  border-radius: 6px;
  font-size: .82rem;
  font-family: 'Courier New', monospace;
  resize: vertical;
  line-height: 1.5;
}

#cr-preview {
  background: var(--gris-1);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 200px;
  font-size: .88rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
#cr-preview h1, #cr-preview h2, #cr-preview h3 { margin: .75rem 0 .4rem; color: var(--bleu); }

.action-bar { display: flex; gap: .75rem; align-items: center; margin-top: 1rem; }
.token-info { font-size: .78rem; color: var(--gris-3); margin-left: auto; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.warning-banner {
  background: #fef3e8;
  border-left: 4px solid var(--orange);
  padding: .6rem .9rem;
  border-radius: 4px;
  font-size: .82rem;
  color: var(--orange);
  margin-bottom: 1rem;
}
.error-banner {
  background: #fef2f2;
  border-left: 4px solid var(--rouge);
  padding: .6rem .9rem;
  border-radius: 4px;
  font-size: .82rem;
  color: var(--rouge);
  margin-bottom: 1rem;
}
.hidden { display: none !important; }
#audio-player { display: none; }
