/* ─── RESET & BASE ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #CC0000;
  --dark:     #1A1A2E;
  --blue:     #1D4ED8;
  --green:    #047857;
  --orange:   #C2410C;
  --purple:   #6D28D9;
  --bg:       #F8FAFC;
  --card:     #FFFFFF;
  --border:   #E2E8F0;
  --txt:      #0F172A;
  --muted:    #64748B;
  --radius:   12px;
  --shadow:   0 4px 24px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--txt);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── HEADER ────────────────────────────────────────────────────────────── */
.header {
  background: var(--dark);
  color: #fff;
  padding: 2rem 1.5rem;
  text-align: center;
  border-bottom: 4px solid var(--red);
}
.header h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -.5px; }
.header h1 span { color: var(--red); }
.header p  { color: #94A3B8; margin-top: .4rem; font-size: .95rem; }
.badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  padding: .25rem .75rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  margin-top: .75rem;
}

/* ─── TIMER ─────────────────────────────────────────────────────────────── */
.timer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.timer-bar .time-display {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark);
  min-width: 60px;
}
.timer-bar .time-display.warning { color: var(--orange); }
.timer-bar .progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.timer-bar .progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width .5s linear, background .5s;
}
.timer-bar .progress-fill.warning { background: var(--orange); }
.timer-bar .progress-fill.danger  { background: var(--red); }
.timer-label { font-size: .8rem; color: var(--muted); }

/* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ─── SECTION TITRE ─────────────────────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 2.5rem 0 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}
.section-title .num {
  width: 36px; height: 36px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; flex-shrink: 0;
}
.section-title h2 { font-size: 1.15rem; font-weight: 700; color: var(--dark); }
.section-title p  { font-size: .85rem; color: var(--muted); }

/* ─── CARTE IDENTITÉ ─────────────────────────────────────────────────────── */
.identity-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .identity-card { grid-template-columns: 1fr; } }

/* ─── CHAMPS FORMULAIRE ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea {
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--txt);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.field textarea { resize: vertical; min-height: 80px; }

/* ─── CARTE QUESTION QCM ─────────────────────────────────────────────────── */
.q-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s;
}
.q-card:hover { box-shadow: 0 6px 30px rgba(0,0,0,.12); }

.q-card .q-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1.1rem 1.25rem .75rem;
}
.q-card .q-num {
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  padding: .2rem .55rem;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .1rem;
}
.q-card .q-text {
  font-size: .98rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.45;
}
.q-card .q-section-tag {
  font-size: .72rem;
  color: var(--muted);
  padding: .15rem .5rem;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}

.q-options { padding: .25rem 1.25rem 1.1rem; display: flex; flex-direction: column; gap: .45rem; }
.q-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.q-option:hover { border-color: var(--blue); background: #EFF6FF; }
.q-option input[type="radio"] { margin-top: .15rem; flex-shrink: 0; accent-color: var(--blue); }
.q-option .opt-letter {
  font-weight: 700;
  font-size: .85rem;
  color: var(--blue);
  min-width: 18px;
}
.q-option .opt-text { font-size: .93rem; color: var(--txt); }
.q-option.selected { border-color: var(--blue); background: #EFF6FF; }

/* ─── SATISFACTION (étoiles) ─────────────────────────────────────────────── */
.sat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.sat-card .sat-icon { font-size: 1.5rem; flex-shrink: 0; }
.sat-card .sat-label { flex: 1; min-width: 200px; font-size: .93rem; font-weight: 500; }
.sat-card .stars { display: flex; gap: .3rem; flex-shrink: 0; }
.star-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.7rem; color: #CBD5E1;
  transition: color .15s, transform .1s;
  padding: 0 .1rem;
}
.star-btn:hover, .star-btn.active { color: #F59E0B; transform: scale(1.1); }

/* ─── ENV CHOICES ─────────────────────────────────────────────────────────── */
.env-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow);
}
.env-card .env-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.env-card .env-icon { font-size: 1.3rem; }
.env-card .env-label { font-size: .93rem; font-weight: 600; }
.env-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice-btn {
  padding: .5rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: .88rem;
  background: #fff;
  color: var(--txt);
  transition: border-color .15s, background .15s;
  font-family: inherit;
}
.choice-btn:hover { border-color: var(--blue); background: #EFF6FF; }
.choice-btn.selected { border-color: var(--blue); background: #EFF6FF; font-weight: 600; }

/* ─── COMMENTAIRE LIBRE ──────────────────────────────────────────────────── */
.comment-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.comment-card label { font-weight: 600; display: block; margin-bottom: .6rem; }

/* ─── BOUTON SUBMIT ──────────────────────────────────────────────────────── */
.submit-zone { text-align: center; margin-top: 2.5rem; }
.btn-submit {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(4,120,87,.3);
  font-family: inherit;
}
.btn-submit:hover { background: #065F46; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(4,120,87,.4); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { background: var(--muted); cursor: not-allowed; transform: none; box-shadow: none; }
.submit-note { color: var(--muted); font-size: .85rem; margin-top: .75rem; }

/* ─── VALIDATION ERRORS ─────────────────────────────────────────────────── */
.error-banner {
  background: #FEE2E2;
  border: 1.5px solid #DC2626;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: #7F1D1D;
  font-size: .92rem;
}
.q-card.unanswered { border-color: #DC2626; }

/* ─── MERCI PAGE ─────────────────────────────────────────────────────────── */
.merci-zone {
  text-align: center;
  padding: 5rem 2rem;
  max-width: 600px;
  margin: 0 auto;
}
.merci-zone .big-check { font-size: 5rem; }
.merci-zone h2 { font-size: 2rem; font-weight: 800; color: var(--green); margin: 1rem 0 .5rem; }
.merci-zone .score-box {
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin: 2rem auto;
  display: inline-block;
}
.merci-zone .score-num { font-size: 3rem; font-weight: 900; color: #FCD34D; }
.merci-zone .score-label { font-size: .9rem; color: #94A3B8; }

/* ─── ADMIN ──────────────────────────────────────────────────────────────── */
.admin-header {
  background: var(--dark);
  color: #fff;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--red);
  flex-wrap: wrap;
  gap: 1rem;
}
.admin-header h1 { font-size: 1.3rem; }
.admin-nav { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-admin {
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-outline { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.4); }
.btn-admin:hover { opacity: .85; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-val { font-size: 2.2rem; font-weight: 900; color: var(--dark); }
.stat-card .stat-lbl { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.stat-card.blue  .stat-val { color: var(--blue); }
.stat-card.green .stat-val { color: var(--green); }
.stat-card.red   .stat-val { color: var(--red); }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}
@media (max-width: 700px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.chart-card h3 { font-size: .95rem; font-weight: 700; color: var(--dark); margin-bottom: 1rem; }
.chart-card.full { grid-column: 1 / -1; }

.responses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.responses-table th {
  background: var(--t-head, #1E3A5F);
  color: #fff;
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}
.responses-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.responses-table tr:last-child td { border-bottom: none; }
.responses-table tr:nth-child(even) td { background: #F8FAFC; }

.score-pill {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
}
.score-pill.good   { background: #D1FAE5; color: #065F46; }
.score-pill.medium { background: #FEF3C7; color: #92400E; }
.score-pill.low    { background: #FEE2E2; color: #7F1D1D; }

.login-box {
  max-width: 380px;
  margin: 5rem auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
}
.login-box h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 1.5rem; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header h1 { font-size: 1.4rem; }
  .sat-card { flex-direction: column; align-items: flex-start; }
  .admin-header { flex-direction: column; }
}
