/* Tools 4 polls — feuille de style commune */

:root {
    --fond: #f6f5f2;
    --carte: #ffffff;
    --texte: #1f2430;
    --discret: #6b7180;
    --bordure: #e2e0da;
    --accent: #3b5bdb;
    --accent-fonce: #2f4ac0;
    --accent-2: #f08c00;
    --succes: #2b8a3e;
    --erreur: #c92a2a;
    --info: #1971c2;
    --rayon: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--fond);
    color: var(--texte);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--accent); }

/* --- Barre du haut --- */
.barre {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.5rem;
    background: var(--carte);
    border-bottom: 1px solid var(--bordure);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.logo {
    font-weight: 800;
    font-size: 1.3rem;
    text-decoration: none;
    color: var(--texte);
    letter-spacing: -0.02em;
}
.logo span { color: var(--accent-2); }
.barre nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.barre nav a { text-decoration: none; color: var(--texte); font-weight: 500; }
.barre nav a.bouton { color: #fff; }

/* --- Contenu --- */
.contenu {
    flex: 1;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.2rem;
}
h1 { font-size: 1.8rem; line-height: 1.2; margin-top: 0; }
h2 { font-size: 1.2rem; margin-top: 0; }

.carte {
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.carte.etroite { max-width: 460px; margin-left: auto; margin-right: auto; }
.centre { text-align: center; }
.discret { color: var(--discret); font-size: 0.93rem; }

/* --- Formulaires --- */
label { display: block; margin-bottom: 1rem; font-weight: 500; }
label small { font-weight: 400; color: var(--discret); }
input[type=text], input[type=email], input[type=password], textarea, select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: transparent;
}
label.case { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; }
label.case input { margin-top: 0.3rem; }

form.en-ligne { display: flex; gap: 0.6rem; flex-wrap: wrap; }
form.en-ligne input { flex: 1; min-width: 200px; margin-top: 0; }

.saisie-code {
    text-align: center;
    font-size: 1.8rem !important;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 700;
}

/* champ piège anti-robot, invisible pour les humains */
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Boutons --- */
.bouton {
    display: inline-block;
    background: var(--accent);
    color: var(--sur-accent, #fff);
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.2rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.bouton:hover { background: var(--accent-fonce); filter: brightness(0.95); }
.bouton.petit { padding: 0.35rem 0.75rem; font-size: 0.9rem; }
.bouton.grand { padding: 0.9rem 1.6rem; font-size: 1.1rem; }
.bouton.secondaire { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.bouton.danger { background: #fff; color: var(--erreur); border: 1px solid var(--erreur); }
.bouton.danger:hover { background: var(--erreur); color: #fff; }

/* --- Messages --- */
.flash {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    background: #fff;
}
.flash ul { margin: 0; padding-left: 1.2rem; }
.flash-succes { border-color: var(--succes); background: #ebfbee; }
.flash-erreur { border-color: var(--erreur); background: #fff5f5; }
.flash-info   { border-color: var(--info);   background: #e7f5ff; }

/* --- Tableau des activités --- */
.tableau { width: 100%; border-collapse: collapse; }
.tableau th, .tableau td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--bordure); }
.tableau th { font-size: 0.85rem; color: var(--discret); font-weight: 600; }
.actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.actions form { margin: 0; }
code.code { font-weight: 700; letter-spacing: 0.1em; background: #f1f0ec; padding: 0.15rem 0.4rem; border-radius: 4px; }

.pastille { font-size: 0.8rem; padding: 0.15rem 0.55rem; border-radius: 999px; font-weight: 600; }
.pastille-brouillon { background: #f1f3f5; color: #495057; }
.pastille-ouvert    { background: #ebfbee; color: var(--succes); }
.pastille-ferme     { background: #fff4e6; color: #d9480f; }

/* --- Accueil --- */
.accueil {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 2.5rem;
    align-items: center;
    padding: 2rem 0;
}
.accueil h1 { font-size: 2.6rem; letter-spacing: -0.02em; }
.accroche { font-size: 1.15rem; color: var(--discret); margin-bottom: 1.8rem; }

/* --- Pied de page --- */
.pied { text-align: center; color: var(--discret); font-size: 0.85rem; padding: 1.5rem; }
.pied p { margin: 0.2rem 0; }

/* --- Page de préparation d'une session --- */
.entete-session { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.titre-editable input { font-size: 1.3rem; font-weight: 700; border-color: transparent; padding-left: 0.3rem; }
.titre-editable input:hover { border-color: var(--bordure); }
.boutons-session { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-start; }
.boutons-session form { margin: 0; }
.bouton:disabled { opacity: 0.5; cursor: not-allowed; }
.grille-session { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: start; }
.grille-session .carte { margin-bottom: 0; }
.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
textarea { resize: vertical; }

.liste-questions { list-style: none; padding: 0; margin: 0; counter-reset: q; }
.liste-questions li {
    counter-increment: q;
    display: flex; justify-content: space-between; gap: 0.6rem; align-items: center;
    padding: 0.7rem 0; border-bottom: 1px solid var(--bordure);
}
.liste-questions li::before { content: counter(q); font-weight: 800; color: var(--discret); min-width: 1.4rem; }
.liste-questions li.en-edition { background: #fff9db; }
.q-texte { flex: 1; }
.q-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.q-actions form { margin: 0; }

.type-q {
    display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    padding: 0.1rem 0.45rem; border-radius: 4px; margin-right: 0.3rem; vertical-align: 0.1em;
    background: #edf2ff; color: var(--accent);
}
.type-nuage   { background: #fff4e6; color: #d9480f; }
.type-echelle { background: #ebfbee; color: var(--succes); }
.type-texte   { background: #f8f0fc; color: #862e9c; }

/* --- Écran pilote --- */
.pilote-entete { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pilote-entete h1 { margin-bottom: 0.3rem; }
.pilote-grille { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: start; }
.pilote-grille .carte { margin-bottom: 0; }
.question-pilote {
    display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
    background: #fff; border: 2px solid var(--bordure); border-radius: 10px;
    padding: 0.6rem 0.7rem; margin-bottom: 0.5rem;
}
.question-pilote:hover { border-color: var(--accent); }
.question-pilote.active { border-color: var(--accent); background: #edf2ff; }
.question-pilote .num { font-weight: 800; color: var(--discret); margin-right: 0.3rem; }
.question-pilote .type-q { display: block; width: fit-content; margin: 0.15rem 0 0.25rem; }
.commandes { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 1.2rem; }
.etat-pastille { font-size: 0.8rem; font-weight: 700; padding: 0.3rem 0.6rem; border-radius: 999px; }
.etat-vote      { background: #e7f5ff; color: var(--info); }
.etat-resultats { background: #ebfbee; color: var(--succes); }
.etat-ferme     { background: #fff4e6; color: #d9480f; }

/* --- Résultats (pilote et projection) --- */
.resultats .vide { color: var(--discret); text-align: center; padding: 2rem 0; }
.barre-ligne { margin-bottom: 0.7rem; }
.barre-entete { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; margin-bottom: 0.2rem; }
.barre-valeur { color: var(--discret); white-space: nowrap; font-variant-numeric: tabular-nums; }
.barre-fond { height: 1.1rem; background: #f1f0ec; border-radius: 6px; overflow: hidden; }
.barre-remplie { height: 100%; border-radius: 6px; transition: width 0.6s ease; }
.moyenne { text-align: center; margin-bottom: 1rem; }
.moyenne-valeur { font-size: 2.6em; font-weight: 900; color: var(--accent); }
.moyenne-sur { color: var(--discret); font-size: 1.2em; }
.bornes { display: flex; justify-content: space-between; color: var(--discret); font-size: 0.85em; margin-top: 0.5rem; }

.nuage {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: 0.2em 0.7em; padding: 1rem 0; line-height: 1.15;
}
.nuage .mot { font-weight: 800; transition: font-size 0.5s ease; position: relative; }
.nuage .mot.masque { opacity: 0.3; text-decoration: line-through; }
.nuage .mini {
    font-size: 0.75rem; vertical-align: super; margin-left: 0.15rem; cursor: pointer;
    border: 1px solid var(--bordure); background: #fff; border-radius: 4px; color: var(--discret); padding: 0 0.25rem;
}
.textes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.7rem; }
.message { background: #fff9db; border-radius: 10px; padding: 0.8rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.masque { background: #f1f3f5; opacity: 0.6; }
.message-pied { display: flex; justify-content: space-between; align-items: center; margin-top: 0.6rem; font-size: 0.85rem; }

/* --- Espace d'administration --- */
.badge { background: var(--erreur); color: #fff; border-radius: 999px; font-size: 0.75rem; padding: 0.05rem 0.45rem; font-weight: 700; }
.onglets-admin { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 1.5rem; border-bottom: 2px solid var(--bordure); }
.onglets-admin a { padding: 0.6rem 1rem; text-decoration: none; color: var(--discret); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.onglets-admin a.actif { color: var(--accent); border-bottom-color: var(--accent); }
.grille-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.grille-stats .carte { margin-bottom: 0; }
.stats { margin: 0; }
.stats div { display: flex; justify-content: space-between; padding: 0.35rem 0; border-bottom: 1px solid var(--bordure); }
.stats div:last-child { border-bottom: none; }
.stats dt { color: var(--discret); }
.stats dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats .alerte dd, .texte-erreur { color: var(--erreur); }
.signalement.traite { opacity: 0.6; }
.signalement blockquote { margin: 0.5rem 0 1rem; padding: 0.6rem 1rem; background: #f8f9fa; border-left: 3px solid var(--bordure); }
.actions-admin { display: flex; gap: 0.4rem; flex-wrap: wrap; }
form.form-bouton { margin: 0; display: inline; }
.admin-question { padding: 0.6rem 0; border-bottom: 1px solid var(--bordure); }
.admin-question ul { margin: 0.3rem 0; }
.admin-question .masque, .mot-admin.masque { opacity: 0.45; text-decoration: line-through; }
.mot-admin { display: inline-block; background: #f1f0ec; border-radius: 4px; padding: 0.1rem 0.45rem; margin: 0.15rem; }
.zone-danger { border-color: #ffc9c9; }

/* --- Textes légaux --- */
.texte-legal { max-width: 820px; margin-left: auto; margin-right: auto; }
.texte-legal h2 { margin-top: 1.8rem; }
.texte-legal li { margin-bottom: 0.35rem; }
.texte-legal .tableau { font-size: 0.92rem; margin: 0.5rem 0 1rem; }
.texte-legal .tableau td { vertical-align: top; }

/* --- Réglages d'apparence (page de préparation) --- */
.choix-themes { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1.2rem; }
.choix-theme { margin: 0; cursor: pointer; text-align: center; font-weight: 500; }
.choix-theme input { position: absolute; opacity: 0; pointer-events: none; }
.apercu-theme {
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
    width: 130px; height: 82px; padding: 10px 12px; border-radius: 10px;
    border: 3px solid var(--bordure); box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: left;
}
.apercu-titre { font-weight: 800; font-size: 1.1rem; line-height: 1; }
.apercu-barre { display: block; height: 9px; border-radius: 4px; }
.theme-apercu-colore { background: linear-gradient(135deg, #5f3dc4, #9c36b5 55%, #d6336c) !important; }
.theme-apercu-contraste { border-color: #000; }
.choix-theme input:checked + .apercu-theme { border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: 2px; }
.choix-theme input:focus-visible + .apercu-theme { outline: 3px solid var(--accent); outline-offset: 2px; }
.nom-theme { display: block; margin-top: 0.35rem; font-size: 0.9rem; }
input[type=color] { width: 70px; height: 40px; padding: 2px; border: 1px solid var(--bordure); border-radius: 8px; background: #fff; cursor: pointer; }
input[type=color]:disabled { opacity: 0.35; cursor: not-allowed; }
input[type=file] { display: block; margin-top: 0.4rem; font: inherit; }
.logo-actuel { background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--bordure); border-radius: 8px; padding: 0.6rem; display: inline-block; margin-bottom: 0.5rem; }
.logo-actuel img { display: block; max-height: 70px; max-width: 220px; }

/* --- Mobile --- */
@media (max-width: 720px) {
    .accueil { grid-template-columns: 1fr; }
    .accueil h1 { font-size: 2rem; }
    .tableau thead { display: none; }
    .tableau tr { display: block; padding: 0.8rem 0; border-bottom: 1px solid var(--bordure); }
    .tableau td { display: inline-block; border: none; padding: 0.2rem 0.5rem 0.2rem 0; }
    .tableau td:first-child { display: block; }
    .actions { justify-content: flex-start; margin-top: 0.4rem; }
    .grille-session, .pilote-grille { grid-template-columns: 1fr; }
    .liste-questions li { flex-wrap: wrap; }
}
