/* WSC Intake — feuille unique, sans dépendance. Charte WSC : marine #1B3A6B, bleu #6E8FC0, noir #080807, Figtree. */

@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin-wght-normal.woff2?v=1") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --fond: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --ligne: #dde2e9;
  --texte: #101828;
  --texte-2: #475467;
  --texte-3: #5d6b82;
  --marine: #1b3a6b;
  --marine-vif: #22488a;
  --accent: #1b3a6b;
  --bulle-moi: #1b3a6b;
  --bulle-moi-texte: #ffffff;
  --bulle-elle: #ffffff;
  --danger: #b42318;
  --danger-fond: #fef3f2;
  --succes: #067647;
  --attention: #b54708;
  --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --rayon: 18px;
  --largeur: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #080807;
    --surface: #141412;
    --surface-2: #1c1c19;
    --ligne: #2a2a26;
    --texte: #f2f2ef;
    --texte-2: #c2c2ba;
    --texte-3: #9a9a92;
    --accent: #9db4d9;
    --bulle-moi: #1b3a6b;
    --bulle-elle: #141412;
    --danger: #f97066;
    --danger-fond: #2a1412;
    --succes: #47cd89;
    --attention: #fdb022;
    --ombre: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 400 16px/1.5 "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icone { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
:focus-visible { outline: 3px solid var(--marine-vif); outline-offset: 2px; border-radius: 6px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: #9db4d9; } }

/* ── Mise en page ─────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: var(--largeur);
  margin: 0 auto;
}
.app.page { height: auto; min-height: 100dvh; }

.entete {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--ligne);
  background: var(--fond);
}
.entete .bouton.texte { margin-left: auto; }
.marque { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--texte); text-decoration: none; }
.marque .point { opacity: .4; }
.sigle {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--marine) url("../img/sigle-wsc-white.png") center / 18px no-repeat;
}
.identite { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.identite strong { font-weight: 650; font-size: 15px; }
.identite span { font-size: 13px; color: var(--texte-3); }

.progression { padding: 8px 16px 10px; border-bottom: 1px solid var(--ligne); font-size: 13px; color: var(--texte-2); }
.progression label { display: block; margin-bottom: 4px; }
progress {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border: 0; border-radius: 99px; overflow: hidden;
  background: var(--surface-2); color: var(--marine);
}
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--marine); border-radius: 99px; transition: width .6s ease; }
progress::-moz-progress-bar { background: var(--marine); border-radius: 99px; }
@media (prefers-color-scheme: dark) {
  progress::-webkit-progress-value { background: #6e8fc0; }
  progress::-moz-progress-bar { background: #6e8fc0; }
}

/* ── Fil de la conversation ───────────────────────────────────────────── */
.fil {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bulle {
  max-width: 86%;
  padding: 10px 14px 6px;
  border-radius: var(--rayon);
  overflow-wrap: anywhere;
  animation: apparition .18s ease-out;
}
.bulle.assistante {
  align-self: flex-start;
  background: var(--bulle-elle);
  border: 1px solid var(--ligne);
  border-bottom-left-radius: 6px;
  box-shadow: var(--ombre);
}
.bulle.moi {
  align-self: flex-end;
  background: var(--bulle-moi);
  color: var(--bulle-moi-texte);
  border-bottom-right-radius: 6px;
}
.bulle.moi a { color: inherit; }
.bulle ul { margin: 6px 0; padding-left: 20px; }
.bulle time { display: block; text-align: right; font-size: 11px; opacity: .6; margin-top: 2px; }
.bulle img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; margin-bottom: 4px; }
.bulle.envoi { opacity: .75; }
.bulle.en-attente::after { content: " ⏳"; }
.bulle .analyse, .ecrit-vocal { display: block; font-size: 13px; opacity: .85; }
.marque-vocal { display: inline-flex; margin-right: 4px; opacity: .8; }
.marque-vocal .icone { width: 16px; height: 16px; vertical-align: -3px; }
.fichier { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }

.ecrit { display: inline-flex; gap: 4px; padding: 6px 0; }
.ecrit i { width: 7px; height: 7px; border-radius: 50%; background: var(--texte-3); animation: rebond 1.2s infinite; }
.ecrit i:nth-child(2) { animation-delay: .15s; }
.ecrit i:nth-child(3) { animation-delay: .3s; }

.annonce {
  align-self: center; text-align: center; margin: 4px 0; padding: 6px 12px; max-width: 92%;
  font-size: 13px; color: var(--texte-2); background: var(--surface-2); border-radius: 12px;
}
.annonce.erreur { color: var(--danger); background: var(--danger-fond); }
.annonce button { margin-left: 6px; }

.choix { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.puce {
  min-height: 44px; padding: 8px 14px; border-radius: 22px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--ligne); color: var(--texte); font-weight: 550;
  box-shadow: var(--ombre); transition: background .15s, border-color .15s, transform .1s;
}
.puce:hover { border-color: var(--marine); }
.puce:active { transform: scale(.97); }
.puce.mise-en-avant { background: var(--marine); border-color: var(--marine); color: #fff; }

.rassurance {
  display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; margin: 8px 0 0;
  font-size: 13px; color: var(--texte-2);
}
.rassurance .icone { width: 16px; height: 16px; color: var(--succes); margin-right: 4px; vertical-align: -3px; }

.reprise {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px;
}

/* ── Envoi du dossier ─────────────────────────────────────────────────── */
.pret {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--ligne); background: var(--surface);
  font-size: 13px; color: var(--texte-2);
}
.pret form { margin: 0; }

/* ── Saisie ───────────────────────────────────────────────────────────── */
.saisie { padding: 8px 12px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ligne); background: var(--fond); }
.barre { display: flex; align-items: flex-end; gap: 8px; margin: 0; }
.barre textarea {
  flex: 1; min-height: 44px; max-height: 140px; resize: none; padding: 10px 14px;
  border-radius: 22px; border: 1px solid var(--ligne); background: var(--surface); line-height: 1.4;
}
.barre textarea:focus { outline: none; border-color: var(--marine); box-shadow: 0 0 0 3px rgba(27, 58, 107, .18); }
.bouton-icone, .bouton-envoyer {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--texte-2);
}
.bouton-icone:hover { background: var(--surface-2); }
.bouton-envoyer { background: var(--marine); color: #fff; }
.bouton-envoyer:hover { background: var(--marine-vif); }
.barre .bouton-envoyer { display: none; }
.barre.a-du-texte .bouton-envoyer { display: inline-flex; }
.barre.a-du-texte .micro { display: none; }
.barre .micro { background: var(--marine); color: #fff; }
.enregistrement {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; font-weight: 550;
}
.enregistrement > span:nth-child(2) { flex: 1; }
.voyant { width: 10px; height: 10px; border-radius: 50%; background: #d92d20; animation: pulsation 1s infinite; }

/* ── Boutons ──────────────────────────────────────────────────────────── */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; text-decoration: none; line-height: 1.2;
}
.bouton.petit { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.bouton.principal { background: var(--marine); color: #fff; }
.bouton.principal:hover { background: var(--marine-vif); }
.bouton.secondaire { background: var(--surface); border-color: var(--ligne); color: var(--texte); }
.bouton.secondaire:hover { border-color: var(--marine); }
.bouton.texte { background: transparent; color: var(--texte-2); padding-inline: 8px; }
.bouton.texte:hover { color: var(--texte); }

/* ── Menu ─────────────────────────────────────────────────────────────── */
dialog {
  width: min(440px, calc(100% - 24px)); padding: 0; border: 1px solid var(--ligne); border-radius: 18px;
  background: var(--surface); color: var(--texte); box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(8, 8, 7, .45); }
.dialogue { padding: 8px 16px 16px; }
.dialogue-tete { display: flex; align-items: center; justify-content: space-between; }
.dialogue h2 { font-size: 17px; margin: 0; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 4px;
  background: none; border: 0; border-bottom: 1px solid var(--ligne); text-align: left; cursor: pointer;
  color: var(--texte); text-decoration: none; font-weight: 550;
}
.plus-tard h3 { font-size: 15px; margin: 16px 0 4px; }
.plus-tard p { margin: 0 0 8px; font-size: 14px; color: var(--texte-2); }
.plus-tard input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--ligne); background: var(--surface-2); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ── Page de remerciement ─────────────────────────────────────────────── */
.contenu-page { padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.contenu-page h1 { font-size: 24px; line-height: 1.25; margin: 0; }
.echeance { margin: 0; font-size: 17px; color: var(--texte-2); }
.pastille-succes { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--marine); color: #fff; }
.pastille-succes .icone { width: 28px; height: 28px; stroke-width: 2.2; }
.carte { background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 16px; box-shadow: var(--ombre); }
.carte h2 { font-size: 16px; margin: 0 0 8px; }
.recap { margin: 0; display: grid; gap: 8px; }
.recap div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; }
.recap dt { color: var(--texte-3); font-size: 14px; }
.recap dd { margin: 0; }
.etapes { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.actions-page { display: flex; flex-wrap: wrap; gap: 10px; }

@keyframes apparition { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes rebond { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes pulsation { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 760px) {
  .app { border-inline: 1px solid var(--ligne); }
  .fil { padding: 20px 24px 8px; }
  .bulle { max-width: 78%; }
}
