/* --- Layout global --- */
.groups-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  margin: 50px auto 80px;
  width: 95%;
  max-width: 1300px;
}
.sidebar.left { width: 220px; }
.sidebar.right { width: 280px; }
.groups-main { flex: 1; }

/* --- Contenu principal --- */
.groups-main {
  background: rgba(255,255,255,0.95);
  border-radius: 15px;
  padding: 25px 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  min-height: 600px;
}

/* --- Sidebar --- */
.groups-sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 40px;
}

.widget {
  background: rgba(255,255,255,0.9);
  border-radius: 10px;
  padding: 15px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.widget h4 { color: #002266; font-size: 15px; margin-bottom: 8px; }
.widget p { color: #333; font-size: 14px; }
.widget-img { width: 100%; border-radius: 8px; display: block; }

/* --- Titre de page --- */
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: #002266;
  text-shadow: 0 0 8px rgba(255,255,255,0.8);
  margin-bottom: 20px;
}

/* --- Si aucun groupe --- */
.no-groups {
  text-align: center;
  font-size: 15px;
  color: #444;
}

/* --- Grille de groupes --- */
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* --- Carte de groupe --- */
.group-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.3s;
}
.group-card:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.group-card a {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* --- Image du groupe --- */
.group-thumb img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

/* --- Corps de la carte --- */
.group-body {
  flex: 1;
  padding: 10px 15px;
}
.group-body h3 {
  font-size: 17px;
  color: #002266;
  font-weight: 700;
  margin-bottom: 5px;
}
.group-body p {
  font-size: 14px;
  color: #444;
  line-height: 1.3;
  margin: 0;
}

/* --- Pied de carte --- */
.group-footer {
  text-align: right;
  font-size: 13px;
  color: #666;
  padding: 0 15px 10px;
}

/* ===========================
   PAGE VIEW (DÉTAIL D'UN GROUPE)
   =========================== */
.page-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 40px auto 80px;
  width: 90%;
  max-width: 1100px;
}

.page-inner.group-view {
  background: rgba(255,255,255,0.95);
  border-radius: 15px;
  padding: 30px 40px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.25);
  width: 100%;
}

/* --- Bannière du groupe --- */
.group-cover {
  width: 60%;
  max-height: 220px;
  object-fit: contain;
  background-color: #fff;
  border-radius: 10px;
  display: block;
  margin: 0 auto 20px;
  padding: 10px;
}

/* --- Infos du groupe --- */
.group-info {
  margin-top: 10px;
  text-align: center;
}
.group-info h2 {
  font-size: 26px;
  font-weight: 700;
  color: #002266;
  text-shadow: 0 0 8px rgba(255,255,255,0.7);
  margin-bottom: 10px;
}
.group-info p {
  font-size: 15px;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.5;
}
.group-info span { font-size: 13px; color: #666; }

/* --- Boutons rejoindre / quitter --- */
.group-actions {
  margin-top: 20px;
  text-align: center;
}
.btn-join,
.btn-leave {
  background: linear-gradient(90deg, #0044cc, #00aaff);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  margin: 5px;
  transition: background 0.3s, transform 0.2s;
  font-size: 14px;
  font-weight: 600;
}
.btn-leave { background: linear-gradient(90deg, #cc0000, #ff4444); }
.btn-join:hover,
.btn-leave:hover { transform: scale(1.05); opacity: 0.9; }

/* --- Section activités --- */
.group-content { margin-top: 40px; }

/* --- Liste des posts --- */
.posts-list .post-card {
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.post-card { position: relative; padding-bottom: 15px; }

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #333;
  margin-bottom: 10px;
}
.post-header img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.post-header span { color: #666; font-size: 12px; }

.post-body p {
  color: #333;
  font-size: 15px;
  margin-bottom: 10px;
}

.no-posts { text-align: center; color: #777; padding: 15px; }

/* --- Zone de publication --- */
.post-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  margin: 25px auto;
  max-width: 700px;
}
.post-box .post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.post-header img.post-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0044cc;
  background: #eee;
}
.post-header h3 { font-size: 18px; font-weight: 700; color: #002266; margin: 0; }

/* --- Boutons / Toolbar --- */
.post-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.post-toolbar button,
.post-toolbar .file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: #0052cc;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease;
}
.post-toolbar i { font-size: 18px; line-height: 1; }
.post-toolbar button:hover,
.post-toolbar .file-label:hover { background: #003d99; transform: translateY(-1px); }
.post-toolbar .tooltxt { margin-left: 8px; font-size: 13px; font-weight: 600; }
@media (max-width: 520px){ .post-toolbar .tooltxt { display: none; } }
.file-label input { display: none; }

#postContent {
  width: 100%;
  min-height: 120px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
}

/* --- Bouton publier --- */
.btn-publish {
  background: linear-gradient(90deg, #0044cc, #00aaff);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  margin-top: 10px;
}
.btn-publish:hover { opacity: 0.9; transform: scale(1.05); }

/* === Post actions === */
.post-actions {
  position: absolute;
  top: 10px;
  right: 15px;
  display: flex;
  gap: 8px;
}
.btn-post-action {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 17px;
  transition: transform 0.2s;
}
.btn-post-action:hover { transform: scale(1.3); }

/* === Commentaires === */
.comments-section {
  margin-top: 15px;
  border-top: 1px solid #ddd;
  padding-top: 10px;
}
.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.comment-body {
  flex: 1;
  background: #fff;
  color: #111;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  line-height: 1.2;
  font-size: 14.5px;
}
.comment-body strong { display: inline-block; margin-bottom: 4px; color: #000; }
.comment-date { float: right; color: #888; font-size: 0.85em; }
.comment-body p { margin: 5px 0 0; color: #222; }

/* === Formulaire de commentaire === */
.comment-form { margin-top: 10px; }
.comment-form textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 8px;
  font-size: 14px;
  line-height: 1.2;
  color: #000;
  background: #fff;
  box-sizing: border-box;
}
/* --- Correction visuelle : bouton Publier dans les commentaires --- */
.comment-form .btn-publish {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #0044cc, #00aaff);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s ease;
}
.comment-form .btn-publish:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

/* --- Alignement du bouton et de l’emoji --- */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}


/* === Like / Dislike === */
.post-reactions {
  display: flex;
  justify-content: flex-start;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
}
.post-reactions button {
  background: none;
  border: none;
  color: #444;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.2s, transform 0.1s;
}
.post-reactions button:hover {
  background: #f4f5f7;
  transform: translateY(-1px);
}
.like-count-up, .like-count-down {
  font-weight: 600;
  font-size: 14px;
  color: #222;
}

/* === Éditeur Quill (posts + commentaires) === */
#editorWrapper {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
}
.ql-toolbar {
  background: #f8f8f8;
  border-bottom: 1px solid #ddd;
}
.ql-container { border: none; }
.ql-editor {
  color: #000 !important;
  background: #fff !important;
  line-height: 1.00 !important;
  font-size: 15px;
  margin-bottom: 4px;
  padding: 6px 8px;
  border-radius: 8px;
}
.ql-editor p {
  color: #000 !important;
  margin: 2px 0 !important;
}
.ql-editor ul, .ql-editor ol {
  margin: 3px 0 3px 18px !important;
  padding-left: 18px !important;
}
.ql-editor img {
  display: block;
  margin: 10px auto !important;
  border-radius: 8px;
  max-width: 100%;
  height: auto;
  box-shadow: 0 1px 6px rgba(0,0,0,0.15);
}

/* === ESPACEMENT NORMALISÉ POUR LES POSTS === */
.post-content,
.quill-content,
.group-post-content,
.social-group-post-content,
.ql-editor,
.ql-editor * {
  line-height: 1.0 !important;
  margin-top: 4px !important;
  margin-bottom: 6px !important;
  padding: 0 !important;
}

/* === Correction Quill Editor (nouveau design) === */
.ql-editor {
  line-height: 1.4 !important;
  padding: 10px 12px !important;
  font-size: 15px !important;
}

.ql-editor::before {
  color: #999 !important;
  font-style: italic;
  padding-left: 2px;
  top: 8px;
}

.comment-form .ql-editor {
  min-height: 60px !important;
  line-height: 1.3 !important;
  padding: 8px 10px !important;
}

/* === Correction espacement placeholder dans les commentaires === */
.comment-form textarea,
.comment-editor-wrapper .ql-editor {
  padding-top: 10px !important;
  padding-bottom: 8px !important;
  line-height: 1.1 !important;
}
/* === SÉLECTEUR D'EMOJIS FLOTTANT === */
.emoji-picker {
  position: absolute;
  display: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  z-index: 9999;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 6px;
  max-width: 250px;
  max-height: 180px;
  overflow-y: auto;
}

.emoji-grid span, .emoji-grid {
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s;
}

.emoji-grid span:hover {
  transform: scale(1.3);
}
/* === Correction visibilité du texte "Aucun commentaire" === */
.no-comments {
  color: #444 !important;
  font-style: italic;
  font-size: 14px;
  opacity: 1 !important;
  margin-bottom: 8px;
}
.emoji-picker {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  display: none;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-5px);
  transition: all .2s ease;
}
.emoji-picker.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 6px;
  max-width: 250px;
  max-height: 180px;
  overflow-y: auto;
}
.emoji-grid span {
  font-size: 22px;
  cursor: pointer;
  text-align: center;
  transition: transform .1s;
}
.emoji-grid span:hover { transform: scale(1.3); }
/* === Uniformiser l'espacement entre l'éditeur et les posts affichés === */
.post-body,
.post-body p,
.post-content,
.group-post-content,
.social-group-post-content {
  line-height: 1.0 !important;
  font-size: 15px !important;
  color: #000;
  margin-top: 0;
  margin-bottom: 4px;
}
.post-body img {
  margin: 8px auto !important;
  display: block;
  border-radius: 6px;
  max-width: 100%;
  height: auto;
}
/* === Liens (posts, descriptions, commentaires, etc.) === */
a {
  color: #0052cc;            /* bleu plus visible, même teinte que ton bouton Publier */
  text-decoration: none;     /* enlève le soulignement */
  font-weight: 600;
  transition: color 0.2s ease;
}

a:hover {
  color: #003399;            /* bleu foncé au survol */
  text-decoration: underline;
}

.post-body a,
.comment-body a {
  color: #0044cc !important; /* garantit la visibilité dans les zones de contenu */
  font-weight: 600;
}
/* === Alignement du bouton supprimer commentaire (version corrigée) === */
.comment {
  position: relative;
  align-items: flex-start;
}

.comment .btn-delete-comment {
  position: absolute;
  top: 6px;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #666;
  font-size: 16px;
  padding: 2px;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.comment .btn-delete-comment:hover {
  color: #cc0000;
  transform: scale(1.25);
}

/* Pour éviter que la date pousse le bouton */
.comment-date {
  position: relative;
  margin-right: 26px !important; /* laisse la place au bouton */
}
/* --- Images des posts : ne pas recadrer, ne pas sur-agrandir --- */
.posts-list .post-card .post-media { 
  display: flex;
  justify-content: center;
}

.posts-list .post-card .post-media img,
.posts-list .post-card .post-content img,
.post-body img {
  max-width: min(520px, 100%);  /* largeur plafond (ajuste si tu veux) */
  width: 100%;                  /* occupe la largeur dispo jusqu’au plafond */
  height: auto !important;      /* garde le ratio */
  max-height: none !important;  /* pas de coupe verticale */
  object-fit: contain !important; /* pas de recadrage */
  border-radius: 8px;
  display: block;
  margin: 10px auto;
}
/* Neutralise les tailles inline des imports */
.posts-list img[width],
.posts-list img[height],
.posts-list img[style*="width"],
.posts-list img[style*="height"] {
  width: auto !important;
  height: auto !important;
  max-width: min(520px, 100%) !important;
  object-fit: contain !important;
}
/* === MOBILE & TABLET OPTIMIZATION FOR GROUPS PAGE === */
@media (max-width: 992px) {
  body {
    background: #041e42; /* même fond que ton index */
  }

  .groups-wrapper {
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0 10px 60px;
    background: transparent;
  }

  .groups-main {
    width: 100%;
    background: rgba(255,255,255,0.97);
    border-radius: 0;
    padding: 20px 15px;
    box-shadow: none;
    min-height: auto;
  }

  .page-title {
    text-align: center;
    font-size: 22px;
    margin-top: 10px;
    margin-bottom: 20px;
  }

  .group-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .group-card {
    width: 100%;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  }

  .group-thumb img {
    height: auto;
    max-height: 200px;
    object-fit: contain;
  }

  .group-body {
    text-align: center;
    padding: 12px 10px;
  }
  .group-body h3 {
    font-size: 16px;
  }
  .group-body p {
    font-size: 13px;
  }

  .group-footer {
    text-align: center;
    padding: 6px 0 12px;
    font-size: 12px;
  }

  .groups-sidebar {
    width: 100%;
    margin: 30px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .widget {
    width: 90%;
    max-width: 400px;
    background: rgba(255,255,255,0.9);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  }

  footer {
    margin-top: 20px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 20px;
  }
  .group-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .group-body h3 {
    font-size: 15px;
  }
  .group-body p {
    font-size: 12.5px;
  }
  .widget h4 {
    font-size: 13px;
  }
  .widget p {
    font-size: 12.5px;
  }
}
