/* L'Aparté - Groupes */
/* La largeur du main est gérée par base.css (80% de l'écran) */
.group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem;
    border: 1px solid var(--bord);
    border-radius: 8px;
    margin-bottom: 0.6rem;
    cursor: pointer;
    transition: background .2s;
}
.group-item:hover { background: var(--fond); }
.group-item .g-name { font-weight: 600; color: var(--texte); }
.group-item .g-desc { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.group-item .g-meta { color: var(--muted); font-size: 0.8rem; }
.g-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    margin-right: 4px;
    vertical-align: middle;
}
.g-badge-public { background: var(--accent2); color: #fff; }
.g-badge-private { background: var(--accent); color: var(--on-accent); }
.g-badge-pending { background: var(--msg-err); color: #fff; }
.g-notmember { color: var(--accent); font-weight: 600; }
.back {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--accent2);
    text-decoration: none;
    font-size: 0.9rem;
}
.back:hover { text-decoration: underline; }

/* Messagerie de groupe */
.messages { max-height: 400px; overflow-y: auto; padding: 0.5rem; margin-bottom: 1rem; }
.msg-item { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--bord); }
.msg-item .m-author { color: var(--accent2); font-weight: 600; font-size: 0.85rem; }
.msg-item .m-time { color: var(--muted); font-size: 0.75rem; margin-left: 0.5rem; }
.msg-item .m-content { color: var(--texte); margin-top: 0.2rem; }
.msg-input { display: flex; gap: 0.6rem; }
.msg-input input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: var(--fond);
    border: 1px solid var(--bord);
    border-radius: 6px;
    color: var(--texte);
}
.msg-input input:focus { outline: none; border-color: var(--accent2); }

/* --- Fil d'actualité privé dans les groupes --- */
.post-form { margin-bottom: 1rem; }
.post-form textarea {
    width: 100%;
    padding: 0.6rem;
    background: var(--fond);
    border: 1px solid var(--bord);
    border-radius: 6px;
    color: var(--texte);
    font-size: 0.95rem;
    resize: vertical;
}
.post-form-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }
.post { padding: 0.8rem 0; border-bottom: 1px solid var(--bord); }
.post:last-child { border-bottom: none; }
.post-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.post-date { color: var(--muted); font-size: 0.8rem; }
.post-content { color: var(--texte); line-height: 1.5; white-space: pre-wrap; }
.see-more-btn {
    display: inline-block;
    margin: 2px 0 0;
    padding: 0;
    background: none;
    border: none;
    color: var(--muted, #64748b);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}
.see-more-btn:hover { color: var(--accent2, #0369a1); text-decoration: underline; }
.post-media { max-width: 100%; border-radius: 8px; margin-top: 0.5rem; margin-bottom: 2rem; text-align: center; }
.post-media img, .post-media video { display: block; margin: 0 auto; max-width: min(100%, 720px); max-height: 70vh; width: auto; height: auto; object-fit: contain; background: #000; border-radius: 8px; }
.yt-embed { position: relative; width: 80%; margin: 0.5rem auto 0 auto; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; }
.yt-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.post-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.comments-box { margin-top: 0.6rem; padding: 0.6rem; background: var(--fond); border-radius: 8px; }
.comment-item {
    padding: 0.4rem 0 0.4rem 1.75rem;
    border-bottom: 1px solid var(--bord);
    position: relative;
}
/* Filet vertical : matérialise l'appartenance du commentaire au post. */
.comment-item::before {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: 0.8rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--bord);
    border-radius: 2px;
}
.comment-item .comment-item::before { left: 0.2rem; }
/* En-tête du commentaire : avatar + pseudo + date sur une même ligne. */
.comment-head { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.comment-author { color: var(--accent2); text-decoration: none; font-weight: 600; }
.comment-author:hover { text-decoration: underline; }
.comment-date { color: var(--muted); font-size: 0.75rem; }
/* Le commentaire démarre sur sa propre ligne, avec un peu d'air sous l'en-tête. */
.comment-content { color: var(--texte); font-size: 0.9rem; margin-top: 0.35rem; }
.comment-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.comment-input { flex: 1; min-width: 0; padding: 0.5rem; background: var(--fond); border: 1px solid var(--bord); border-radius: 6px; color: var(--texte); }
/* Médias dans les commentaires de groupe (bouton 📎 + aperçu + rendu). */
.reply-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.3rem; }
.comment-form .md-toolbar, .reply-form .md-toolbar { flex-basis: 100%; order: 3; }
.comment-media-btn {
    flex: 0 0 auto; order: 1; padding: 0.4rem 0.6rem; border: 1px solid var(--bord);
    border-radius: 6px; background: var(--fond); color: var(--texte); cursor: pointer; font-size: 0.95rem; line-height: 1;
}
.comment-media-btn:hover { border-color: var(--accent, #0ea5e9); }
.comment-media-input { order: 1; }
.comment-form > .btn, .reply-form > .btn { order: 2; }
.comment-media-preview { flex-basis: 100%; order: 4; display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem; }
.comment-media-clear { border: none; background: transparent; color: var(--msg-err, #ef4444); cursor: pointer; font-weight: bold; }
.comment-media { margin-top: 0.4rem; }
.comment-media img, .comment-media video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; }

/* Avatars (rond + lettre pour les users sans photo) — dupliqué d'index.css car groups.html ne charge pas index.css */
.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.4rem;
    display: inline-block;
    flex-shrink: 0;
}
.author-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    line-height: 1;
}

/* Tooltip "qui a liké" (survol du bouton like) */
.react-tooltip {
    position: fixed;
    z-index: 3000;
    min-width: 120px;
    max-width: 260px;
    background: var(--carte, #1e293b);
    color: var(--texte, #e2e8f0);
    border: 1px solid var(--bord, rgba(100,116,139,0.3));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
    line-height: 1.5;
    pointer-events: none;
    display: none;
}
.react-tooltip .rt-title {
    font-weight: 700;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
}
.react-tooltip .rt-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.react-tooltip .rt-empty {
    color: var(--muted, #94a3b8);
    font-style: italic;
}

/* --- Publications épinglées (owner/admin) --- */
.post-pinned {
    border-left: 3px solid var(--accent, #f59e0b);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.07), transparent 40%);
    padding-left: 0.9rem;
    padding-right: 0.6rem;
    margin-left: -0.2rem;
    border-radius: 0 6px 6px 0;
}
.post-pinned-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent, #d97706);
    background: rgba(245, 158, 11, 0.12);
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
    margin-bottom: 0.45rem;
    letter-spacing: 0.02em;
}

/* Aperçu de lien (unfurl) — groupes.
   Repris de index.css (l'aperçu ne s'affichait pas dans les groupes faute de style).
   Largeur bornée à 100% du conteneur pour ne jamais déborder sous la colonne de droite. */
.link-preview {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    margin-top: 10px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--bord, rgba(100,116,139,0.3));
    border-radius: 10px;
    background: var(--carte, #1e293b);
    text-decoration: none;
    color: var(--texte, #e2e8f0);
    overflow: hidden;
    transition: background 0.15s;
}
.link-preview:hover { background: var(--carte-hover, #f1f5f9); }
.link-preview .lp-thumb { width: 100%; max-height: 360px; overflow: hidden; border-radius: 0; background: rgba(0,0,0,0.15); }
.link-preview .lp-thumb img { width: 100%; height: 100%; max-height: 360px; object-fit: cover; display: block; }
.link-preview .lp-body { min-width: 0; padding: 12px 14px; }
.link-preview .lp-title { font-weight: 600; font-size: 1.05rem; line-height: 1.35; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.link-preview .lp-desc { font-size: 0.88rem; color: var(--muted, #94a3b8); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.link-preview .lp-host { font-size: 0.76rem; color: var(--muted, #94a3b8); margin-top: 6px; text-transform: lowercase; }

/* Réactions cœur/pouce sur les commentaires de groupe (aligné sur index.css) */
.comment-item .react-btn, .comment-item .comment-react {
    border-radius: 8px;
    padding: 0.12rem 0.5rem;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.comment-item .react-btn .cnt { font-size: 0.8rem; }
.comment-item .comment-react:hover { transform: scale(1.08); }
.comment-item .heart-btn:hover, .comment-item .heart-btn.active { border-color: #e0245e; background: rgba(231,36,94,0.1); }
.comment-item .heart-btn.active { color: #e0245e; }
.comment-item .thumb-btn:hover, .comment-item .thumb-btn.active { border-color: #f472b6; background: rgba(244,114,182,0.12); }
.comment-item .thumb-btn.active { color: #f472b6; }
