/* Enquête IA - feuille de style des questionnaires (agents + apprenants)
   Vrais champs de formulaire (labels + input radio/checkbox masqués),
   assistant par étapes, progression, complétion par zone, brouillon.
   Le système d'accent par zone (--acc, --acc-l, --acc-d, --acc-text,
   --acc-badge) est piloté en inline sur chaque .zone. */

:root{
  --bg:#EEF2F6; --bg2:#F7F9FC; --card:#FFFFFF;
  --txt:#16222E; --muted:#5B6B7A; --line:#E2E8EF; --line-soft:#EEF2F6;
  --ok:#1E9E6A; --danger:#C0392B;
  --shadow:0 10px 30px rgba(20,40,70,.07);
  --shadow-sm:0 4px 14px rgba(20,40,70,.06);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  background:
    radial-gradient(1200px 500px at 100% -10%, #E3ECF7 0, transparent 60%),
    radial-gradient(900px 500px at -10% 0, #E7F1EE 0, transparent 55%),
    var(--bg);
  color:var(--txt);
  font-family:"Luciole","Segoe UI",system-ui,sans-serif;
  font-size:17px; line-height:1.6;
  -webkit-text-size-adjust:100%;
}
.wrap{max-width:1120px; margin:0 auto; padding:34px 22px 40px}

/* ---- Masquage accessible des inputs (le label porte le visuel) ---- */
.pill input,.opt input,.seg input,.scale-item input{
  position:absolute; opacity:0; width:1px; height:1px; margin:0; pointer-events:none;
}
.pill,.opt,.seg,.scale-item{position:relative}
.pill:focus-within,.opt:focus-within,.scale-item:focus-within{
  outline:3px solid var(--acc); outline-offset:2px;
}
.seg:focus-within{outline:3px solid var(--acc); outline-offset:-3px}

/* ---- Masquage par branchement de fonction / par étape ---- */
.role-hidden{display:none!important}
.step-off{display:none!important}
.zone.step-in{animation:stepIn .28s ease}
@keyframes stepIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}

/* ---- Barre de progression globale ---- */
.msc-progress{
  position:fixed; top:0; left:0; right:0; height:5px;
  background:rgba(20,40,70,.10); z-index:60;
}
.msc-progress__bar{
  height:100%; width:0;
  background:linear-gradient(90deg,#185FA5,#0E7C86);
  border-radius:0 4px 4px 0; transition:width .35s cubic-bezier(.4,0,.2,1);
}
.msc-progress__pct{
  position:fixed; top:11px; right:12px; z-index:61;
  background:#0C447C; color:#fff; font:700 12.5px/1 "Luciole","Segoe UI",system-ui,sans-serif;
  padding:7px 12px; border-radius:999px; box-shadow:0 4px 14px rgba(12,68,124,.28);
  letter-spacing:.2px; pointer-events:none;
}

/* ---- En-tête ---- */
.head{
  position:relative; overflow:hidden;
  background:linear-gradient(135deg,#0C447C 0%,#185FA5 60%,#1E7B86 130%);
  color:#fff; border-radius:24px; padding:38px 40px; margin-bottom:16px;
  box-shadow:0 16px 40px rgba(12,68,124,.24);
}
.head::after{
  content:""; position:absolute; right:-70px; top:-70px;
  width:240px; height:240px; border-radius:50%;
  background:radial-gradient(circle at center, rgba(255,255,255,.16), transparent 70%);
}
.head h1{margin:0 0 10px; font-size:31px; line-height:1.15; letter-spacing:-.4px}
.head p{margin:0; font-size:17px; opacity:.96; max-width:760px}

.rgpd{
  background:var(--card); border:1px solid var(--line); border-left:5px solid #185FA5;
  border-radius:14px; padding:15px 20px; margin-bottom:28px;
  font-size:15px; color:var(--muted); box-shadow:var(--shadow-sm);
}
.rgpd strong{color:var(--txt)}

/* ---- Zones ---- */
.zone{
  border:1px solid var(--line); border-top:4px solid var(--acc);
  border-radius:20px; overflow:hidden; margin-bottom:22px;
  background:var(--card); box-shadow:var(--shadow);
}
.zone-h{
  background:var(--acc); color:var(--acc-text,#fff);
  padding:16px 24px; display:flex; align-items:center; gap:14px;
}
.badge{
  width:38px; height:38px; border-radius:12px; flex:none;
  background:var(--acc-badge,rgba(255,255,255,.22));
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:16px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.15);
  transition:background .2s;
}
.badge.done{background:var(--ok); color:#fff; box-shadow:none}
.zone-h h2{margin:0; font-size:21px; letter-spacing:-.2px}
.zone-h .sub{font-size:13.5px; opacity:.92; font-weight:600;
  background:rgba(255,255,255,.18); padding:4px 11px; border-radius:999px}
.zcount{margin-left:auto; font-size:13px; font-weight:700;
  background:rgba(255,255,255,.18); padding:4px 11px; border-radius:999px; flex:none}
.zone-b{padding:24px}

.group{margin-bottom:26px}
.group:last-child{margin-bottom:0}
.q{font-weight:700; margin:0 0 12px; font-size:17px}
.q .opt-tag{font-weight:600; color:var(--muted); font-size:13.5px; margin-left:8px;
  background:var(--line-soft); padding:2px 9px; border-radius:999px; white-space:nowrap}

/* ---- Validation : question obligatoire manquante ---- */
.missing{outline:3px solid rgba(192,57,43,.5); outline-offset:5px; border-radius:14px}

/* ---- Choix multiples ---- */
.opts{display:flex; flex-wrap:wrap; gap:10px}
.opt{
  border:2px solid var(--line); border-radius:13px; padding:11px 16px;
  cursor:pointer; user-select:none; background:#fff;
  transition:transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
  display:flex; align-items:center; gap:10px; font-size:16px;
}
.opt:hover{border-color:var(--acc); transform:translateY(-2px); box-shadow:var(--shadow-sm)}
.opt:active{transform:translateY(0)}
.opt .tick{
  width:21px; height:21px; border-radius:7px; border:2px solid var(--line);
  flex:none; display:flex; align-items:center; justify-content:center;
  font-size:13px; color:transparent; transition:.12s;
}
.opt.sel{background:var(--acc-l); border-color:var(--acc); color:var(--acc-d); font-weight:600}
.opt.sel .tick{background:var(--acc); border-color:var(--acc); color:#fff; transform:scale(1.06)}

/* ---- Choix unique (pilules) ---- */
.pills{display:flex; flex-wrap:wrap; gap:9px}
.pill{
  display:inline-flex; align-items:center;
  border:2px solid var(--line); border-radius:999px; padding:9px 18px;
  cursor:pointer; user-select:none; background:#fff; font-size:16px;
  transition:transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.pill:hover{border-color:var(--acc); transform:translateY(-2px); box-shadow:var(--shadow-sm)}
.pill:active{transform:translateY(0)}
.pill.sel{background:var(--acc); border-color:var(--acc); color:#fff; font-weight:600;
  box-shadow:0 6px 16px color-mix(in srgb, var(--acc) 35%, transparent)}

/* ---- Champs texte ---- */
.txt{
  width:100%; border:2px solid var(--line); border-radius:13px;
  padding:12px 14px; font:inherit; background:#fff; margin-top:4px; transition:.12s;
}
.txt:focus{outline:none; border-color:var(--acc); box-shadow:0 0 0 4px var(--acc-l)}
.txt.short{max-width:440px}
textarea.txt{min-height:88px; resize:vertical}
select.txt{cursor:pointer}

/* ---- Grille de fréquence (desktop) ---- */
.freq-legend{
  font-size:14px; color:var(--acc-d); margin:0 0 16px; font-weight:600;
  background:var(--acc-l); border-radius:11px; padding:9px 15px; display:inline-block;
}
.freq{border:1px solid var(--line); border-radius:16px; overflow:hidden; box-shadow:var(--shadow-sm)}
.freq-head{
  display:grid; grid-template-columns:1fr repeat(4,minmax(72px,92px));
  background:#F4F7FA; border-bottom:1px solid var(--line);
  font-size:12.5px; font-weight:800; color:var(--muted); text-transform:uppercase;
  letter-spacing:.4px;
}
.freq-head div{padding:11px 12px; text-align:center}
.freq-head div:first-child{text-align:left}
.freq-row{
  display:grid; grid-template-columns:1fr repeat(4,minmax(72px,92px));
  border-bottom:1px solid var(--line-soft); align-items:stretch;
}
.freq-row:last-child{border-bottom:none}
.freq-row:nth-child(even){background:#FBFCFE}
.freq-row .lab{padding:12px 15px; display:flex; align-items:center; font-size:15.5px}
.seg{
  border-left:1px solid var(--line-soft); cursor:pointer; transition:background .1s;
  display:flex; align-items:center; justify-content:center;
}
.seg:hover{background:var(--acc-l)}
.seg .dot{
  width:19px; height:19px; border-radius:50%; border:2px solid #C3CEDA; transition:.12s; flex:none;
}
.seg.sel{background:var(--acc-l)}
.seg.sel .dot{background:var(--acc); border-color:var(--acc); box-shadow:0 0 0 4px var(--acc-l)}
.seg-txt{display:none} /* visible en mobile uniquement, l'en-tête porte les libellés */

/* ---- Sous-blocs (usages) ---- */
.sub-block{margin-bottom:26px}
.sub-block:last-child{margin-bottom:0}
.sub-title{
  display:flex; align-items:center; gap:10px; font-weight:800; font-size:16px;
  margin:0 0 12px; color:var(--acc-d);
}
.sub-title .ico{
  width:28px; height:28px; border-radius:9px; background:var(--acc-l); flex:none;
  display:flex; align-items:center; justify-content:center; font-size:15px; color:var(--acc-d);
}

.z3-prompt{
  border:2px dashed var(--acc); border-radius:16px; background:var(--acc-l);
  padding:22px 24px; color:var(--acc-d); font-weight:600; text-align:center;
}

/* ---- Échelle graduée ---- */
.scale{display:flex; gap:10px; max-width:620px; flex-wrap:wrap}
.scale-item{
  display:block; flex:1; min-width:120px; cursor:pointer; user-select:none; text-align:center;
  border:2px solid var(--line); border-radius:15px; padding:15px 8px;
  background:#fff; transition:transform .14s ease, border-color .14s, background .14s, box-shadow .14s;
}
.scale-item:hover{border-color:var(--acc); transform:translateY(-2px); box-shadow:var(--shadow-sm)}
.scale-item .num{
  width:36px; height:36px; border-radius:50%; margin:0 auto 8px;
  display:flex; align-items:center; justify-content:center;
  font-weight:800; border:2px solid var(--line); color:var(--muted); transition:.14s;
}
.scale-item .lab{display:block; font-size:14px; color:var(--muted); line-height:1.3}
.scale-item.sel{background:var(--acc-l); border-color:var(--acc)}
.scale-item.sel .num{background:var(--acc); border-color:var(--acc); color:#fff; transform:scale(1.05)}
.scale-item.sel .lab{color:var(--acc-d); font-weight:700}

/* ---- Barre de navigation de l'assistant ---- */
.wiz-nav{
  position:sticky; bottom:12px; z-index:30;
  display:flex; flex-direction:column; gap:10px;
  background:rgba(255,255,255,.94); backdrop-filter:blur(8px);
  border:1px solid var(--line); border-radius:16px; padding:12px 14px;
  box-shadow:0 12px 34px rgba(20,40,70,.16); margin-top:18px;
}
.wiz-meta{display:flex; justify-content:space-between; align-items:center;
  font-size:13px; color:var(--muted); font-weight:700}
.wiz-restart{background:none; border:none; color:var(--muted); text-decoration:underline;
  cursor:pointer; font:inherit; font-size:13px; padding:0}
.wiz-restart:hover{color:var(--danger)}
.wiz-row{display:flex; gap:10px; align-items:center}
.wiz-btn{
  background:#fff; border:2px solid var(--line); border-radius:12px; padding:11px 18px;
  font:inherit; font-weight:700; font-size:15.5px; cursor:pointer; transition:.12s;
}
.wiz-btn:hover{border-color:#185FA5}
.wiz-btn:disabled{opacity:.35; cursor:default}
.wiz-btn.next{
  background:linear-gradient(135deg,#0C447C,#185FA5); color:#fff; border-color:transparent;
  margin-left:auto; box-shadow:0 6px 16px rgba(12,68,124,.25);
}
.wiz-btn.next:hover{box-shadow:0 10px 22px rgba(12,68,124,.32)}
.wiz-dots{display:flex; gap:6px; align-items:center; flex:1; justify-content:center; flex-wrap:wrap}
.wiz-dot{
  width:30px; height:30px; border-radius:50%; border:2px solid var(--line); background:#fff;
  font-family:inherit; font-size:13px; font-weight:700; color:var(--muted);
  cursor:pointer; padding:0; transition:.15s;
}
.wiz-dot:hover{border-color:#185FA5}
.wiz-dot.on{border-color:#185FA5; color:#0C447C; box-shadow:0 0 0 3px #E6F1FB}
.wiz-dot.done{background:var(--ok); border-color:var(--ok); color:#fff}
.wiz-msg{
  display:none; background:#FDECEA; border:1px solid #F5C6C0; color:#8C2B22;
  border-radius:12px; padding:10px 14px; font-size:14.5px;
}
.wiz-msg.show{display:block}
.wiz-msg button{
  background:none; border:none; color:#8C2B22; font-weight:700; text-decoration:underline;
  cursor:pointer; font:inherit; font-size:14.5px; padding:0;
}

/* ---- Envoi ---- */
.submit{
  background:linear-gradient(135deg,#0C447C,#185FA5); color:#fff; border:none; border-radius:13px;
  padding:12px 30px; font:inherit; font-weight:800; font-size:16.5px; cursor:pointer;
  box-shadow:0 8px 20px rgba(12,68,124,.28); transition:transform .12s, box-shadow .12s, filter .12s;
  margin-left:auto;
}
.submit:hover{transform:translateY(-2px); box-shadow:0 12px 26px rgba(12,68,124,.34)}
.submit:active{transform:translateY(0)}
.submit:disabled{filter:grayscale(.3) opacity(.8); cursor:default; transform:none; box-shadow:none}
.note{font-size:13px; color:var(--muted); margin-top:6px}

.req{color:var(--danger); font-weight:700; margin-left:4px}

/* ---- Écran de remerciement ---- */
.merci{
  background:var(--card); border:1px solid var(--line); border-top:5px solid var(--ok);
  border-radius:20px; padding:44px; max-width:640px; margin:48px auto; text-align:center;
  box-shadow:var(--shadow);
}
.merci-ok{
  width:74px; height:74px; border-radius:50%; background:var(--ok); color:#fff;
  font-size:40px; font-weight:800; display:flex; align-items:center; justify-content:center;
  margin:0 auto 18px; box-shadow:0 10px 26px rgba(30,158,106,.35);
  animation:pop .55s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop{0%{transform:scale(0)}70%{transform:scale(1.12)}100%{transform:scale(1)}}
.merci h2{margin:0 0 10px; color:#0C447C; font-size:27px}
.merci p{margin:0 0 18px; color:var(--muted); font-size:17px}
.merci a{color:#185FA5; font-weight:700; text-decoration:none}
.merci a:hover{text-decoration:underline}

/* ============================================================
   MOBILE  (≤ 640px) : grille de fréquence en cartes 2×2,
   navigation compacte de l'assistant.
   ============================================================ */
@media (max-width:640px){
  .wrap{padding:20px 14px 24px}
  .head{padding:26px 22px; border-radius:20px}
  .head h1{font-size:25px}
  .head p{font-size:15.5px}
  .zone-b{padding:18px 15px}
  .zone-h{padding:14px 18px}
  .zone-h h2{font-size:19px}
  .zone-h .sub{display:none}
  .q .opt-tag{display:inline-block; margin:6px 0 0}

  .freq{border:none; border-radius:0; box-shadow:none; overflow:visible; background:transparent}
  .freq-head{display:none}
  .freq-row,
  .freq-row:nth-child(even){
    display:grid; grid-template-columns:1fr 1fr; gap:9px; background:#fff;
    border:1.5px solid var(--line); border-radius:15px; padding:13px 13px 12px; margin-bottom:12px;
    box-shadow:var(--shadow-sm);
  }
  .freq-row .lab{grid-column:1 / -1; padding:0 2px 6px; font-weight:700; font-size:16px}
  .seg{
    border:1.5px solid var(--line); border-radius:12px; padding:12px 10px; gap:10px;
    justify-content:flex-start; min-height:50px;
  }
  .seg:hover{background:#fff}
  .seg .dot{width:22px; height:22px}
  .seg-txt{display:block; font-size:15px; font-weight:600; color:var(--txt)}
  .seg.sel{background:var(--acc-l); border-color:var(--acc)}
  .seg.sel .seg-txt{color:var(--acc-d); font-weight:700}

  .scale-item{min-width:0; flex:1 1 40%}

  .wiz-nav{bottom:8px; padding:10px 12px}
  .wiz-row{flex-wrap:wrap}
  .wiz-dots{flex:0 0 100%; order:-1; margin-bottom:2px}
  .zone-h h2{min-width:0} /* autorise la réduction dans l'en-tête flex */
  .wiz-dot{width:27px; height:27px; font-size:12px}
  .wiz-btn{flex:1; padding:12px 10px; text-align:center}
  .wiz-btn.next{margin-left:0}
  .submit{flex:1; margin-left:0; padding:13px 10px}
}
