/* ============================
   VARIABLES — palette reprise du logo MathsMDE (identique au reste du site)
============================ */
:root {
  --bleu-clair: #d0e4ff;
  --bleu-accent: #7fb3ff;
  --bleu-primaire: #0050a0;
  --bleu-fonce: #003a80;
  --bleu-marine: #002a60;
  --bleu-nuit: #001a40;

  --bg: #f4f8ff;
  --text: #1c2b3a;
  --text-muted: #5b6b7d;
  --card-bg: #fff;
  --shadow: rgba(0, 42, 96, 0.10);
  --shadow-strong: rgba(0, 42, 96, 0.18);
  --radius: 18px;
}

/* ============================
   RESET & BASE
============================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: hidden; width: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 0%, var(--bleu-clair) 0%, transparent 45%),
    radial-gradient(circle at 100% 20%, #eaf2ff 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
}

img, svg { max-width: 100%; height: auto; }

h1, h2, .brand-text { font-family: 'Lexend', 'Inter', sans-serif; }

a { color: var(--bleu-primaire); }
a:hover { color: var(--bleu-fonce); }

/* ============================
   HEADER (identique au reste du site)
============================ */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  border-bottom: 1px solid rgba(0, 58, 128, 0.08);
  box-shadow: 0 2px 20px rgba(0, 42, 96, 0.06);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 100;
}

header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--bleu-fonce), var(--bleu-accent), var(--bleu-clair));
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--bleu-fonce);
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text small {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.logo img {
  height: 52px;
  width: auto;
  filter: drop-shadow(0 3px 8px rgba(0, 58, 128, 0.25));
}

.badge-ens {
  background: linear-gradient(135deg, var(--bleu-primaire), var(--bleu-fonce));
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--shadow-strong);
  letter-spacing: 0.02em;
}

/* ============================
   MENU BOUTON + LATERAL (identique au reste du site)
============================ */
.menu-button {
  width: 44px; height: 44px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--bleu-primaire), var(--bleu-fonce));
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow-strong);
  transition: transform 0.15s ease;
}
.menu-button:hover { transform: scale(1.06); }

#side-menu-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 26, 64, 0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 98;
}
#side-menu-overlay.visible { opacity: 1; pointer-events: auto; }

#side-menu {
  position: fixed; top: 0; right: -300px;
  width: 280px; height: 100vh;
  background: #fff;
  box-shadow: -8px 0 30px var(--shadow-strong);
  transition: right 0.3s cubic-bezier(.25,.8,.25,1);
  padding: 100px 20px 24px;
  z-index: 99;
}
#side-menu.open { right: 0; }

#side-menu nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 4px;
  text-decoration: none; color: var(--text);
  font-size: 15px; font-weight: 500; border-radius: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}
#side-menu nav a .ic { font-size: 18px; }
#side-menu nav a:hover { background: var(--bleu-clair); color: var(--bleu-fonce); }

.side-menu-sep { height: 1px; background: #e6edf7; margin: 12px 4px; }

/* ============================
   MAIN
============================ */
.wrap {
  flex: 1;
  padding: 130px 20px 40px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

h1 { text-align: center; color: var(--bleu-fonce); margin-bottom: 8px; font-size: 30px; font-weight: 800; }
h2 { color: var(--bleu-fonce); font-size: 20px; margin: 22px 0 10px; }
.lead { text-align: center; color: var(--text-muted); margin-bottom: 30px; }
.crumb { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.crumb a { color: var(--text-muted); text-decoration: underline; }
.meta { display: block; color: var(--text-muted); font-size: 13px; }

.badge {
  background: var(--bleu-clair); color: var(--bleu-fonce);
  font-style: normal; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge.lock { background: #f1f3f8; color: var(--text-muted); }

/* ============================
   CARTES CATEGORIES (meme langage visuel que .chap-card du site)
============================ */
.cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 20px 0 36px;
}

.card {
  display: block;
  background: var(--card-bg);
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: 0 10px 28px var(--shadow);
  border: 1px solid rgba(0, 58, 128, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--bleu-primaire), var(--bleu-accent));
  opacity: 0; transition: opacity 0.2s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px var(--shadow-strong); }
.card:hover::before { opacity: 1; }
.card h2 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0 0 10px; color: var(--text-muted); font-size: 14px; }

/* ============================
   LISTES DE SUJETS / DISCUSSIONS RECENTES
============================ */
.list { list-style: none; margin: 12px 0; }
.list li {
  background: var(--card-bg);
  border: 1px solid rgba(0, 58, 128, 0.06);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: 0 6px 18px var(--shadow);
}
.list li a { font-weight: 700; color: var(--bleu-fonce); text-decoration: none; }
.list li a:hover { text-decoration: underline; }

/* ============================
   FIL DE DISCUSSION
============================ */
.post {
  background: var(--card-bg);
  border: 1px solid rgba(0, 58, 128, 0.06);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 16px 0;
  box-shadow: 0 10px 28px var(--shadow);
}
.post header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid #e6edf7;
  padding-bottom: 10px; margin-bottom: 14px;
}
.post header strong { color: var(--bleu-fonce); }
.post .meta { display: inline; }
.post .body { overflow-wrap: anywhere; }
.attach { max-width: 100%; border-radius: 12px; margin-top: 14px; border: 1px solid #e6edf7; }

/* ============================
   FORMULAIRES
============================ */
.form, .login-card {
  background: var(--card-bg);
  border: 1px solid rgba(0, 58, 128, 0.06);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: 0 10px 28px var(--shadow);
  display: grid;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto 30px;
}
.login-card h1 { margin-bottom: 4px; }
.login-card .lead { margin-bottom: 18px; }

.form label {
  display: grid; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text);
}

input, select, textarea {
  font: inherit;
  padding: 11px 14px;
  border: 1.5px solid #dde6f3;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bleu-primaire);
}
textarea { resize: vertical; }

/* ============================
   BOUTONS
============================ */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--bleu-primaire), var(--bleu-fonce));
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px var(--shadow-strong);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px var(--shadow-strong); text-decoration: none; }

/* ============================
   MODERATION (enseignant)
============================ */
.modbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.modbar button, .inline button {
  background: var(--bleu-clair);
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--bleu-fonce);
  transition: background 0.15s ease;
}
.modbar button:hover, .inline button:hover { background: #b9d6ff; }
.inline { display: inline; margin-left: auto; }

/* ============================
   MESSAGES FLASH / ERREUR
============================ */
.flash {
  background: #dcfce7; border: 1px solid #86efac; color: #15803d;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
  max-width: 640px; margin-left: auto; margin-right: auto;
}
.error {
  background: #fee2e2; border: 1px solid #fca5a5; color: #b91c1c;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
  max-width: 640px; margin-left: auto; margin-right: auto;
}

/* ============================
   FOOTER
============================ */
.foot {
  border-top: 1px solid #e6edf7;
  padding: 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}
.foot p { margin-bottom: 4px; }

code {
  background: var(--bleu-clair);
  color: var(--bleu-fonce);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

@media (max-width: 600px) {
  .wrap { padding: 120px 14px 30px; }
}
