@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --blue-france: #000091;
  --blue-france-hover: #1212ff;
  --bg-default: #ffffff;
  --bg-alt: #f6f6f6;
  --text-default: #161616;
  --text-title: #1e1e1e;
  --border-default: #dddddd;
  --error: #ce0500;
  --success: #18753c;
  --warning: #b34000;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background-color: #fff;
  color: #161616;
  line-height: 1.6;
}

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

/* ==========================================
   HEADER
========================================== */
header.institution-header {
  border-bottom: 2px solid #ddd;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  flex-wrap: wrap;
  gap: 10px;
}

header .logo-container { display: flex; align-items: center; gap: 15px; }
header .marianne-logo { font-weight: 700; font-size: 1.2rem; line-height: 1.1; text-transform: uppercase; }
header .site-title { font-size: 1.3rem; font-weight: 700; color: #1e1e1e; border-left: 1px solid #ddd; padding-left: 15px; }

.header-right { display: flex; align-items: center; gap: 16px; }

.leaderboard-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 6px;
  background: #f6f6f6; font-size: 0.85rem; font-weight: 600;
  transition: background 0.2s;
}
.leaderboard-link:hover { background: #eee; text-decoration: none; }

/* ==========================================
   TIMER
========================================== */
.timer {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 6px;
  background: #f6f6f6; border: 1px solid #eee;
  font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: #000091;
}

/* ==========================================
   HERO
========================================== */
.hero { background: #000091; color: #fff; padding: 60px 20px; text-align: center; }
.hero h1 { font-size: 2.5rem; margin-bottom: 20px; }
.hero p { font-size: 1.15rem; max-width: 800px; margin: 0 auto; line-height: 1.5; }

/* ==========================================
   START FORM
========================================== */
.start-container {
  max-width: 640px; margin: -30px auto 40px;
  background: #fff; padding: 40px; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1); position: relative;
}
.start-container h2 { color: #000091; margin-bottom: 20px; }
.start-desc { margin-bottom: 25px; color: #555; }

/* ==========================================
   LEVEL CARDS
========================================== */
.levels-grid {
  margin-top: 20px; display: flex; flex-direction: column; gap: 10px;
}
.levels-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }

.level-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 2px solid #ddd; border-radius: 10px;
  cursor: pointer; transition: all 0.2s; position: relative;
}
.level-card input[type="radio"] { display: none; }

.level-card:hover:not(.level-locked) { border-color: #000091; background: #f9f9ff; }
.level-card.level-selected { border-color: #000091; background: #f0f0ff; }

.level-card.level-locked {
  opacity: 0.55; cursor: not-allowed; background: #fafafa;
}

.level-icon { font-size: 1.6rem; flex-shrink: 0; }
.level-info { flex: 1; }
.level-name { font-weight: 700; font-size: 1rem; }
.level-detail { font-size: 0.82rem; color: #555; }
.level-meta { font-size: 0.75rem; color: #888; margin-top: 3px; }
.level-lock-msg { font-size: 0.72rem; color: #ce0500; margin-top: 3px; font-weight: 500; }

/* ==========================================
   COOKIE BANNER
========================================== */
#cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #1e1e1e; color: #fff; padding: 20px; z-index: 9999;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.2); transition: transform 0.5s ease;
}
#cookie-banner.hidden { transform: translateY(100%); }
.cookie-buttons { display: flex; gap: 10px; }
.cookie-buttons button { padding: 8px 15px; font-weight: 700; cursor: pointer; border: none; border-radius: 4px; font-family: inherit; }
.btn-accept { background: #18753c; color: #fff; }
.btn-refuse { background: transparent; color: #fff; border: 1px solid #fff !important; }

/* ==========================================
   QCM PAGE
========================================== */
.qcm-header { background: #f6f6f6; padding: 20px; border-bottom: 1px solid #ddd; text-align: center; }
.qcm-header h2 { color: #000091; margin-bottom: 8px; font-size: 1.2rem; }

.qcm-meta { display: flex; justify-content: center; gap: 14px; margin-bottom: 6px; }

.badge-difficulty, .badge-category {
  font-size: 0.78rem; font-weight: 600;
  padding: 3px 10px; border-radius: 4px;
  background: rgba(0,0,0,0.04);
}

.qcm-form { max-width: 800px; margin: 40px auto; padding: 0 20px; }

.question-card {
  background: #fff; padding: 40px; margin-bottom: 30px;
  border-top: 5px solid #000091;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08); border-radius: 8px;
}
.question-card h3 { font-size: 1.35rem; margin-bottom: 25px; color: #1e1e1e; line-height: 1.5; }

.answer-option {
  display: flex; align-items: flex-start; margin-bottom: 12px;
  padding: 18px 20px; border: 2px solid #ddd; border-radius: 8px;
  cursor: pointer; transition: all 0.2s; font-size: 1.05rem;
}
.answer-option:hover { background: #f6f6f6; border-color: #000091; }
.answer-option input[type="radio"] { margin-right: 14px; margin-top: 4px; transform: scale(1.3); accent-color: #000091; }

.progress-bar { width: 100%; height: 8px; background: #ddd; margin-top: 10px; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #000091; transition: width 0.4s ease; border-radius: 4px; }

.nav-buttons { display: flex; justify-content: space-between; margin-top: 30px; align-items: center; }

/* ==========================================
   REVIEW PAGE
========================================== */
.review-container { max-width: 800px; margin: 0 auto; padding: 30px 20px; }

.review-header { text-align: center; margin-bottom: 30px; }
.review-header h2 { color: #000091; margin-bottom: 8px; }
.review-header p { color: #555; font-size: 0.95rem; }

.review-stats { display: flex; justify-content: center; gap: 20px; margin-top: 12px; }
.review-stat {
  font-size: 0.85rem; font-weight: 600;
  padding: 6px 14px; border-radius: 6px; background: #f6f6f6;
}

.review-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 30px; }

.review-item {
  border: 1px solid #ddd; border-radius: 10px; padding: 16px 20px;
  position: relative; background: #fff;
  transition: border-color 0.2s;
}
.review-item:hover { border-color: #000091; }
.review-unanswered { border-color: #ce0500; background: #fff8f8; }

.review-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.review-item-num { font-weight: 700; color: #000091; font-size: 0.85rem; }
.review-item-category { font-size: 0.72rem; color: #888; }
.review-item-question { font-size: 0.92rem; font-weight: 500; margin-bottom: 6px; line-height: 1.4; }
.review-item-answer { font-size: 0.85rem; }

.review-item-edit {
  position: absolute; top: 16px; right: 16px;
  font-size: 0.78rem; font-weight: 600; color: #000091;
}

.review-actions { margin-top: 20px; }

/* ==========================================
   RESULTS PAGE
========================================== */
.result-panel {
  text-align: center; background: #fff; padding: 40px;
  margin: 40px auto; max-width: 800px;
  border-top: 4px solid #000091;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05); border-radius: 8px;
}

.score-circle {
  width: 150px; height: 150px; border-radius: 50%;
  border: 8px solid #000091;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 700;
  margin: 0 auto 20px; color: #000091;
}

.result-time {
  font-size: 0.95rem; color: #555; margin-bottom: 24px;
  padding: 8px 16px; display: inline-block;
  background: #f6f6f6; border-radius: 6px;
}

/* Category Breakdown */
.category-breakdown {
  text-align: left; margin: 24px auto 28px;
  padding: 20px 24px; background: #f9f9f9; border-radius: 10px;
  border: 1px solid #eee; max-width: 500px;
}

.cat-row { margin-bottom: 14px; }
.cat-row:last-child { margin-bottom: 0; }

.cat-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.cat-label span:first-child { font-size: 0.82rem; font-weight: 600; }
.cat-score { font-size: 0.75rem; color: #666; }

.cat-bar { width: 100%; height: 8px; background: #e5e5e5; border-radius: 4px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* Corrections */
.correction-list { max-width: 800px; margin: 0 auto 60px; padding: 0 20px; }
.correction-list h3 { color: #000091; margin-bottom: 20px; }

.correction-item {
  background: #fff; padding: 25px; margin-bottom: 16px;
  border-left: 5px solid; position: relative;
  border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.correction-item.correct { border-left-color: #18753c; }
.correction-item.incorrect { border-left-color: #ce0500; }

.correction-item.correct::after { content: "✓ Bon"; position:absolute; top:25px; right:25px; color:#18753c; font-weight:700; }
.correction-item.incorrect::after { content: "✗ Faux"; position:absolute; top:25px; right:25px; color:#ce0500; font-weight:700; }

.correction-meta { display: flex; gap: 12px; margin-bottom: 8px; }

.encart-cnil {
  background: #f6e8c3; border-left: 4px solid #b34000;
  padding: 15px; margin-top: 15px; color: #161616;
  display: flex; gap: 10px; border-radius: 4px; font-size: 0.92rem;
}
.encart-cnil::before { content: "💡"; font-size: 1.5rem; }

/* ==========================================
   LEADERBOARD
========================================== */
.leaderboard-container { max-width: 900px; margin: 0 auto; padding: 30px 20px; }

.leaderboard-header { text-align: center; margin-bottom: 30px; }
.leaderboard-header h1 { color: #000091; }
.leaderboard-header p { color: #555; font-size: 0.95rem; }

.leaderboard-empty { text-align: center; padding: 40px; color: #888; }

.leaderboard-table-wrap { overflow-x: auto; }

.leaderboard-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
.leaderboard-table th {
  padding: 12px 16px; text-align: left;
  background: #f6f6f6; color: #555; font-weight: 600;
  border-bottom: 2px solid #ddd; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.leaderboard-table td {
  padding: 14px 16px; border-bottom: 1px solid #eee;
}
.leaderboard-table tr:hover { background: #f9f9ff; }
.leaderboard-table tr.top-rank { background: #fffdf0; }
.leaderboard-table tr.top-rank:hover { background: #fff8e0; }

.rank-cell { font-size: 1.3rem; font-weight: 700; text-align: center; }
.name-cell { font-weight: 600; }
.dossier-cell { font-size: 0.85rem; color: #555; }
.score-pct { font-size: 0.8rem; margin-left: 4px; }
.time-cell { font-variant-numeric: tabular-nums; color: #000091; font-weight: 500; }
.date-cell { font-size: 0.82rem; color: #888; }

/* ==========================================
   FORMS
========================================== */
.form-container {
  max-width: 500px; margin: 40px auto; padding: 30px;
  background: #f6f6f6; border: 1px solid #ddd;
  border-top: 4px solid #000091;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05); border-radius: 8px;
}
.form-container h1 { font-size: 1.8rem; margin-bottom: 20px; color: #000091; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 5px; }

.form-control {
  width: 100%; padding: 10px 12px;
  border: 1px solid #ddd; border-bottom: 2px solid #161616;
  font-size: 1rem; font-family: inherit;
  background: #fff; transition: all 0.3s; border-radius: 4px;
}
.form-control:focus { outline: none; border-bottom-color: #000091; background: #f6f6f6; }

/* ==========================================
   BUTTONS
========================================== */
.btn {
  display: inline-block; padding: 10px 20px;
  font-size: 1rem; font-weight: 700; font-family: inherit;
  text-align: center; border: none; cursor: pointer;
  transition: background 0.3s; border-radius: 4px;
}
.btn-primary { background: #000091; color: #fff; }
.btn-primary:hover { background: #1212ff; text-decoration: none; }
.btn-secondary { background: transparent; color: #000091; border: 1px solid #000091; }
.btn-secondary:hover { background: #f6f6f6; text-decoration: none; }

/* ==========================================
   ALERTS
========================================== */
.alert { padding: 15px; margin-bottom: 20px; border-left: 4px solid; border-radius: 4px; }
.alert-error { background: #fee9e9; border-color: #ce0500; color: #ce0500; }
.alert-success { background: #e5f5eb; border-color: #18753c; color: #18753c; }

/* ==========================================
   RESPONSIVE
========================================== */
@media (max-width: 900px) {
  .leaderboard-table { font-size: 0.82rem; }
  .leaderboard-table th, .leaderboard-table td { padding: 10px 12px; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: 0.95rem; }
  .hero { padding: 40px 16px; }
  
  .start-container { margin: -20px 12px 30px; padding: 24px; }
  .question-card { padding: 24px; }
  .answer-option { padding: 14px; font-size: 0.95rem; }
  
  header.institution-header {
    flex-direction: column; gap: 8px; text-align: center; padding: 1rem;
  }
  header .site-title { border-left: none; padding-left: 0; font-size: 1.1rem; }
  
  .header-right { flex-direction: column; gap: 6px; align-items: center; }

  #cookie-banner { flex-direction: column; gap: 12px; text-align: center; }
  
  .qcm-meta { flex-wrap: wrap; justify-content: center; }

  .review-item-edit { position: static; margin-top: 8px; display: inline-block; }
  .review-stats { flex-direction: column; gap: 6px; align-items: center; }

  .nav-buttons { flex-direction: column; gap: 12px; }
  .nav-buttons .btn { width: 100%; }

  .result-panel { margin: 20px 12px; padding: 28px; }
  .correction-list { padding: 0 12px; }

  .score-circle { width: 120px; height: 120px; font-size: 2rem; border-width: 6px; }
  
  .category-breakdown { padding: 16px; }

  .level-card { flex-direction: row; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
  .start-container { padding: 20px; }
  .question-card { padding: 18px; }
  .question-card h3 { font-size: 1.15rem; }
  .answer-option { font-size: 0.9rem; padding: 12px; }
  
  .leaderboard-table .dossier-cell { display: none; }
}
