/* ═══════════════════════════════════════════════════════
   VARIABLES & RESET
═══════════════════════════════════════════════════════ */
:root {
  --primary:       #4E7FA8;
  --primary-dark:  #35607F;
  --primary-light: #EBF3FA;
  --accent:        #6BAE78;
  --accent-light:  #EAF5EC;
  --warn:          #E8925A;
  --warn-light:    #FDF0E8;
  --bg:            #F4F7FB;
  --white:         #FFFFFF;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --border:        #E2E8F0;
  --border-focus:  #4E7FA8;
  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.06);
  --shadow:        0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.12);
  --transition:    .25s ease;
  --font-head:     'Poppins', sans-serif;
  --font-body:     'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.65; min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; color: var(--text); }

.container     { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container--sm { max-width: 680px; }
.container--lg { max-width: 1100px; }

main { flex: 1; padding: 2.5rem 0 4rem; }

/* ── Header ───────────────────────────────────────────── */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); padding: 1rem 0; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header__brand { display: flex; align-items: center; gap: .875rem; }
.site-header__avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.site-header__name { font-family: var(--font-head); font-size: 1.05rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.site-header__title { font-size: .78rem; color: var(--text-muted); }
.site-header__badge { background: var(--primary-light); color: var(--primary-dark); font-size: .75rem; font-weight: 600; padding: .3rem .8rem; border-radius: 100px; font-family: var(--font-head); letter-spacing: .03em; }

/* ── Retour ────────────────────────────────────────────── */
.btn-back { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-muted); font-size: .875rem; font-weight: 500; transition: color var(--transition), gap var(--transition); padding: .35rem 0; }
.btn-back:hover { color: var(--primary); gap: .6rem; }

/* ── Hero accueil ─────────────────────────────────────── */
.page-hero { text-align: center; padding: 3rem 0 2rem; }
.page-hero__icon { width: 72px; height: 72px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; }
.page-hero h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); margin-bottom: .6rem; }
.page-hero p { color: var(--text-muted); font-size: 1rem; max-width: 480px; margin: 0 auto; }

/* ── Cartes audience ──────────────────────────────────── */
.audience-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 2.5rem; }
.audience-card { background: var(--white); border-radius: var(--radius-lg); padding: 2.25rem 2rem; border: 2px solid transparent; box-shadow: var(--shadow); cursor: pointer; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; position: relative; overflow: hidden; }
.audience-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; opacity: 0; transition: opacity var(--transition); }
.audience-card--parents::before { background: var(--primary); }
.audience-card--enseignants::before { background: var(--accent); }
.audience-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.audience-card--parents:hover { border-color: var(--primary); }
.audience-card--enseignants:hover { border-color: var(--accent); }
.audience-card:hover::before { opacity: 1; }
.audience-card__icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.audience-card--parents .audience-card__icon { background: var(--primary-light); color: var(--primary); }
.audience-card--enseignants .audience-card__icon { background: var(--accent-light); color: var(--accent); }
.audience-card__label { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; color: var(--text); }
.audience-card__desc { font-size: .9rem; color: var(--text-muted); line-height: 1.5; }
.audience-card__count { font-size: .82rem; font-weight: 600; padding: .3rem .9rem; border-radius: 100px; margin-top: .25rem; }
.audience-card--parents .audience-card__count { background: var(--primary-light); color: var(--primary-dark); }
.audience-card--enseignants .audience-card__count { background: var(--accent-light); color: #3d7a48; }
.audience-card__arrow { color: var(--text-muted); transition: transform var(--transition), color var(--transition); margin-top: .25rem; }
.audience-card--parents:hover .audience-card__arrow { color: var(--primary); transform: translateX(4px); }
.audience-card--enseignants:hover .audience-card__arrow { color: var(--accent); transform: translateX(4px); }

/* ── Info box ─────────────────────────────────────────── */
.info-box { background: var(--primary-light); border: 1px solid rgba(78,127,168,.2); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; align-items: flex-start; gap: .75rem; margin-top: 2rem; font-size: .875rem; color: var(--primary-dark); }
.info-box svg { flex-shrink: 0; margin-top: 1px; }

/* ── Page header ──────────────────────────────────────── */
.page-header { padding: 1.75rem 0 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.page-header__top { margin-bottom: 1.25rem; }
.page-header__meta { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; flex-wrap: wrap; }
.page-header h1 { font-size: clamp(1.4rem, 3vw, 1.8rem); }

.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; padding: .25rem .7rem; border-radius: 100px; font-family: var(--font-head); letter-spacing: .03em; }
.tag--primary { background: var(--primary-light); color: var(--primary-dark); }
.tag--accent  { background: var(--accent-light); color: #3d7a48; }
.tag--warn    { background: var(--warn-light); color: #9c5a28; }

/* ── Progress overview ────────────────────────────────── */
.progress-overview { background: var(--white); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 1.75rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.progress-overview__text { flex: 1; min-width: 180px; }
.progress-overview__label { font-size: .85rem; color: var(--text-muted); margin-bottom: .3rem; }
.progress-overview__count { font-family: var(--font-head); font-size: 1.1rem; font-weight: 600; color: var(--text); }
.progress-overview__count span { color: var(--primary); }
.progress-bar-wrap { flex: 2; min-width: 160px; }
.progress-bar-track { height: 8px; background: var(--border); border-radius: 100px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%); transition: width .5s ease; }
.progress-bar-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-top: .4rem; }

/* ── Questionnaire list ───────────────────────────────── */
.questionnaire-list { display: flex; flex-direction: column; gap: 1rem; }
.q-card { background: var(--white); border-radius: var(--radius); border: 2px solid var(--border); padding: 1.4rem 1.5rem; display: flex; align-items: center; gap: 1.25rem; cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); position: relative; overflow: hidden; }
.q-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateX(3px); }
.q-card--done { border-color: var(--accent); background: var(--accent-light); }
.q-card--done:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(107,174,120,.2); }
.q-card__number { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: .95rem; font-weight: 700; flex-shrink: 0; }
.q-card:not(.q-card--done) .q-card__number { background: var(--primary-light); color: var(--primary); }
.q-card--done .q-card__number { background: var(--accent); color: #fff; }
.q-card__content { flex: 1; min-width: 0; }
.q-card__name { font-family: var(--font-head); font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .2rem; }
.q-card--done .q-card__name { color: #3d7a48; }
.q-card__desc { font-size: .85rem; color: var(--text-muted); }
.q-card__status { display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; flex-shrink: 0; }
.q-card:not(.q-card--done) .q-card__status { color: var(--primary); }
.q-card--done .q-card__status { color: #3d7a48; }

/* ── Questionnaire form header ────────────────────────── */
.questionnaire-header { background: var(--white); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.questionnaire-header__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.questionnaire-header h2 { font-size: 1.25rem; color: var(--primary-dark); }
.questionnaire-header p { font-size: .875rem; color: var(--text-muted); margin-top: .25rem; }
.q-progress { display: flex; align-items: center; gap: .875rem; }
.q-progress__bar { flex: 1; height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; }
.q-progress__fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%); border-radius: 100px; transition: width .4s ease; }
.q-progress__label { font-size: .8rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; min-width: 44px; text-align: right; }

/* ── Form sections ────────────────────────────────────── */
.form-section { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.form-section__header { padding: 1rem 1.5rem; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; }
.form-section__header h3 { font-size: .95rem; font-weight: 600; color: var(--text); }
.form-section__icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0; }
.form-section__body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

/* ── Form fields ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group--row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group--row .form-group { margin: 0; }
label { font-size: .85rem; font-weight: 500; color: var(--text); }
label .req { color: var(--warn); margin-left: .2rem; }
.form-control { padding: .7rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: .93rem; color: var(--text); background: var(--white); transition: border-color var(--transition), box-shadow var(--transition); outline: none; width: 100%; }
.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(78,127,168,.12); }
.form-control.error { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(232,146,90,.12); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }

/* ── Likert ───────────────────────────────────────────── */
.likert-group { display: flex; flex-direction: column; gap: .6rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.likert-group:last-child { border-bottom: none; padding-bottom: 0; }
.likert-group__label { font-size: .875rem; font-weight: 500; color: var(--text); }
.likert-group__num { display: inline-block; min-width: 22px; color: var(--text-muted); font-weight: 600; }
.likert-options { display: flex; gap: .5rem; }
.likert-option { position: relative; flex: 1; }
.likert-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.likert-option label { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .55rem .4rem; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: .75rem; font-weight: 500; color: var(--text-muted); text-align: center; transition: all var(--transition); line-height: 1.25; min-height: 54px; }
.likert-option input[type="radio"]:checked + label { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.likert-option label:hover { border-color: var(--primary); color: var(--primary-dark); }
.likert-group.has-error .likert-options { outline: 2px solid var(--warn); border-radius: var(--radius-sm); outline-offset: 2px; }

/* ── Boutons ──────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .7rem 1.5rem; border-radius: var(--radius-sm); font-family: var(--font-head); font-size: .9rem; font-weight: 600; letter-spacing: .01em; transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition); white-space: nowrap; }
.btn--lg { padding: .9rem 2rem; font-size: .97rem; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(78,127,168,.4); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover:not(:disabled) { background: #57996b; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(107,174,120,.4); }
.btn--ghost { background: var(--white); color: var(--text-muted); border: 2px solid var(--border); }
.btn--ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem 0 0; flex-wrap: wrap; }

/* ── Loading overlay ──────────────────────────────────── */
.loading-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.88); backdrop-filter: blur(4px); z-index: 200; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.loading-overlay.show { display: flex; }
.loading-spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-overlay p { font-family: var(--font-head); font-size: .95rem; color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Success card ─────────────────────────────────────── */
.success-card { background: var(--white); border-radius: var(--radius-lg); border: 2px solid var(--accent); padding: 3rem 2rem; text-align: center; box-shadow: var(--shadow); max-width: 520px; margin: 2rem auto; display: none; }
.success-card.show { display: block; }
.success-card__icon { width: 72px; height: 72px; background: var(--accent-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; color: var(--accent); }
.success-card h2 { font-size: 1.35rem; margin-bottom: .6rem; color: #3d7a48; }
.success-card p { color: var(--text-muted); font-size: .93rem; margin-bottom: 2rem; }

/* ── Footer ───────────────────────────────────────────── */
.site-footer { background: var(--white); border-top: 1px solid var(--border); padding: 1.25rem 0; text-align: center; font-size: .8rem; color: var(--text-muted); margin-top: auto; }
.site-footer a { color: var(--primary); }
.site-footer a:hover { text-decoration: underline; }

/* ── Animations ───────────────────────────────────────── */
[data-anim] { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
[data-anim].visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .audience-grid { grid-template-columns: 1fr; }
  .form-group--row { grid-template-columns: 1fr; }
  .likert-options { gap: .3rem; }
  .likert-option label { font-size: .7rem; padding: .45rem .3rem; min-height: 48px; }
  .q-card { flex-wrap: wrap; }
  .q-card__status { width: 100%; justify-content: flex-end; }
  .progress-overview { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .questionnaire-header__top { flex-direction: column; }
}
