/* ==========================================================================
   Questionnaire Satisfaction · Enquête satisfaction collaborateurs
   Thème « aurora » : fond sombre, cartes en verre, accents dégradés.
   ========================================================================== */

:root {
    --bg: #0b0b1f;
    --card: rgba(255, 255, 255, .055);
    --card-strong: rgba(255, 255, 255, .09);
    --stroke: rgba(255, 255, 255, .12);
    --text: #f4f4ff;
    --muted: #a7a7c9;
    --violet: #7c3aed;
    --pink: #ec4899;
    --amber: #f59e0b;
    --good: #22c55e;
    --mid: #f59e0b;
    --bad: #f43f5e;
    --grad: linear-gradient(135deg, #7c3aed 0%, #ec4899 55%, #f59e0b 100%);
    --radius: 22px;
    --shadow: 0 20px 60px -20px rgba(124, 58, 237, .45);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    overflow-x: hidden;
}

a { color: #c4b5fd; text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 10px; }

/* ---------- Fond animé ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
    position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
    filter: blur(90px); opacity: .45; animation: float 18s ease-in-out infinite;
}
.aurora span:nth-child(1) { background: #7c3aed; top: -25vmax; left: -20vmax; }
.aurora span:nth-child(2) { background: #ec4899; bottom: -30vmax; right: -20vmax; animation-delay: -6s; }
.aurora span:nth-child(3) { background: #f59e0b; top: 30%; left: 40%; width: 40vmax; height: 40vmax; opacity: .18; animation-delay: -12s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.08); }
}

/* ---------- Barre du haut ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(11, 11, 31, .6);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--stroke);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 18px; }
.brand:hover { text-decoration: none; }
.logo {
    width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
    background: var(--grad); font-weight: 800; box-shadow: var(--shadow);
}
.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav .hello { color: var(--muted); font-size: 14px; margin-right: 6px; }
.nav a.link { color: var(--text); font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.nav a.link:hover { background: var(--card-strong); text-decoration: none; }

/* ---------- Conteneur & transitions ---------- */
.container { width: min(960px, 100% - 32px); margin: 0 auto; padding: clamp(24px, 5vw, 56px) 0 60px; outline: none; }
.view { animation: fadeUp .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Typographie ---------- */
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -.02em; }
h2 { font-size: clamp(22px, 3vw, 28px); margin: 0 0 6px; letter-spacing: -.01em; }
h3 { font-size: 18px; margin: 0 0 6px; }
.grad-text {
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow {
    display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    padding: 6px 12px; border-radius: 999px; background: var(--card-strong); border: 1px solid var(--stroke); margin-bottom: 16px;
}

/* ---------- Cartes ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: clamp(18px, 3vw, 28px);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 30px 60px -40px rgba(0, 0, 0, .8);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ---------- Boutons ---------- */
.btn {
    appearance: none; border: 1px solid var(--stroke); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; border-radius: 14px; font: inherit; font-weight: 700; color: var(--text);
    background: var(--card-strong); transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
    text-decoration: none !important;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn.primary { background: var(--grad); border-color: transparent; box-shadow: var(--shadow); }
.btn.primary:hover { box-shadow: 0 24px 60px -18px rgba(236, 72, 153, .6); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.lg { padding: 16px 28px; font-size: 17px; }
.btn.sm { padding: 9px 14px; font-size: 14px; border-radius: 11px; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field > span, legend { font-size: 14px; font-weight: 600; color: #dcdcf5; }
input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%; font: inherit; color: var(--text);
    background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke);
    border-radius: 14px; padding: 14px 16px; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px rgba(236, 72, 153, .18); background: rgba(255, 255, 255, .08); }
textarea { min-height: 120px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); }
.count { font-size: 12px; color: var(--muted); text-align: right; }
.form-error { color: #fda4af; background: rgba(244, 63, 94, .12); border: 1px solid rgba(244, 63, 94, .3); padding: 10px 14px; border-radius: 12px; font-size: 14px; display: none; }
.form-error.show { display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-block; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, .04); font-size: 14px; font-weight: 600; transition: all .2s;
}
.chip:hover span { transform: translateY(-1px); border-color: rgba(255, 255, 255, .3); }
.chip input:checked + span { background: var(--grad); border-color: transparent; box-shadow: var(--shadow); }
.chip input:focus-visible + span { outline: 3px solid var(--pink); outline-offset: 3px; }

fieldset { border: 0; margin: 0; padding: 0; }

/* ---------- Accueil ---------- */
.hero { padding: clamp(10px, 4vw, 30px) 0 10px; }
.hero p.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 620px; margin: 0 0 26px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.pill { font-size: 13px; color: var(--muted); padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--stroke); }
.pill b { color: var(--text); }

.sections-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 26px; }
.section-tile {
    padding: 20px; border-radius: 18px; background: var(--card); border: 1px solid var(--stroke);
    transition: transform .2s, border-color .2s;
}
.section-tile:hover { transform: translateY(-3px); border-color: rgba(236, 72, 153, .5); }
.section-tile .ico { font-size: 28px; }
.section-tile .t { font-weight: 700; margin-top: 8px; }
.section-tile .m { font-size: 13px; color: var(--muted); }

/* ---------- Authentification ---------- */
.auth { max-width: 460px; margin: 0 auto; }
.auth h1 { font-size: clamp(28px, 5vw, 36px); }

/* ---------- Enquête ---------- */
.progress-wrap {
    position: fixed; left: 0; right: 0; top: 0; z-index: 30; height: 4px; background: rgba(255, 255, 255, .08);
}
.progress-bar { height: 100%; width: 0; background: var(--grad); box-shadow: 0 0 18px rgba(236, 72, 153, .7); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.progress-meta {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
    font-size: 14px; color: var(--muted); margin-bottom: 26px; margin-top: 8px;
}
.progress-meta strong { color: var(--text); }
.stepper { display: flex; gap: 6px; margin-bottom: 26px; flex-wrap: wrap; }
.stepper span { height: 6px; flex: 1 1 36px; border-radius: 6px; background: rgba(255, 255, 255, .1); transition: background .3s; }
.stepper span.done { background: rgba(236, 72, 153, .55); }
.stepper span.current { background: var(--grad); }

.step { animation: fadeUp .4s cubic-bezier(.2, .8, .2, 1) both; }
.step-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.badge {
    flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
    background: var(--grad); font-weight: 800; font-size: 22px; box-shadow: var(--shadow);
}
.step-head p { margin: 0; color: var(--muted); }

.scale-legend {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 22px; padding: 12px;
    background: var(--card); border: 1px solid var(--stroke); border-radius: 16px; font-size: 12px; color: var(--muted); text-align: center;
}
.scale-legend b { display: block; font-size: 20px; margin-bottom: 2px; }

.group-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #c4b5fd; margin: 28px 0 12px; }

.item {
    background: var(--card); border: 1px solid var(--stroke); border-radius: 18px; padding: 18px;
    margin-bottom: 12px; transition: border-color .3s, background .3s;
}
.item.done { border-color: rgba(34, 197, 94, .35); }
.item.missing { animation: shake .45s; border-color: rgba(244, 63, 94, .6); }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.item-text { margin: 0 0 14px; font-weight: 500; }
.item-text .code { font-size: 12px; font-weight: 800; color: #c4b5fd; margin-right: 6px; }

.scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.score {
    appearance: none; cursor: pointer; font: inherit; color: var(--text);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 12px 4px; border-radius: 16px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, .03);
    transition: transform .18s cubic-bezier(.2, .8, .2, 1), background .2s, border-color .2s, box-shadow .2s;
}
.score .em { font-size: 26px; line-height: 1; transition: transform .2s; }
.score .num { font-size: 13px; font-weight: 700; color: var(--muted); }
.score:hover { transform: translateY(-3px) scale(1.03); border-color: rgba(255, 255, 255, .3); }
.score:hover .em { transform: scale(1.15); }
.score.selected { background: var(--grad); border-color: transparent; box-shadow: var(--shadow); transform: scale(1.06); }
.score.selected .num { color: #fff; }

.step-nav {
    margin-top: 28px; padding: 16px 0 0; border-top: 1px solid var(--stroke);
    display: flex; justify-content: space-between; gap: 12px;
}
.step-nav .btn { min-width: 140px; }

/* Choix d'ancienneté : cartes */
.seniority-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.seniority-list .chip span { width: 100%; text-align: center; padding: 14px; border-radius: 14px; }

/* ---------- Merci & confettis ---------- */
.trophy { font-size: 72px; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; display: inline-block; }
@keyframes pop { from { transform: scale(.3) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i {
    position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; opacity: .9;
    animation: fall linear forwards;
}
@keyframes fall {
    to { transform: translate3d(var(--dx, 0), 110vh, 0) rotate(720deg); }
}

.share { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.share > div { flex: 1 1 260px; }

/* ---------- Tableau de bord ---------- */
.kpi { padding: 20px; border-radius: 18px; background: var(--card); border: 1px solid var(--stroke); }
.kpi .v { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.kpi .l { font-size: 13px; color: var(--muted); }
.dash-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }

.bar-row { display: grid; grid-template-columns: minmax(140px, 240px) 1fr 56px; align-items: center; gap: 14px; margin: 10px 0; font-size: 14px; }
.bar-row .name { color: #dcdcf5; }
.bar { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bar > i.good { background: linear-gradient(90deg, #16a34a, #22c55e); }
.bar > i.mid { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar > i.bad { background: linear-gradient(90deg, #be123c, #f43f5e); }
.val { font-weight: 800; text-align: right; }

details.sec { border-top: 1px solid var(--stroke); padding: 12px 0; }
details.sec summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
details.sec summary::-webkit-details-marker { display: none; }
details.sec summary::after { content: "＋"; color: var(--muted); }
details.sec[open] summary::after { content: "－"; }
details.sec .bar-row { grid-template-columns: 1fr minmax(120px, 180px) 56px; }
details.sec .bar-row .name { font-size: 13px; }

.dist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: end; height: 220px; margin-top: 10px; }
.dist .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.dist .col .fill { width: 100%; border-radius: 14px 14px 6px 6px; background: var(--grad); min-height: 4px; transition: height .8s cubic-bezier(.2, .8, .2, 1); }
.dist .col .n { font-size: 13px; font-weight: 700; }
.dist .col .e { font-size: 22px; }

table.dept { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dept th, table.dept td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--stroke); }
table.dept th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.comment { padding: 16px 18px; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid var(--stroke); margin-bottom: 10px; white-space: pre-wrap; }
.empty { text-align: center; padding: 40px 20px; }
.empty .big { font-size: 56px; }

/* ---------- Notifications ---------- */
.toasts { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 50; display: grid; gap: 10px; width: min(92vw, 420px); pointer-events: none; }
.toast {
    padding: 14px 18px; border-radius: 14px; background: rgba(22, 22, 50, .95); border: 1px solid var(--stroke);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7); font-weight: 600; font-size: 14px; animation: toastIn .3s ease both;
}
.toast.toast-error { border-color: rgba(244, 63, 94, .5); }
.toast.toast-warn { border-color: rgba(245, 158, 11, .5); }
.toast.toast-ok { border-color: rgba(34, 197, 94, .5); }
.toast.hide { opacity: 0; transition: opacity .4s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.noscript { padding: 40px; text-align: center; }

/* ---------- Responsive & mouvement réduit ---------- */
@media (max-width: 640px) {
    .bar-row { grid-template-columns: 1fr 48px; }
    .bar-row .bar { grid-column: 1 / -1; order: 3; }
    details.sec .bar-row { grid-template-columns: 1fr 48px; }
    .brand-name { display: none; }
    .score .em { font-size: 22px; }
    .score { padding: 10px 2px; }
    .scores { gap: 6px; }
    .step-nav .btn { min-width: 0; flex: 1; }
    .badge { width: 44px; height: 44px; font-size: 18px; }
    .nav .hello { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   Espace administrateur : navigation, participants, liens, période
   ========================================================================== */
.nav a.link.active { background: var(--card-strong); color: #fff; }
.btn.danger { color: #fda4af; }
.btn.danger:hover { background: rgba(244, 63, 94, .15); }
code { background: rgba(255, 255, 255, .08); padding: 2px 6px; border-radius: 6px; font-size: .9em; }

.toolbar { margin-bottom: 14px; }
.toolbar input[type="search"] {
    width: 100%; font: inherit; color: var(--text); background: rgba(255, 255, 255, .05);
    border: 1px solid var(--stroke); border-radius: 14px; padding: 12px 16px;
}
.table-wrap { overflow-x: auto; }
table.links { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.links th, table.links td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
table.links th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.link-cell { display: flex; gap: 8px; align-items: center; }
.link-cell input {
    flex: 1; min-width: 220px; font: inherit; font-size: 12px; color: #dcdcf5;
    background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px;
}
.badge-status { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-status.done { background: rgba(34, 197, 94, .15); color: #86efac; border: 1px solid rgba(34, 197, 94, .35); }
.badge-status.wait { background: rgba(245, 158, 11, .12); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .35); }
.dash-head p { margin: 0; }

.warn-card { border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .08); }

/* ==========================================================================
   Choix de la période (écran administrateur)
   ========================================================================== */
.period-status { border-left: 4px solid var(--violet); }
.period-status.open { border-left-color: var(--good); }
.period-status.upcoming { border-left-color: var(--amber); }
.period-status.closed { border-left-color: var(--bad); }
.period-card { display: grid; gap: 22px; }
.bad-text { color: #fda4af; font-weight: 600; }

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.presets-label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.preset {
    appearance: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; color: var(--text);
    padding: 9px 16px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--card-strong);
    transition: transform .15s, background .2s, box-shadow .2s;
}
.preset:hover { transform: translateY(-2px); background: var(--grad); box-shadow: var(--shadow); border-color: transparent; }

.date-duo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 14px; }
.date-box {
    display: grid; gap: 10px; padding: 18px 20px; border-radius: 20px; cursor: pointer;
    background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad) border-box;
    border: 2px solid transparent; transition: transform .2s, box-shadow .2s;
}
.date-box:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.date-box:focus-within { box-shadow: 0 0 0 4px rgba(236, 72, 153, .25); }
.date-kicker { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #c4b5fd; }
.date-box input[type="date"] {
    width: 100%; font: inherit; font-size: 20px; font-weight: 800; color: var(--text);
    background: transparent; border: 0; padding: 0; color-scheme: dark; cursor: pointer;
}
.date-box input[type="date"]:focus { outline: none; }
.date-arrow {
    align-self: center; font-size: 28px; font-weight: 800;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.period-summary {
    padding: 18px 20px; border-radius: 18px; background: rgba(255, 255, 255, .04); border: 1px solid var(--stroke);
}
.summary-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.summary-days { font-size: 16px; color: var(--muted); }
.summary-days b { font-size: 28px; color: var(--text); margin-right: 4px; }
.summary-count {
    font-size: 13px; font-weight: 800; padding: 7px 14px; border-radius: 999px; background: var(--grad); color: #fff;
}
.timeline { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; margin: 16px 0 8px; }
.timeline i { display: block; height: 100%; border-radius: inherit; background: var(--grad); box-shadow: 0 0 14px rgba(236, 72, 153, .6); transition: width .6s; }
.summary-dates { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
    .date-duo { grid-template-columns: 1fr; }
    .date-arrow { transform: rotate(90deg); justify-self: center; }
}
