/* === BASE GLOBALE === */
body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  background-color: #f4f4f9;
  padding: 20px;
}

/* === BUTTON GRID === */
.button-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  padding: 20px;
  max-width: 800px;
  width: 100%;
  margin-bottom: 20px;
}

/* === ROUND BUTTONS === */
.round-button {
  display: block;
  text-align: center;
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  background-color: #4CAF50;
  color: white;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.round-button:hover {
  background-color: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.round-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Couleurs supplémentaires */
.round-button.blue { background-color: #2196F3; }
.round-button.blue:hover { background-color: #0b7dda; }
.round-button.red { background-color: #f44336; }
.round-button.red:hover { background-color: #da190b; }
.round-button.orange { background-color: #FF9800; }
.round-button.orange:hover { background-color: #e68a00; }
.round-button.purple { background-color: #9C27B0; }
.round-button.purple:hover { background-color: #7b1fa2; }
.round-button.dark { background-color: #24292e; }
.round-button.dark:hover { background-color: #1f2328; }
.round-button.teal { background-color: #16a085; }
.round-button.teal:hover { background-color: #13856d; }

/* === CONTENT PANELS === */
.content {
  max-width: 800px;
  width: 100%;
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: none;
}
.content.active { display: block; }

/* === NOTE BLOCK === */
.note {
  font-size: 13px;
  color: #555;
  background: #f7f7fb;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 8px 12px;
  display: inline-block;
  margin-top: 8px;
}

/* === BLOCKQUOTE === */
blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  font-style: italic;
  border-radius: 6px;
}

/* === ROOT VARIABLES === */
:root{
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --text: #101826;
  --muted: #6b7280;
  --accent: #6366f1;
  --ring: rgba(99,102,241,.35);
  --outline: 1px solid rgba(16,24,38,.06);
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --shadow-lg: 0 18px 40px rgba(0,0,0,.12);
  --radius: 14px;
}

/* === DARK THEME === */
[data-theme="dark"]{
  --bg: #0b1220;
  --bg-elev: #101827;
  --text: #e8edf5;
  --muted: #9aa4b2;
  --accent: #818cf8;
  --ring: rgba(129,140,248,.5);
  --outline: 1px solid rgba(255,255,255,.08);
  --shadow: 0 2px 14px rgba(0,0,0,.35);
  --shadow-lg: 0 22px 50px rgba(0,0,0,.45);
}

/* === BODY BACKGROUND (GRADIENTS) === */
html, body { min-height: 100%; }

body{
  background:
    radial-gradient(900px 600px at 20% -10%, rgba(99,102,241,.10), transparent 55%),
    radial-gradient(700px 500px at 120% -20%, rgba(236,72,153,.12), transparent 55%),
    var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === TOPBAR (THEME + MAIL) === */
.topbar-aide{
  width:100%;
  max-width:1200px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  margin: 6px auto 8px;
}
.chip-aide{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:none;
  cursor:pointer;
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow);
  border: var(--outline);
  transition: transform .08s ease, box-shadow .25s ease, background .25s ease;
}
.chip-aide:active{ transform: scale(.98) }

/* === LEGEND COLORS === */
.legend-aide{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 16px;
  margin: 14px 0 !important;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: var(--outline);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.legend-item { display:flex; align-items:center; gap:8px; font-size:14px; }

.swatch{
  width:14px; height:14px;
  border-radius:4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.sw-blue{ background:#2196F3; }
.sw-green{ background:#4CAF50; }
.sw-red{ background:#f44336; }
.sw-orange{ background:#FF9800; }
.sw-teal{ background:#16a085; }

/* === CONTENT CARDS (Prose) === */
.prose{ line-height:1.65; font-size:16px; }
.prose h2{ margin: 10px 0 6px; }
.prose h3{ margin: 12px 0 6px; }
.prose p{
  margin: 10px 0 14px !important;
  line-height: 1.8 !important;
  letter-spacing: .1px;
  text-wrap: pretty;
  hyphens: auto;
}
.prose li{ margin:6px 0 !important; }

/* =========================
   🧾 CONTENT (tables, images)
   ========================= */
.content img,
.content video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px auto;
  border-radius: 10px;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 15px;
}

.prose th,
.prose td {
  border: var(--outline);
  padding: 8px 10px;
  text-align: left;
}

/* =========================
   🌙 DARK-MODE FIXES
   ========================= */
[data-theme="dark"] .content,
[data-theme="dark"] .content :where(p, div, section, article, li, table, th, td, pre) {
  background-color: transparent !important;
  color: var(--text);
  border-color: rgba(255, 255, 255, .12);
}

[data-theme="dark"] .content table {
  background: transparent !important;
}

[data-theme="dark"] .content tr:nth-child(odd) {
  background: rgba(255,255,255,.04) !important;
}

/* =========================
   📌 WIDTH ALIGNMENT
   ========================= */
.button-container,
.legend-aide,
.content,
.footer-band-aide {
  width: min(100%, 1200px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* =========================
   📦 FOOTER BAND
   ========================= */
.footer-band-aide {
  position: static;
  width: 100%;
  max-width: 1200px;
  margin: 24px auto 8px auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,.0), rgba(255,255,255,.02)),
    var(--bg-elev);
  border: var(--outline);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 22px 24px;
  line-height: 1.45;
  font-size: 14px;
}

.footer-band-aide .footer-title {
  font-weight: 800;
  margin-right: .45rem;
}

.footer-band-aide .footer-hint {
  color: var(--muted);
}

/* =========================
   🔔 INFO BAR
   ========================= */
.info-bar {
  width: 100%;
  margin: 8px auto 12px auto;
  padding: 10px 14px;
  background: var(--bg-elev);
  color: var(--text);
  border: var(--outline);
  border-radius: 12px;
  box-shadow: var(--shadow);
  line-height: 1.5;
  text-align: center;
  transition: opacity .35s ease, transform .35s ease;
  opacity: 0;
  transform: translateY(-4px);
}

.info-bar.show {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   📱 RESPONSIVE — TABLETTES (< 768px)
   ========================= */
@media (max-width: 768px) {

  body {
    padding: 0.75rem;
    font-size: 15px;
    line-height: 1.5;
  }

  .page,
  .main,
  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* Grilles → 1 colonne */
  .grid,
  .cards-grid,
  .softwares-grid,
  .cards,
  .grid-softwares {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  /* Boutons ronds plus larges */
  .round-button,
  .round-button.green,
  .round-button.blue {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  /* Cartes / encadrés */
  .content,
  .card,
  .encadre,
  .section,
  .footer-card {
    padding: 0.9rem;
    margin: 0.25rem 0;
    border-radius: 0.9rem;
  }

  /* Titres réduits */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.05rem; }

  /* Badges / toolbars peuvent passer à la ligne */
  .badges,
  .toolbar,
  .section-toolbar,
  .footer-meta {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* Quiz */
  .quiz-card {
    width: 100%;
    max-width: 100%;
    margin: 0 0.5rem;
    padding: 0.75rem;
  }

  .quiz-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .quiz-nav,
  .quiz-submit {
    flex: 1 1 45%;
  }
}

/* =========================
   📱 MOBILE — PETITS ÉCRANS (< 480px)
   ========================= */
@media (max-width: 480px) {

  body {
    padding: 0.5rem;
    font-size: 14px;
  }

  .round-button,
  .round-button.green,
  .round-button.blue {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
  }

  header,
  .hero,
  .intro {
    padding: 0.5rem 0;
  }

  .badges,
  .toolbar,
  .section-toolbar,
  .footer-meta {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
}

/* =========================
   🖊️ MINI-ÉDITEUR HTML
   ========================= */
.editor-container {
  max-width: 960px;
  margin: 0 auto;
}

.info {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: #4b5563;
}

textarea {
  width: 100%;
  height: 260px;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #9ca3af;
  background: #111827;
  color: #e5e7eb;
  resize: vertical;
}

.buttons {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: #2563eb;
  color: #f9fafb;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

button:hover {
  background: #1d4ed8;
}

button.secondary {
  background: #6b7280;
  box-shadow: 0 4px 10px rgba(55, 65, 81, 0.4);
}

button.secondary:hover {
  background: #4b5563;
}

iframe {
  width: 100%;
  height: 320px;
  margin-top: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #9ca3af;
  background: white;
}

.note-localstorage {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
}
/* =========================
   ▶️ YOUTUBE LINK BUTTON
   ========================= */
.youtube-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: #FF0000; /* Rouge YouTube */
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 18px rgba(255, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.youtube-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(255, 0, 0, 0.45);
}

.youtube-icon {
  width: 22px;
  height: 22px;
  display: block;
}


/* =========================
   🎨 CONTENT / PROSE EXTENSIONS
   ========================= */
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  background: color-mix(in srgb, var(--bg) 80%, var(--bg-elev));
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.06);
}

.prose pre {
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  border: var(--outline);
  background: color-mix(in srgb, var(--bg-elev) 75%, #000);
}

.prose ul,
.prose ol {
  margin: 8px 0 12px 1.25rem;
  padding: 0;
}

.prose strong {
  font-weight: 800;
}

/* =========================
   🌓 DARK MODE — CONTENT FIXES
   ========================= */
[data-theme="dark"] .content pre {
  background: rgba(255,255,255,.06) !important;
}

[data-theme="dark"] .prose code {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
}

/* =========================
   🖼️ QUIZ (structure générale)
   ========================= */
.quiz-card {
  background: var(--bg-elev);
  border: var(--outline);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  max-width: 800px;
  margin: 20px auto;
}

.quiz-question {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  padding: 10px 14px;
  border-radius: 10px;
  border: var(--outline);
  background: var(--bg-elev);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.quiz-option:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.quiz-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.quiz-submit,
.quiz-nav {
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  font-weight: 700;
}

.quiz-submit {
  background: var(--accent);
  color: white;
}

.quiz-nav {
  background: var(--muted);
  color: white;
}

/* =========================
   🌓 DARK MODE — QUIZ FIXES
   ========================= */
[data-theme="dark"] .quiz-card {
  background: var(--bg-elev);
  border-color: rgba(255,255,255,.1);
}

[data-theme="dark"] .quiz-option {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.12);
}

[data-theme="dark"] .quiz-option:hover {
  background: rgba(255,255,255,.06);
}

/* =========================
   🎛️ BUTTON HOVER EFFECTS
   ========================= */
.round-button:hover {
  filter: saturate(1.05);
}

/* =========================
   🧭 LAYOUT STABILITY (CLS FIXES)
   ========================= */
.content {
  min-height: 200px; /* Empêche les sauts de layout */
}

/* =========================
   🌈 FIXES MARGIN & SPACING
   ========================= */
.legend-aide {
  margin-top: 14px !important;
  margin-bottom: 14px !important;
}

.prose p + p {
  margin-top: .25rem !important;
}

/* =========================
   🔧 EXTRA ALIGNMENT FIX
   ========================= */
.footer-band-aide {
  padding: 22px 24px !important;
}
/* === Modal du quiz ============== */
.quiz-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;              /* caché par défaut */
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

/* Quand le JS met l'attribut "open", on affiche le modal */
.quiz-modal[open] {
  display: grid;
}

/* La carte du quiz à l'intérieur du modal */
.quiz-card {
  background: var(--bg-elev, #111);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  width: min(100% - 32px, 760px);
  margin: 0; /* plus besoin du margin auto */
}
/* ===========================
   Bloc Intelligence Artificielle
   =========================== */

#mistral-ai {
  max-width: 900px;
  margin: 20px auto;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(
    145deg,
    rgba(255,255,255,0.06),
    rgba(255,255,255,0.02)
  );
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
}

/* Titre */
#mistral-ai h2 {
  margin-bottom: 12px;
  font-size: 1.3rem;
  font-weight: 600;
}

/* Zone de texte */
#mistralPrompt {
  width: 100%;
  min-height: 130px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

#mistralPrompt::placeholder {
  opacity: 0.6;
}

#mistralPrompt:focus {
  border-color: rgba(120,170,255,0.8);
  box-shadow: 0 0 0 4px rgba(120,170,255,0.15);
}

/* Ligne de boutons */
.mistral-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Boutons */
#mistralSend,
#mistralClear {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

#mistralSend:hover,
#mistralClear:hover {
  background: rgba(255,255,255,0.15);
}

#mistralSend:active,
#mistralClear:active {
  transform: translateY(1px);
}

#mistralSend:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Réponse IA */
#mistralAnswer {
  margin-top: 14px;
  padding: 14px;
  min-height: 70px;
  border-radius: 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.12);
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.95rem;
}

/* Petit effet "IA réfléchit" */
#mistralAnswer.loading {
  opacity: 0.75;
  font-style: italic;
}


/* Réponse IA : style "chat" */
.mistral-answer {
  margin-top: 14px;
  padding: 14px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.12);
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: normal;        /* important: pas pre-wrap ici */
  overflow-wrap: anywhere;
}

/* Titres markdown */
.mistral-answer h1,
.mistral-answer h2,
.mistral-answer h3 {
  margin: 10px 0 8px;
  font-weight: 700;
}

.mistral-answer hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 12px 0;
}

/* Listes */
.mistral-answer ul,
.mistral-answer ol {
  margin: 8px 0 8px 18px;
}

/* Code inline + bloc */
.mistral-answer code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.9em;
}

.mistral-answer pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.12);
  overflow: auto;
}

