/* ============================================================
   MESSAGES GROUPÉS : rédaction en trois étapes, aperçu WhatsApp, historique.
============================================================ */
.broadcast-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.broadcast-form { display: grid; }
.broadcast-step { display: grid; gap: var(--space-4); padding: var(--space-5); border-top: 1px solid var(--border-soft); }
.broadcast-step:first-child { border-top: 0; }
.step-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.step-head h2 { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.01em; }
.step-head p { color: var(--text-3); font-size: var(--text-sm); margin-top: 1px; }
.step-number { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); font-size: var(--text-xs); font-weight: 700; margin-top: 1px; }
.broadcast-step > :not(.step-head) { margin-left: 38px; }
.bc-window { max-width: 260px; }
.broadcast-preview { font-size: var(--text-sm); line-height: 1.55; }
.broadcast-preview:not(.alert) { color: var(--text-3); }
.broadcast-step .form-actions { justify-content: flex-start; }

.broadcast-side { display: grid; gap: var(--space-5); position: sticky; top: calc(var(--topbar-height) + var(--space-5)); }
.phone-preview { overflow: hidden; }
.phone-preview-head { display: flex; align-items: center; gap: 10px; padding: 10px var(--space-4); background: #075e54; color: #fff; }
.phone-preview-head div { display: grid; line-height: 1.3; min-width: 0; }
.phone-preview-head strong { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-preview-head small { font-size: var(--text-2xs); opacity: 0.8; }
.phone-preview-head .avatar { background: rgba(255, 255, 255, 0.2); color: #fff; }
.phone-preview-body { padding: var(--space-4); min-height: 190px; background: #efe7dd; display: flex; align-items: flex-start; }
:root[data-theme="dark"] .phone-preview-body { background: #0b141a; }
.phone-bubble { max-width: 92%; display: grid; gap: 6px; padding: 8px 10px 6px; border-radius: 4px 12px 12px 12px; background: #fff; color: #111b21; font-size: var(--text-sm); line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); }
:root[data-theme="dark"] .phone-bubble { background: #202c33; color: #e9edef; }
.phone-bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.phone-bubble-text.is-placeholder { color: #8696a0; font-style: italic; }
.phone-bubble-stop { color: #667781; font-size: var(--text-xs); }
.phone-bubble time { justify-self: end; color: #667781; font-size: 0.625rem; }
.broadcast-safety .card-title { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-3); }
.broadcast-safety .card-title .icon { color: var(--success); }
.broadcast-safety ul { display: grid; gap: 8px; }
.broadcast-safety li { position: relative; padding-left: 16px; color: var(--text-2); font-size: var(--text-sm); line-height: 1.5; }
.broadcast-safety li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 5px; height: 5px; border-radius: 50%; background: var(--success-solid); }

.broadcast-history { display: grid; gap: var(--space-4); }
.bc-list { display: grid; gap: var(--space-3); }
.bc-item { display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.bc-item-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.bc-item-head small { color: var(--text-3); font-size: var(--text-xs); }
.bc-item-head .btn { margin-left: auto; }
.bc-item-head .badge i { animation: pulse 1.6s var(--ease) infinite; }
.bc-text { color: var(--text); font-size: var(--text-base); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bc-item-foot { display: flex; align-items: center; gap: var(--space-4); }
.bc-item-foot .progress { flex: 1 1 auto; }
.bc-item-foot small { flex: none; color: var(--text-3); font-size: var(--text-xs); }

@media (max-width: 1023px) {
  .broadcast-layout { grid-template-columns: minmax(0, 1fr); }
  .broadcast-side { position: static; }
}
@media (max-width: 767px) {
  .broadcast-step { padding: var(--space-4); }
  .broadcast-step > :not(.step-head) { margin-left: 0; }
  .broadcast-step .form-actions .btn { width: 100%; }
  .bc-item { padding: var(--space-4); }
  .bc-item-foot { flex-direction: column; align-items: stretch; gap: 6px; }
}

/* Quatre publics : deux par ligne (jamais trois et un), quatre de front sur un très grand écran. */
.broadcast-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1536px) { .broadcast-stages { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
