/* ============================
   RESET & BASE
============================ */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* supprime le scroll horizontal */
}

body {
  font-family: "Segoe UI", sans-serif;
  background: url('/img/fond.png') repeat;
  color: #111;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch; /* IMPORTANT : pas de centrage global */
}

/* ============================
   HEADER
============================ */

header {
  width: 100%;
  text-align: center;
  padding: 20px 10px 10px;
}

.logo {
  max-width: 150px;
  width: 90%;
  height: auto;
}

.slogan {
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  color: #fff;
  margin: 5px 0 20px;
  text-shadow: 1px 1px 2px #000;
}

/* ============================
   TITRES
============================ */

h1 {
  text-align: center;
  font-size: 2em;
  margin: 10px 0 20px;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

/* ============================
   CONTENEUR CENTRAL
============================ */

.center {
  width: 100%;
  max-width: 900px;
  padding: 0 15px 40px;
  margin: 20px auto 0;
  text-align: center; /* titre centré, contenu des boîtes repasse en left */
}

/* ============================
   BOÎTES (vote, résultats, pages)
============================ */

.vote-box,
.result-box,
form.vote-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);

  /* ✅ IMPORTANT : comme avant, contenu aligné à gauche */
  text-align: left;
}

/* ✅ Lisibilité des titres dans les boîtes */
.vote-box h2,
.vote-box .admin-h2 {
  color: #111;
  text-shadow: none;
  text-align: left;
}

/* ============================
   FORMULAIRE
============================ */

fieldset {
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 15px;
  padding: 15px;
}

legend {
  font-weight: bold;
  padding: 0 8px;
  text-align: left;
}

label {
  display: block;
  margin: 8px 0;
  cursor: pointer;
  text-align: left;
}

input[type="radio"] {
  margin-right: 8px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* ============================
   BOUTONS
============================ */

button,
.button,
.btn-results {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 24px;
  background: #0078d7;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
}

button:hover,
.button:hover,
.btn-results:hover {
  background: #005bb5;
}

/* ✅ Bouton dans le formulaire : centré */
form.vote-box button,
.vote-box button {
  display: block;
  margin: 15px auto 0;
}

/* ✅ ADMIN : ne pas forcer les boutons à être centrés (sinon .qr-btn devient bizarre) */
.admin-row button,
.admin-actions button {
  display: inline-block;
  margin: 6px 6px 6px 0;
}

/* ============================
   MESSAGE & ÉTATS
============================ */

.message {
  font-size: 1.6em;
  font-weight: 800;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
  margin: 20px 0;
}

.notice-box {
  background: rgba(255,255,255,.95);
  color: #111;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0,0,0,.2);
  display: inline-block;
  margin-top: 10px;
}

/* ============================
   COUNTDOWN
============================ */

.countdown-mini {
  margin-top: 10px;
  font-weight: bold;
  font-size: 1.2em;
}

/* ============================
   LOADING BAR
============================ */

.loading-bar {
  height: 5px;
  width: min(520px, 92vw);
  margin: 20px auto 0;
  background: linear-gradient(to right,#0078d7 0%,#00c853 50%,#0078d7 100%);
  background-size: 200% auto;
  animation: loadbar 1.5s linear infinite;
  border-radius: 999px;
}

@keyframes loadbar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================
   RÉSULTATS (barres + layout)
============================ */

.results {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 40px;
}

.card {
  width: 100%;
}

.question {
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 15px;
}

.row { margin: 12px 0; }

.choice-label {
  font-weight: bold;
  margin-top: 10px;
}

.progress {
  position: relative;
  background: #ddd;
  border-radius: 999px;
  overflow: hidden;
  height: 26px;
  margin-top: 5px;
}

.progress-fill {
  background: linear-gradient(to right,#0078d7,#00c853);
  height: 100%;
  transition: width 0.5s ease;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  font-weight: bold;
  pointer-events: none;
}

.countdown {
  text-align: center;
  font-size: 1.4em;
  margin: 15px 0 30px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

.badge { text-align: center; margin: 10px 0 20px; }

.badge span {
  background: rgba(0,0,0,0.35);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: bold;
  color: #fff;
}

/* ============================
   ADMIN (page index)
============================ */

.admin-subtitle {
  margin-top: 25px;
  margin-bottom: 10px;
  text-align: center;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

.admin-votes {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-vote-item {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  margin: 0 auto 14px;
  max-width: 820px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  text-align: left;
}

.admin-vote-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.admin-key {
  font-weight: 700;
}

.admin-links {
  font-size: 0.95em;
  margin-bottom: 10px;
}

.admin-links a {
  text-decoration: none;
  color: #0078d7;
}
.admin-links a:hover {
  text-decoration: underline;
}

.admin-links .sep {
  margin: 0 6px;
  opacity: 0.6;
}

.admin-actions {
  margin-top: 10px;
}

.admin-logout {
  text-align: center;
  margin-top: 30px;
}

/* ============================
   QR MODAL
============================ */

.qr-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.qr-modal.active { display: flex; }

.qr-modal canvas {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
}

.qr-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.qr-btn {
  display: inline-block;
  margin: 6px 6px 6px 0;
  padding: 6px 12px;
  background: #0078d7;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  border: none;
}

.qr-btn:hover {
  background: #005bb5;
}

.info {
  font-size: 0.9em;
  color: #444;
}

/* ============================
   ADMIN LOGIN
============================ */

.login-box {
  max-width: 420px;
  margin: 0 auto;
}

.form-error {
  color: #b00020;
  font-weight: 700;
  margin: 0 0 10px;
}

/* le formulaire login doit respirer sans <br> */
.login-box label {
  margin: 10px 0;
}

/* ============================
   ADMIN EDIT
============================ */

.flash {
  background: #e8f4fd;
  border-left: 4px solid #0078d7;
  padding: 10px 12px;
  margin: 0 auto 14px;
  max-width: 820px;
  font-size: 1.05em;
  color: #0078d7;
  border-radius: 6px;
  text-align: left;
}

.button.danger,
.danger {
  background: #d70022;
}

.button.danger:hover,
.danger:hover {
  background: #b0001b;
}

/* meilleure mise en page des champs date/heure dans les formulaires admin */
.vote-box label {
  margin: 10px 0;
}

/* ============================
   ACCUEIL
============================ */

.center-text { text-align: center; }
.home-box { text-align: left; }
.home-box hr { margin: 16px 0; }

/* ============================
   FOOTER
============================ */

footer {
  width: 100%;
  text-align: center;
  padding: 15px 10px;
  margin-top: auto;
  font-size: 0.9em;
  color: #fff;
  background: rgba(0,0,0,0.4);
}

/* ============================
   RESPONSIVE
============================ */

@media (max-width: 600px) {
  h1 {
    font-size: 1.6em;
  }

  .slogan {
    font-size: 1em;
  }

  .vote-box {
    padding: 15px;
  }
}

/* ============================
   ADMIN - Lien unique (edit.php + index.php)
============================ */

.admin-h2 {
  margin: 0 0 10px;
  font-size: 1.2em;
}

.admin-linkbox {
  margin-bottom: 18px;
}

.admin-textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #ccc;
  padding: 10px;
  resize: vertical;
  font-family: inherit;
}

.admin-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.admin-small {
  margin-top: 8px;
  font-size: 0.9em;
  color: #444;
}

.admin-link {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  overflow-wrap: anywhere;
}

.admin-preview {
  margin-top: 12px;
  background: rgba(0,0,0,0.04);
  border-radius: 10px;
  padding: 10px;
}

.admin-preview-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}
.logo-link {
  display: inline-block;
  text-decoration: none;
}