/* ============================================================================
   Chantier « MP = messagerie par défaut » (2026-09-03)
   Styles des nouvelles surfaces MP : stickers, traduction, transcription,
   transfert, programmés, éphémères, actions de conversation, rail de statuts,
   recherche globale, compteur data, invitation.
   Chargé sur chat.html + communaute.html. Thème-aware (variables existantes).
   ============================================================================ */

/* ── Stickers ── */
.msg-sticker { width: 128px; height: 128px; max-width: 40vw; object-fit: contain; display: block; }
.msg.msg-has-sticker { background: transparent !important; box-shadow: none !important; padding: 2px !important; }
.msg.msg-has-sticker .msg-time { color: var(--text-muted, #8a8a99); }
#sticker-panel { max-height: 46vh; overflow-y: auto; padding: 8px 10px; }
.sticker-group-title { font-size: 11px; font-weight: 700; color: var(--text-muted, #8a8a99); margin: 6px 2px 4px; text-transform: uppercase; letter-spacing: .04em; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.sticker-cell { border: none; background: rgba(127,127,127,.08); border-radius: 12px; padding: 4px; cursor: pointer; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.sticker-cell:active { transform: scale(.94); }
.sticker-cell img { width: 100%; height: 100%; object-fit: contain; }
.sticker-loading, .sticker-empty { text-align: center; color: var(--text-muted, #8a8a99); font-size: 13px; padding: 22px; }

/* ── Traduction sous une bulle ── */
.msg-translation {
  margin-top: 5px; padding: 6px 9px; border-radius: 10px;
  background: rgba(103, 80, 164, .10); border-left: 3px solid #6750A4;
  font-size: 13px; line-height: 1.4; color: var(--text, #1c1b1f);
}
.msg-translation > i { color: #6750A4; margin-right: 4px; }
.msg-tr-toggle {
  display: inline-block; margin-left: 6px; background: none; border: none;
  color: #6750A4; font-size: 11px; text-decoration: underline; cursor: pointer; padding: 0;
}
.msg.mine .msg-translation { background: rgba(255,255,255,.16); border-left-color: rgba(255,255,255,.6); color: #fff; }
.msg.mine .msg-translation > i, .msg.mine .msg-tr-toggle { color: #fff; }

/* ── Transcription vocale ── */
.msg-transcript {
  margin-top: 5px; padding: 6px 9px; border-radius: 10px;
  background: rgba(16, 185, 129, .12); border-left: 3px solid #10B981;
  font-size: 13px; line-height: 1.4; color: var(--text, #1c1b1f);
}
.msg-transcript > i { color: #10B981; margin-right: 4px; }
.msg.mine .msg-transcript { background: rgba(255,255,255,.16); border-left-color: rgba(255,255,255,.6); color: #fff; }
.msg.mine .msg-transcript > i { color: #fff; }

/* Boutons ajoutés au picker de réactions */
.msg-rx-translate i { color: #6750A4; }
.msg-rx-forward i { color: #3B82F6; }
.msg-rx-transcribe i { color: #10B981; }

/* ── Modal de transfert ── */
.fwd-overlay, .conv-actions-overlay {
  position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.fwd-card, .conv-actions-sheet {
  width: 100%; max-width: 480px; background: var(--surface, #fff); color: var(--text, #1c1b1f);
  border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.25); animation: mpSheetUp .18s ease;
}
@keyframes mpSheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.fwd-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.fwd-close { background: none; border: none; font-size: 18px; color: var(--text-muted, #8a8a99); cursor: pointer; }
.fwd-hint { font-size: 12px; color: var(--text-muted, #8a8a99); margin-bottom: 10px; }
.fwd-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 46vh; overflow-y: auto; }
.fwd-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 10px; border-radius: 10px; cursor: pointer; }
.fwd-item:active { background: rgba(127,127,127,.10); }
.fwd-item.sel { background: rgba(103,80,164,.12); }
.fwd-check { opacity: 0; color: #6750A4; }
.fwd-item.sel .fwd-check { opacity: 1; }
.fwd-loading, .fwd-empty { text-align: center; color: var(--text-muted, #8a8a99); padding: 20px; }
.fwd-send { width: 100%; }

/* ── Bandeau messages programmés ── */
.sched-banner {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 8px 14px; background: rgba(245,176,39,.15); color: var(--text, #1c1b1f);
  border-bottom: 1px solid rgba(245,176,39,.35);
}
.sched-banner > i { color: #F5B027; }
.sched-banner-view { margin-left: auto; background: none; border: 1px solid #F5B027; color: #b8860b; border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; }

/* ── Badge éphémères dans le menu de conv ── */
.conv-menu-badge { margin-left: auto; font-size: 11px; color: #6750A4; font-weight: 600; }

/* ── Actions de conversation dans la liste ── */
.conv-item-wrap { position: relative; }
.conv-item-wrap > .conv-item { padding-right: 40px; }
.conv-item-actions {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted, #8a8a99);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center; opacity: .55;
}
.conv-item-actions:active { background: rgba(127,127,127,.14); opacity: 1; }
.conv-ind-pin { color: #6750A4; font-size: 11px; margin-left: 3px; }
.conv-ind-mute { color: var(--text-muted, #8a8a99); font-size: 11px; margin-left: 3px; }
.conv-item-wrap.conv-pinned { background: rgba(103,80,164,.05); }
.conv-actions-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.conv-actions-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; padding: 13px 8px; font-size: 15px; color: var(--text, #1c1b1f);
  cursor: pointer; border-radius: 10px;
}
.conv-actions-item:active { background: rgba(127,127,127,.10); }
.conv-actions-item > i { width: 22px; text-align: center; color: #6750A4; }
.conv-actions-cancel { justify-content: center; color: var(--text-muted, #8a8a99); margin-top: 4px; }
.conv-actions-cancel > i { display: none; }

/* ── Outils en tête de l'onglet MP ── */
.mp-tools { padding: 8px 12px 4px; }
.mp-search-row { position: relative; display: flex; align-items: center; }
.mp-search-ico { position: absolute; left: 12px; color: var(--text-muted, #8a8a99); font-size: 13px; pointer-events: none; }
#mp-global-search {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 22px; font-size: 14px;
  border: 1px solid var(--border, #e0e0e6); background: var(--surface-2, #f4f4f6); color: var(--text, #1c1b1f);
}
.mp-search-results { list-style: none; margin: 6px 0 0; padding: 0; }
.mp-search-item { padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.mp-search-item:active { background: rgba(127,127,127,.10); }
.mp-search-snippet mark { background: #F5B027; color: #000; border-radius: 3px; padding: 0 2px; }
.mp-search-loading, .mp-search-empty { padding: 12px; text-align: center; color: var(--text-muted, #8a8a99); font-size: 13px; list-style: none; }
.mp-tools-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.mp-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 12px;
  border-radius: 16px; border: 1px solid var(--border, #e0e0e6); background: var(--surface-2, #f4f4f6);
  color: var(--text, #1c1b1f); cursor: pointer;
}
.mp-chip.active { background: #6750A4; color: #fff; border-color: #6750A4; }
.mp-datasaved { margin-left: auto; font-size: 11px; color: #10B981; font-weight: 600; }
.mp-datasaved > i { margin-right: 3px; }

/* ── Rail de statuts (stories) en tête de l'onglet MP ── */
.mp-stories-rail {
  display: flex; gap: 12px; overflow-x: auto; padding: 12px 12px 6px; -webkit-overflow-scrolling: touch;
}
.mp-stories-rail::-webkit-scrollbar { display: none; }
.mp-story-add, .mp-story-cell {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; width: 62px;
}
.mp-story-ring, .mp-story-add-ring {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #6750A4; box-sizing: border-box;
}
.mp-story-cell.seen .mp-story-ring { border-color: var(--border, #cfcfd6); }
.mp-story-add-ring { border-style: dashed; color: #6750A4; font-size: 18px; }
.mp-story-ring img { width: 100%; height: 100%; object-fit: cover; }
.mp-story-ini { font-size: 20px; font-weight: 700; color: #6750A4; }
.mp-story-lbl { font-size: 11px; color: var(--text, #1c1b1f); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Feuille d'invitation ── */
.invite-sheet { text-align: center; }
.invite-qr { margin: 6px auto 10px; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.invite-qr img { width: 180px; height: 180px; image-rendering: pixelated; }
.invite-link { font-size: 12px; word-break: break-all; color: var(--text-muted, #8a8a99); margin-bottom: 12px; padding: 0 8px; }

@media (prefers-color-scheme: dark) {
  .fwd-card, .conv-actions-sheet { background: #1f1f27; }
  #mp-global-search, .mp-chip { background: #26262e; border-color: #33333c; }
}
