/* ============================================================================
   DISCUSSION — système de discussion standardisé (réception, projet, …)
   Style unique partagé par le composant Vue DiscussionPanel, utilisé aussi bien
   dans les modules Vue que dans les pages legacy (via block_discussion.php).
   Repris à l'identique de l'ancien .prep-discuss-* (VPREP) — préfixe neutre .disc-.
   Tokens : .claude/rules/16-design-ui.md
   ============================================================================ */

.disc-root {
    font-family: 'Manrope', 'Open Sans', sans-serif;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* === Barre de sujets (chips) === */
.disc-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 12px 16px; border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.disc-chips-label {
    font-size: 0.7rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.3px;
    width: 100%; margin-bottom: 2px;
}
.disc-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 14px;
    border: 1px solid #cbd5e1; background: #fff;
    font-size: 0.72rem; font-weight: 600; color: #475569;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.disc-chip:hover { border-color: #93c5fd; background: #f0f9ff; }
.disc-chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.disc-count {
    background: rgba(100,116,139,0.15); padding: 1px 6px;
    border-radius: 8px; font-size: 0.65rem; font-weight: 700;
}
.disc-chip.active .disc-count { background: rgba(255,255,255,0.25); color: #fff; }
/* Bouton "+ Sujet" — variante pointillée discrète */
.disc-chip.disc-chip-add {
    border-style: dashed; color: #2563eb; border-color: #93c5fd; background: #fff;
}
.disc-chip.disc-chip-add:hover { background: #eff6ff; }
/* Saisie inline d'un nouveau sujet */
.disc-newtopic-input {
    border: 1px solid #2563eb; border-radius: 14px;
    padding: 5px 10px; font-size: 0.72rem; font-family: inherit;
    color: #1e293b; outline: none; min-width: 140px;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* === Fil de messages === */
.disc-list { flex: 1; overflow-y: auto; padding: 12px 16px; }
.disc-empty {
    text-align: center; color: #94a3b8;
    font-size: 0.78rem; padding: 24px;
}
.disc-item { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.disc-item.own { flex-direction: row-reverse; }
.disc-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 0.7rem;
    flex-shrink: 0; text-transform: uppercase; overflow: hidden;
}
.disc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.disc-bubble {
    max-width: 75%; padding: 8px 12px; border-radius: 14px;
    background: #f0f2f5; font-size: 0.8rem;
    line-height: 1.4; word-break: break-word;
    border-bottom-left-radius: 4px;
}
.disc-item.own .disc-bubble {
    background: #2563eb; color: #fff;
    border-bottom-left-radius: 14px; border-bottom-right-radius: 4px;
}
.disc-meta { font-size: 0.68rem; color: #94a3b8; margin-bottom: 2px; }
.disc-meta .disc-author { font-weight: 600; color: #475569; }
.disc-item.own .disc-meta { color: rgba(255,255,255,0.7); text-align: right; }
.disc-item.own .disc-meta .disc-author { color: rgba(255,255,255,0.85); }

/* Pastille de sujet sur un message (vue "Tout") */
.disc-topic-pill {
    font-size: 0.62rem; background: #dbeafe; color: #2563eb;
    padding: 1px 6px; border-radius: 6px; margin-left: 4px; font-weight: 700;
}
.disc-item.own .disc-topic-pill { background: rgba(255,255,255,0.25); color: #fff; }

/* Citation de réponse (parent) */
.disc-reply-quote {
    border-left: 2px solid #cbd5e1; padding: 2px 8px; margin-bottom: 4px;
    font-size: 0.7rem; color: #64748b; background: rgba(148,163,184,0.08);
    border-radius: 4px;
}
.disc-item.own .disc-reply-quote { border-left-color: rgba(255,255,255,0.5); color: rgba(255,255,255,0.85); }

/* Mention surlignée dans un message */
.disc-mention { color: #2563eb; font-weight: 700; }
.disc-item.own .disc-mention { color: #fff; text-decoration: underline; }

/* Actions sur un message (répondre / supprimer) */
.disc-actions { margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.disc-action {
    font-size: 0.66rem; color: #94a3b8; cursor: pointer; font-weight: 600;
    background: none; border: none; padding: 0;
}
.disc-action:hover { color: #2563eb; }
.disc-action.disc-action-danger:hover { color: #ef4444; }
.disc-item.own .disc-action { color: rgba(255,255,255,0.75); }
.disc-item.own .disc-action:hover { color: #fff; }
.disc-actions .pi { font-size: 0.8rem; }
.disc-action-icon { position: relative; display: inline-flex; align-items: center; line-height: 1; }
/* Thumb alone on the left; « Répondre » and the trash on the bubble's right edge. */
.disc-action-reply { margin-left: auto; }

/* === Indicateur "en réponse à" au-dessus du composer === */
.disc-reply-indicator {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: #eff6ff;
    border-top: 1px solid #e2e8f0;
    font-size: 0.72rem; color: #475569;
}
.disc-reply-indicator .disc-reply-close { margin-left: auto; cursor: pointer; color: #94a3b8; font-weight: 700; }
.disc-reply-indicator .disc-reply-close:hover { color: #ef4444; }

/* === Destinataire auto (mention commercial) === */
.disc-recipient-chip {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 8px 16px 0; padding: 3px 10px;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; color: #2563eb; width: fit-content;
}
.disc-recipient-chip .disc-recipient-remove { cursor: pointer; color: #94a3b8; font-weight: 700; font-size: 0.9rem; line-height: 1; }
.disc-recipient-chip .disc-recipient-remove:hover { color: #ef4444; }

/* === Composer === */
.disc-input-wrap {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid #e2e8f0; align-items: flex-end;
    position: relative; background: #fff;
}
.disc-input {
    flex: 1; border: 1px solid #e2e8f0; border-radius: 20px;
    padding: 8px 14px; font-size: 0.8rem; resize: none;
    min-height: 36px; max-height: 120px; font-family: inherit; outline: none;
    color: #1e293b;
}
.disc-input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.disc-send {
    background: #2563eb; color: #fff; border: none; border-radius: 50%;
    width: 34px; height: 34px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background 0.15s;
}
.disc-send:hover { background: #1d4ed8; }
.disc-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Dropdown autocomplétion mentions (#) === */
.disc-mention-dropdown {
    position: absolute; bottom: calc(100% - 6px); left: 16px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
    max-height: 220px; overflow-y: auto; z-index: 10; min-width: 220px;
    display: none;
}
.disc-mention-dropdown.open { display: block; }
.disc-mention-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; cursor: pointer; font-size: 0.78rem;
}
.disc-mention-item:hover,
.disc-mention-item.active { background: #f0f9ff; }
.disc-mention-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 0.62rem;
    flex-shrink: 0; text-transform: uppercase; overflow: hidden;
}
.disc-mention-avatar img { width: 100%; height: 100%; object-fit: cover; }
.disc-mention-name { font-weight: 600; color: #1e293b; }
.disc-mention-user { color: #94a3b8; font-size: 0.7rem; }

/* === Variantes === */
/* panel : panneau latéral compact (VPREP) — liste plafonnée, composer collant */
.disc-root.variant-panel .disc-list { max-height: 380px; }
.disc-root.variant-panel .disc-input-wrap { position: sticky; bottom: 0; }

/* inline : intégré dans un dossier (réception/projet).
   Style sobre, aligné sur les colonnes voisines (Temps de travail / Historique) :
   pas de cadre, pas de fond, juste un contenu qui respire sous le titre. */
.disc-root.variant-inline { background: transparent; }
.disc-root.variant-inline .disc-chips {
    padding: 0 0 8px; background: transparent; border-bottom: none; gap: 5px;
}
.disc-root.variant-inline .disc-chips-label {
    font-size: 0.62rem; color: #94a3b8; margin-bottom: 4px;
}
.disc-root.variant-inline .disc-chip {
    padding: 2px 9px; font-size: 0.68rem; border-radius: 12px;
}
.disc-root.variant-inline .disc-count { font-size: 0.6rem; padding: 0 5px; }
.disc-root.variant-inline .disc-newtopic-input { padding: 2px 9px; font-size: 0.68rem; }
.disc-root.variant-inline .disc-list {
    max-height: 300px; overflow-y: auto; padding: 4px 0;
}
.disc-root.variant-inline .disc-input-wrap {
    padding: 0; border-top: none; margin-top: 10px; background: transparent;
}

/* === Chargement === */
.disc-loading { padding: 24px; text-align: center; color: #94a3b8; font-size: 0.8rem; }

/* Reaction: a discreet thumb among the message actions — outlined, filled once given; names in its tooltip. */
.disc-like {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    padding: 0; border: none; background: none; color: #94a3b8;
    font: inherit; font-size: 0.66rem; font-weight: 600; line-height: 1; cursor: pointer;
    transition: color 0.15s;
}
.disc-like:hover, .disc-like.is-active { color: #2563eb; }
.disc-like.is-active { font-weight: 800; }
.disc-like:disabled { cursor: wait; opacity: 0.6; }
.disc-like:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; border-radius: 4px; }
.disc-item.own .disc-like { color: rgba(255,255,255,0.75); }
.disc-item.own .disc-like:hover, .disc-item.own .disc-like.is-active { color: #fff; }
.disc-item.own .disc-like:focus-visible { outline-color: #fff; }
.disc-like-names { display: none; margin-top: 4px; font-size: 0.66rem; color: #94a3b8; }
.disc-item.own .disc-like-names { color: rgba(255,255,255,0.75); }
.disc-reaction-error { margin: 0; padding: 8px 16px; color: #b91c1c; font-size: 0.78rem; }
/* Touch: no hover tooltip, so names show under the message; the hit area grows without enlarging the bubble. */
@media (hover: none), (pointer: coarse) {
    .disc-actions { gap: 20px; }
    .disc-like::after, .disc-action-icon::after { content: ''; position: absolute; inset: -16px -10px; }
    .disc-like-names { display: block; }
}
