/* =========================================================
   Evolve — feuille de style
   Remplace directement public/css/main.css (mêmes classes)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap');

:root {
  --ink: #16233a;          /* texte principal / navbar */
  --ink-soft: #4a5872;     /* texte secondaire */
  --paper: #f6f4ef;        /* fond général, papier chaud */
  --card: #ffffff;
  --line: #e3dfd5;         /* bordures */
  --accent: #2443b8;       /* bleu civique */
  --accent-dark: #1a3290;
  --pour: #1f8a5b;
  --pour-dark: #176b46;
  --contre: #c8463d;
  --contre-dark: #a1352e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 35, 58, .04), 0 4px 16px rgba(22, 35, 58, .06);
  --shadow-hover: 0 2px 4px rgba(22, 35, 58, .06), 0 10px 28px rgba(22, 35, 58, .10);
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Public Sans', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Messages flash ---------- */
.flash {
  margin-bottom: 1rem;
  padding: .9rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
}
.flash-green { background: #e6f4ec; border-left: 4px solid var(--pour); color: #12523a; }
.flash-red   { background: #fbe9e7; border-left: 4px solid var(--contre); color: #7c2620; }

/* ---------- Barre de navigation ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  padding: .75rem max(1rem, calc((100% - 900px) / 2 + 1rem));
  border-bottom: 3px solid var(--accent);
}

.navbar h1 { margin: 0; font-family: var(--serif); font-size: 1.6rem; letter-spacing: -.01em; }
.navbar h1 a { color: #fff; padding: 0; font-size: inherit; font-weight: 700; display: inline-flex; align-items: center; gap: .55rem; }
.navbar h1 a::before {
  /* petite urne stylisée */
  content: "";
  width: 1.35rem; height: 1.35rem;
  border-radius: 4px;
  background:
    linear-gradient(#fff, #fff) center 30% / 55% 2px no-repeat,
    var(--accent);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.18);
}
.navbar h1 a:hover { background: none; }

.navbar a {
  color: #dfe5f0;
  padding: .55rem .9rem;
  font-weight: 600;
  font-size: .95rem;
  border-radius: 8px;
  transition: background-color .2s, color .2s;
}
.navbar a:hover { background: rgba(255,255,255,.08); color: #fff; }

.menu { display: flex; gap: .25rem; align-items: center; }
.menu a { display: block; }
.menu a:last-child {
  background: var(--accent);
  color: #fff;
}
.menu a:last-child:hover { background: var(--accent-dark); }

.menu-toggle {
  display: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  padding: .35rem .6rem;
  border-radius: 8px;
  user-select: none;
}
.menu-toggle:hover { background: rgba(255,255,255,.08); }

/* ---------- Mise en page ---------- */
.container { width: 100%; max-width: 900px; margin: 2.25rem auto; padding: 0 1rem; }
.container:empty { display: none; }          /* conteneur flash vide */

.center { display: flex; justify-content: center; align-items: center; }
.align-right { display: flex; justify-content: flex-end; }

/* ---------- Bloc d'introduction ---------- */
.description {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.8rem 1.6rem 2rem;
  margin-bottom: 1.75rem;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.description::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(var(--accent) 0 50%, var(--pour) 50% 100%);
}
.description strong { color: var(--ink); font-weight: 700; }

/* ---------- Tri ---------- */
.sort-select {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.sort-select label { margin: 0; font-weight: 600; color: var(--ink-soft); font-size: .95rem; }
.sort-select select {
  appearance: none;
  -webkit-appearance: none;
  padding: .55rem 2.4rem .55rem .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2316233a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right .9rem center,
    var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.sort-select select:hover { border-color: #c9c3b5; }
.sort-select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36,67,184,.15); }

/* ---------- Cartes proposition ---------- */
.proposition {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.6rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
  position: relative;
}
/* Effet de survol uniquement sur les cartes cliquables (liste) */
.proposition:has(h2 a):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: #d4cebf;
}
/* toute la carte devient cliquable */
.proposition h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.proposition h2 a:hover { color: var(--accent); }

.proposition h2 {
  margin: 0 0 .9rem;
  font-family: var(--serif);
  font-size: 1.4rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.005em;
}
.proposition p { font-size: 1.05rem; margin: 0 0 1.25rem; color: var(--ink-soft); line-height: 1.65; }

/* ---------- Barre de résultats ---------- */
.bar {
  display: flex;
  gap: 3px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  margin-top: .25rem;
  background: transparent;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
}
.pour, .contre {
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  white-space: nowrap;
  min-width: 2.6rem;
  font-variant-numeric: tabular-nums;
}
.pour   { background: var(--pour);   justify-content: flex-start; border-radius: 8px 0 0 8px; }
.contre { background: var(--contre); justify-content: flex-end;   border-radius: 0 8px 8px 0; }
.pour::before   { content: "Pour\00a0·\00a0";   font-weight: 500; opacity: .85; }
.contre::after  { content: "\00a0·\00a0 Contre"; font-weight: 500; opacity: .85; }
/* segment trop étroit : on n'affiche que le chiffre */
.pour[style*="width:0"], .contre[style*="width:0"] { min-width: 0; padding: 0; font-size: 0; }
.pour[style*="width:1"]::before, .pour[style*="width:2"]::before,
.contre[style*="width:1"]::after, .contre[style*="width:2"]::after { content: none; }
.pour[style*="width:100"]::before { content: "Pour\00a0·\00a0"; }
.contre[style*="width:100"]::after { content: "\00a0·\00a0 Contre"; }
.pour[style*="width:100"] { border-radius: 8px; }
.contre[style*="width:100"] { border-radius: 8px; }

/* ---------- Formulaires ---------- */
label {
  display: block;
  margin-bottom: .45rem;
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
}
.required::after { content: " (requis)"; color: var(--contre); font-weight: 400; font-size: .85rem; }

input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  padding: .8rem .95rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fbfaf7;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(36,67,184,.15);
}
textarea { resize: vertical; min-height: 140px; }

.g-recaptcha { margin: .25rem 0 .5rem; min-height: 78px; }
/* Emplacement affiché pendant le chargement du reCAPTCHA (le widget de Google le remplace) */
.g-recaptcha:empty {
  width: 304px;
  max-width: 100%;
  height: 78px;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  border: 1px solid #d3d3d3;
  border-radius: 3px;
  background: #f9f9f9;
  color: var(--ink-soft);
  font-size: .9rem;
}
.g-recaptcha:empty::before {
  content: "";
  flex: none;
  width: 22px; height: 22px;
  border: 3px solid #d3d3d3;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: recaptcha-spin .8s linear infinite;
}
.g-recaptcha:empty::after { content: "Chargement de la vérification anti-spam…"; }
@keyframes recaptcha-spin { to { transform: rotate(360deg); } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: #fff;
  border: none;
  padding: .85rem 1.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }

.proposition-btn {
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(36,67,184,.28);
  padding: 1rem 1.8rem;
  font-size: 1.05rem;
}
.proposition-btn::before { content: "+"; font-size: 1.35rem; line-height: 1; font-weight: 600; }
.proposition-btn:hover { background: var(--accent-dark); box-shadow: 0 6px 18px rgba(36,67,184,.34); }

.submit-btn { background: var(--pour); }
.submit-btn:hover { background: var(--pour-dark); }

/* ---------- Vote ---------- */
.vote-buttons { display: flex; gap: .75rem; margin-top: 1rem; }
.vote-buttons button {
  flex: 1 1 0;
  text-align: center;
  padding: 1rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.vote-buttons button:active { transform: translateY(1px); }
.vote-yes-btn { background: var(--pour); box-shadow: 0 4px 14px rgba(31,138,91,.25); }
.vote-yes-btn:hover { background: var(--pour-dark); }
.vote-no-btn  { background: var(--contre); box-shadow: 0 4px 14px rgba(200,70,61,.25); }
.vote-no-btn:hover { background: var(--contre-dark); }

/* ---------- Commentaires ---------- */
.comments { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1.5rem; color: var(--ink-soft); }
.comments h3 { font-family: var(--serif); font-size: 1.25rem; color: var(--ink); margin: 0; }
.comments form { margin-top: .5rem; }

.comment {
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  margin-bottom: .75rem;
  font-size: .97rem;
  color: var(--ink);
}
.comment strong { color: var(--ink); }

.comment-form textarea { min-height: 90px; margin-bottom: .8rem; }
.comment-form button {
  background: var(--pour);
  color: #fff;
  border: none;
  padding: .7rem 1.3rem;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.comment-form button:hover { background: var(--pour-dark); }

/* ---------- Espaces (demotis) ---------- */
.demotis {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.demotis-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.demotis-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.demotis-actions .btn { padding: .6rem 1rem; font-size: .92rem; }
.demotis-parametre-btn, .btn-admin-profil { background: var(--accent); }
.demotis-parametre-btn:hover, .btn-admin-profil:hover { background: var(--accent-dark); }
.icon-btn-admin-profil { width: 18px; height: 18px; fill: #fff; }
.demotis-administrer-btn { background: var(--contre); }
.demotis-administrer-btn:hover { background: var(--contre-dark); }
.demotis-lien-btn { background: #5a6478; }
.demotis-lien-btn:hover { background: #474f60; }
.demotis-create-btn { background: var(--pour); }
.demotis-create-btn:hover { background: var(--pour-dark); }

/* ---------- Connexion ---------- */
.login-container-center { display: flex; justify-content: center; align-items: center; min-height: 50vh; }

.login-container {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 2.5rem 2.5rem 2rem;
  border-radius: 16px;
  box-shadow: var(--shadow-hover);
  width: 100%;
  max-width: 400px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-container::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0 50%, var(--pour) 50% 100%);
}
.login-container .title { margin: 0; font-family: var(--serif); font-size: 1.9rem; color: var(--ink); font-weight: 700; }
.login-container .subtitle { margin: .3rem 0 2rem; color: var(--ink-soft); font-size: .95rem; }
.login-container label { display: block; margin-bottom: .35rem; font-size: .9rem; color: var(--ink); }

.login-form .form-group { text-align: left; margin-bottom: 1rem; }
.login-form input { margin-bottom: 0; }

.btn-login {
  width: 100%;
  padding: .85rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  margin-top: .5rem;
}
.btn-login:hover { background: var(--accent-dark); }

/* Connexion avec Google */
.login-separator { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--ink-soft); font-size: .85rem; }
.login-separator::before, .login-separator::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  width: 100%;
  padding: .8rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
  transition: background .2s, border-color .2s;
}
.btn-google:hover { background: #f8f7f3; border-color: #c9c3b5; }
.btn-google svg { width: 18px; height: 18px; }

.login-links { margin-top: 1.5rem; font-size: .92rem; }
.login-links a { color: var(--accent); display: block; margin: .35rem 0; transition: color .2s; }
.login-links a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ---------- Fil d'Ariane ---------- */
.breadcrumb {
  background: transparent;
  padding: .75rem max(1rem, calc((100% - 900px) / 2 + 1rem));
  font-size: .9rem;
  border-bottom: 1px solid var(--line);
}
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.breadcrumb li { margin-right: .5rem; color: var(--ink-soft); }
.breadcrumb li + li::before { content: "›"; margin-right: .5rem; color: #9aa3b5; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .current { font-weight: 600; color: var(--ink); }

/* ---------- Modale ---------- */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(22, 35, 58, .55);
  backdrop-filter: blur(2px);
  z-index: 1000;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  padding: 1.5rem;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  width: min(92vw, 380px);
  z-index: 1001;
}

/* ---------- Pied de page ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  font-size: .88rem;
  color: var(--ink-soft);
}
.site-footer p { margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .navbar { padding: .65rem 1rem; }
  .navbar h1 { font-size: 1.4rem; }

  .menu {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
    background: var(--ink);
    position: absolute;
    top: 100%;
    left: 0;
    padding: .5rem 1rem 1rem;
    box-shadow: 0 12px 24px rgba(0,0,0,.18);
    border-bottom: 3px solid var(--accent);
  }
  .menu a { text-align: center; padding: .9rem; border-top: 1px solid rgba(255,255,255,.08); }
  .menu a:last-child { margin-top: .5rem; border-top: none; }
  .menu.active { display: flex; }
  .menu-toggle { display: block; }

  .container { margin: 1.25rem auto; }
  .description { padding: 1.2rem 1.2rem 1.2rem 1.5rem; font-size: 1rem; }
  .proposition { padding: 1.1rem 1.15rem 1.2rem; }
  .proposition h2 { font-size: 1.2rem; }
  .bar { height: 30px; }

  .proposition-btn { width: 100%; }
  .vote-buttons { flex-direction: column; }

  .demotis { flex-direction: column; align-items: flex-start; }
  .demotis-title { margin-bottom: .25rem; }

  .login-container { padding: 2rem 1.5rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .g-recaptcha:empty::before { animation: none; }
}