
/* ============================================================
 *  🏫 LFAKM — Styles du module Communauté
 *  Fichier : community/css/community.css
 *  Charte alignée sur index.html (Auteur : Djiby Tall)
 * ============================================================ */

:root {
  --ink: #1B2A4A;
  --ink-deep: #10192E;
  --paper: #F7F5F0;
  --brass: #A8853F;
  --slate: #5B6472;
  --line: rgba(27,42,74,0.14);
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Inter', sans-serif;
  --gov-purple: #6a4c93;
  --success: #2e7d32;
  --danger: #B3402A;
}

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

body {
  font-family: var(--sans);
  color: #1a1a1a;
  background: var(--paper);
  line-height: 1.55;
  overflow-x: hidden;
}

/* ============================================================
 *  HEADER (identique à index.html)
 * ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  height: 84px;
  display: flex;
  align-items: center;
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  width: 220px;
  flex-shrink: 0;
}
.brand-mark {
  width: 55px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
  text-align: center;
}
.brand-tag {
  font-size: 10px;
  color: var(--slate);
  text-align: center;
  margin-top: 2px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
nav { flex: 1; display: flex; justify-content: flex-end; align-items: center; }
nav ul {
  display: flex;
  gap: 18px;
  list-style: none;
  align-items: center;
  justify-content: flex-end;
}
nav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
nav a:hover, nav a.active { color: var(--brass); }
nav a.active { font-weight: 700; }

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.profile-name {
  font-weight: 700;
  color: var(--brass);
  font-size: 14px;
}
.profile-role {
  font-size: 11px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#user-profile { display: none; }

.nav-cta {
  background: var(--ink-deep);
  color: #fff !important;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-toggle {
  display: none;
  font-size: 30px;
  cursor: pointer;
  color: var(--ink);
  background: none;
  border: none;
}

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  nav ul {
    display: none;
    position: absolute;
    top: 84px;
    left: 0;
    width: 100%;
    flex-direction: column;
    background: #fff;
    padding: 20px;
    gap: 15px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-bottom: 2px solid var(--line);
    z-index: 999;
  }
  nav ul.show { display: flex; }
  .brand-name { font-size: 13px; }
}

/* ============================================================
 *  HUB COMMUNAUTÉ
 * ============================================================ */
.community-hub {
  max-width: 1180px;
  margin: 0 auto;
  padding: 60px 24px;
}

.community-header {
  text-align: center;
  margin-bottom: 50px;
}

.community-header h1 {
  font-family: var(--serif);
  font-size: 48px;
  color: var(--ink);
  margin-bottom: 15px;
  line-height: 1.2;
}

.community-header p {
  color: var(--slate);
  font-size: 18px;
  opacity: 0.85;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.community-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px 28px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}

.community-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.card-icon { font-size: 2.5rem; margin-bottom: 16px; }
.community-card h2 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 10px;
}
.community-card p {
  color: var(--slate);
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}
.card-cta {
  margin-top: 20px;
  color: var(--brass);
  font-weight: 700;
  font-size: 14px;
}

/* ============================================================
 *  PAGES INTERNES (forum, blog, profs, thread)
 * ============================================================ */
.forum-container, .blog-container, .profs-container, .thread-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}

.page-title {
  font-family: var(--serif);
  color: var(--ink);
  font-size: 32px;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--slate);
  font-size: 14px;
  margin-bottom: 30px;
}

/* Cartes de thread / article */
.thread-card, .post-card, .thread-main, .reply-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  transition: box-shadow .2s, transform .2s;
}
.thread-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.07); transform: translateY(-2px); }
.thread-card h3 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0 0 8px 0;
  font-size: 19px;
  line-height: 1.3;
}
.thread-meta {
  font-size: 12px;
  color: var(--slate);
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.thread-content {
  color: #333;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
}
.thread-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

/* Formulaires */
.form-card, .form-reply {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 25px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.form-card h3, .form-reply h3 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0 0 16px 0;
  font-size: 20px;
}

input[type="text"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  box-sizing: border-box;
  margin-bottom: 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brass);
}
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }

/* Boutons */
.btn-primary {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--ink-deep); }

.btn-brass {
  background: var(--brass);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
}
.btn-brass:hover { background: #96743a; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--slate);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
  transition: background 0.2s;
}
.btn-ghost:hover { background: #f0f0f0; color: var(--ink); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
}
.btn-danger:hover { background: #8f3220; }

.btn-edit {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--slate);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
}
.btn-edit:hover { background: #f0f0f0; color: var(--ink); }

.btn-delete {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
}
.btn-delete:hover { background: var(--danger); color: #fff; }

.btn-see-more {
  display: block;
  margin: 0 auto 20px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}
.btn-see-more:hover { background: #f5f5f5; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-admin { background: #fdecea; color: #B3402A; }
.badge-prof { background: #e3f2fd; color: #1565c0; }
.badge-eleve { background: #e8f5e9; color: #2e7d32; }
.badge-cat { background: #f5f5f5; color: var(--slate); }

/* État vide */
.empty-state {
  text-align: center;
  color: var(--slate);
  padding: 50px 20px;
  font-style: italic;
  font-size: 14px;
}

.loader {
  text-align: center;
  padding: 40px;
  color: var(--slate);
  font-style: italic;
}

/* Compteur de réponses */
.replies-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
}
.replies-header h2 {
  font-family: var(--serif);
  color: var(--ink);
  font-size: 20px;
}
.replies-header .count {
  color: var(--brass);
  font-weight: 700;
  font-size: 14px;
}

/* Réponse individuelle */
.reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.reply-author {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--slate);
}
.reply-author strong { color: var(--ink); font-size: 14px; }
.reply-date { font-size: 11px; color: var(--slate); }
.reply-content {
  color: #333;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 8px;
}
.reply-actions {
  display: flex;
  gap: 8px;
  font-size: 12px;
  align-items: center;
}

.edit-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* Footer */
footer {
  background: var(--ink-deep);
  color: #B7BCC9;
  padding: 40px;
  text-align: center;
  font-size: 13px;
  margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
  .page-hero { padding: 40px 0; }
  .page-hero h1 { font-size: 26px; }
  .page-hero p { font-size: 13px; }
  .forum-container, .thread-container, .blog-container, .profs-container { padding: 20px 16px 40px; }
  .form-card, .form-reply { padding: 16px; }
  .thread-card, .thread-main, .reply-card { padding: 16px; }
  .thread-card h3, .thread-main h1 { font-size: 17px; }
  .thread-content, .reply-content { font-size: 13px; }
  .categories-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .cat-btn { padding: 12px 8px; font-size: 12px; }
  .cat-btn .cat-icon { font-size: 20px; }
  .nav-row { padding: 0 16px; }
  .wrap { padding: 0 16px; }
}

/* ============================================================
 *  Fix global : empêcher le débordement horizontal
 * ============================================================ */
html {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  max-width: 100% !important;
  width: 100% !important;
}

body {
  overflow-x: hidden !important;
  overflow-y: visible !important;   /* ⬅️ LAISSER LE SCROLL AU HTML */
  max-width: 100% !important;
  width: 100% !important;
}

footer {
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow-x: hidden !important;
}

* {
  box-sizing: border-box;
}

/* ============================================================
 *  PICKER EMOJI — Adaptation mobile
 *  Objectif : rendre le picker plus ergonomique sur petit écran
 *  (6 colonnes au lieu de 8, taille tactile, quasi pleine largeur)
 * ============================================================ */
@media (max-width: 500px) {
  #emoji-picker-comment,
  #emoji-picker-thread,
  #emoji-picker-reply,
  [data-role="reply-emoji-picker"] {
    max-width: calc(100vw - 20px) !important;
    max-height: 280px !important;
    margin-left: auto;
    margin-right: auto;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 6px !important;
  }

  .emoji-scroll {
    max-height: 220px !important;
    padding: 6px 10px 10px !important;
  }

  .emoji-btn {
    font-size: 22px !important;
    padding: 6px !important;
  }

  .emoji-header {
    padding: 8px 12px !important;
  }

  .emoji-title {
    font-size: 12px !important;
  }
}