/* ============================================================
   MESSAGERIE — VUE DISCUSSION (chat)
   À fusionner dans styles_mess.css
   ============================================================ */

/* ── Wrapper principal ─────────────────────────────────────── */
.chat-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 110px); /* 110px = hauteur header msg-header */
    min-height: 400px;
    background: #f0f2f5;
}

/* ── Header discussion ─────────────────────────────────────── */
.chat-header {
    background: #006D92;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.chat-back {
    color: #ffffff;
    font-size: 18px;
    padding: 0 8px 0 0;
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.chat-back:hover { color: rgba(255,255,255,0.75); }

.chat-back,
.chat-back:link,
.chat-back:visited,
.chat-back:hover,
.chat-back:active {
    color: #ffffff;
}
.chat-back:hover { opacity: 0.75; }

.chat-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
    font-family: Geneva, Arial, Helvetica, sans-serif;
}
.chat-info { flex: 1; min-width: 0; }
.chat-names {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-online {
    font-size: 11px;
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}
.chat-online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4cdb8a;
    flex-shrink: 0;
}
.chat-online-dot.offline { background: rgba(255,255,255,0.35); }

.chat-act-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 7px;
    color: #fff;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}
.chat-act-btn:hover { background: rgba(255,255,255,0.28); color: #fff; }

/* ── Barre participants ─────────────────────────────────────── */
.chat-parts {
    background: #005578;
    padding: 5px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.part-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 3px 9px 3px 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.85);
}
.part-chip-av {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
}
.part-chip.nl { background: rgba(255,191,0,0.25); }
.part-chip.nl .part-chip-av { outline: 1px solid #ffc926; }

.part-add {
    background: transparent;
    border: 1px dashed rgba(255,255,255,0.4);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
}
.part-add,
.part-add:link,
.part-add:visited,
.part-add:hover,
.part-add:active {
    color: rgba(255,255,255,0.7);
}
.part-add:hover { color: #fff; }

/* ── Zone messages ──────────────────────────────────────────── */
.chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f0f2f5;
    scroll-behavior: smooth;
}

/* Séparateur de date */
.date-sep {
    text-align: center;
    margin: 6px 0 2px;
}
.date-sep span {
    font-size: 11px;
    color: #888;
    background: #e4e6eb;
    padding: 2px 12px;
    border-radius: 20px;
    border: 1px solid #d8dadf;
}

/* Rangée de message */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    max-width: 80%;
}
.msg-row.me  { align-self: flex-end;   flex-direction: row-reverse; }
.msg-row.them{ align-self: flex-start; }
.msg-row.adm { align-self: center; max-width: 88%; width: 100%; }

/* Avatar mini */
.msg-av-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    font-family: Geneva, Arial, Helvetica, sans-serif;
}

/* Enveloppe bulle + méta */
.msg-bwrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg-sender {
    font-size: 11px;
    color: #666;
    padding: 0 10px;
    margin-bottom: 1px;
}
.msg-row.me .msg-sender { text-align: right; }

/* Bulle principale */
.msg-bubble {
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    color: #000;
    background: #fff;
    border: 1px solid #e0e0e0;
}
.msg-row.me .msg-bubble {
    background: #006D92;
    color: #fff;
    border-color: transparent;
    border-bottom-right-radius: 4px;
}
.msg-row.them .msg-bubble {
    border-bottom-left-radius: 4px;
}
/* Message non-lu */
.msg-bubble.new {
    background: #fffde7;
    border-color: #f0c040;
    color: #333;
}

/* Message organisateurs */
.msg-adm-wrap {
    background: #fff8e1;
    border: 1px solid #f0ad00;
    border-radius: 12px;
    padding: 8px 14px;
    width: 100%;
}
.msg-adm-label {
    font-size: 10px;
    font-weight: 700;
    color: #b07700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.msg-adm-body { font-size: 13px; color: #5a3e00; line-height: 1.5; }

/* Méta (heure, vus, coches) */
.msg-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #999;
    padding: 0 4px;
}
.msg-row.me .msg-meta { justify-content: flex-end; }

.check-sent  { color: #bbb; }
.check-read  { color: #006D92; }
.check-unread{ color: #bbb; }

.msg-vu-link { color: #999; text-decoration: none; cursor: pointer; }
.msg-vu-link:hover { color: #555; text-decoration: underline; }

.msg-del-link { color: #ccc; text-decoration: none; cursor: pointer; }
.msg-del-link:hover { color: #e00; }

/* Pièce jointe image */
.msg-img-thumb {
    max-width: 200px;
    max-height: 160px;
    border-radius: 10px;
    margin-top: 5px;
    cursor: pointer;
    border: 1px solid #ddd;
    display: block;
}
.msg-doc-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 12px;
    color: #ffc926;          /* jaune/doré kayakdemer */
    background: rgba(255,255,255,0.15);
    padding: 4px 9px;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid rgba(255,201,38,0.4);
}
.msg-doc-link:hover   { background: rgba(255,201,38,0.25); color: #ffd84d; }
.msg-doc-link:visited { color: #ffc926; }
.msg-row.them  { color: #006D92; background: #e8f4fb; }

/* ── Zone saisie ───────────────────────────────────────────── */
.chat-input-area {
    padding: 8px 12px 10px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* Bande émojis (q_rep) */
.chat-emot-strip {
    display: none;
    gap: 6px;
    padding: 4px 2px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.chat-emot-strip.open { display: flex; }
.chat-emot {
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    padding: 3px 6px;
    border: 1px solid transparent;
    line-height: 1;
}
.chat-emot:hover { border-color: #ddd; background: #f5f5f5; }

/* Toggle message organisateurs */
.adm-toggle {
    display: none; /* affiché via PHP si organisateur + disc=1755 */
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #7a5000;
    background: #fff8e6;
    border-radius: 7px;
    padding: 4px 10px;
    margin-bottom: 6px;
    cursor: pointer;
}
.adm-toggle.visible { display: flex; }
.adm-toggle input[type=checkbox] { cursor: pointer; }

/* Rang de saisie */
.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.chat-input-box {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    background: #f0f2f5;
    border: 1px solid #ddd;
    border-radius: 22px;
    padding: 6px 8px 6px 14px;
    transition: border-color 0.15s;
}
.chat-input-box:focus-within { border-color: #006D92; }

.chat-textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    font-size: 13.5px;
    font-family: Geneva, Arial, Helvetica, sans-serif;
    color: #000;
    max-height: 120px;
    line-height: 1.4;
    padding: 3px 0;
    min-height: 22px;
    overflow-y: auto;
}
.chat-textarea::placeholder { color: #aaa; }

.chat-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.chat-icon-btn:hover { background: #e8e8e8; color: #444; }

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #006D92;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover  { background: #005578; }
.chat-send-btn:active { transform: scale(0.93); }

.chat-send-btn,
.chat-send-btn:link,
.chat-send-btn:visited {
    color: #ffffff;
}
.chat-send-btn i,
.chat-send-btn span {
    color: #ffffff;
}

/* Input file caché */
.chat-file-input { display: none; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .chat-wrap { height: calc(100vh - 90px); }
    .msg-row   { max-width: 92%; }
    .msg-bubble { font-size: 15px; }
    .chat-names { font-size: 13px; }
    .chat-parts { gap: 4px; }
    .chat-emot  { font-size: 26px; padding: 5px 8px; }
    .chat-textarea { font-size: 16px; } /* évite le zoom iOS */
    .msg-av-sm  { width: 32px; height: 32px; font-size: 11px; }
}

/* ============================================================
   NOUVELLE DISCUSSION — à fusionner dans styles_mess_chat.css
   ============================================================ */

.nd-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    background: #f0f2f5;
}

/* ── Zone destinataires ────────────────────────────────────── */
.nd-dest-zone {
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom: 1px solid #e0e0e0;
}

/* Chips + search */
.nd-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 14px;
    border-bottom: 1px solid #f0f0f0;
    min-height: 44px;
}
.nd-chips-label {
    font-size: 13px;
    color: #999;
    flex-shrink: 0;
}
#nd-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.nd-chip {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #e3f0f9;
    border-radius: 20px;
    padding: 3px 8px 3px 10px;
    font-size: 12px;
    color: #006D92;
    font-weight: 500;
}
.nd-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: #006D92;
    font-size: 15px;
    line-height: 1;
    padding: 0 0 0 3px;
    opacity: 0.55;
}
.nd-chip button:hover { opacity: 1; }

.nd-search-input {
    border: none;
    outline: none;
    font-size: 13.5px;
    font-family: Geneva, Arial, Helvetica, sans-serif;
    color: #000;
    min-width: 120px;
    flex: 1;
    padding: 2px 0;
    background: transparent;
}
.nd-search-input::placeholder { color: #bbb; }

/* Toggle amis / tous */
.nd-toggle-bar {
    display: flex;
    gap: 4px;
    padding: 7px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}
.nd-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.nd-toggle-btn:hover  { background: #f0f8fc; color: #006D92; }
.nd-toggle-btn.active {
    background: #e3f0f9;
    border-color: #006D92;
    color: #006D92;
    font-weight: 500;
}
.nd-toggle-btn:visited { color: #666; }
.nd-toggle-btn.active:visited { color: #006D92; }

/* Liste membres */
.nd-members-list {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.nd-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-bottom: 0.5px solid #f5f5f5;
    cursor: default;
}
.nd-member-row:hover { background: #f9f9f9; }
.nd-member-row.selected { background: #e8f4fb; }

.nd-friend-icon { flex-shrink: 0; line-height: 0; }
.nd-friend-icon img { display: block; cursor: pointer; }
.nd-friend-icon:hover img { opacity: 0.75; }

.nd-member-name {
    flex: 1;
    font-size: 13.5px;
    color: #111;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nd-member-name:hover { color: #006D92; }

.nd-member-check {
    display: none;
    color: #006D92;
    font-size: 17px;
    flex-shrink: 0;
}
.nd-member-row.selected .nd-member-check { display: flex; }

/* ── Zone rédaction ────────────────────────────────────────── */
.nd-compose-zone {
    padding: 10px 12px 14px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .nd-wrap         { height: calc(100dvh - 60px); }
    .nd-member-name  { font-size: 15px; }
    .nd-search-input { font-size: 16px; }
    .nd-toggle-btn   { font-size: 13px; padding: 6px 14px; }
}