/* ============================================================================
   Chat live global « Le direct » — ProbWin WC26
   Palette site : obsidienne #0B0F14 / or #FBBF24 / DM Sans + Bebas Neue.
   Desktop ≥1200px : colonne droite fixe 360px (la page live est décalée via
   .live-page.pwchat-active). Mobile : FAB bas droite → overlay plein écran.
   ========================================================================== */

:root {
  --pwchat-bg: #0E141D;
  --pwchat-bg-soft: #131B26;
  --pwchat-border: rgba(255, 255, 255, 0.08);
  --pwchat-gold: #FBBF24;
  --pwchat-gold-deep: #F59E0B;
  --pwchat-text: #E6EAF2;
  --pwchat-muted: #94A3B8;
}

/* ── Panneau ─────────────────────────────────────────────────────── */
.pwchat-panel {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(600px 200px at 50% -60px, rgba(251, 191, 36, 0.05), transparent 70%),
    var(--pwchat-bg);
  border: 1px solid var(--pwchat-border);
  border-radius: 16px;
  color: var(--pwchat-text);
  font-family: 'DM Sans', 'Inter', sans-serif;
  overflow: hidden;
  z-index: 600;
}

/* Desktop : colonne droite sticky/fixed */
@media (min-width: 1200px) {
  .live-page.pwchat-active { padding-right: 396px; }
  .pwchat-panel {
    position: fixed;
    top: 84px;
    right: 16px;
    bottom: 16px;
    width: 360px;
  }
  /* button.* : spécificité > règle de base .pwchat-fab (déclarée plus bas) */
  button.pwchat-fab { display: none; }
  button.pwchat-close { display: none; }
}

/* Mobile / tablette : caché par défaut, overlay plein écran si .is-open */
@media (max-width: 1199px) {
  .pwchat-panel { display: none; }
  .pwchat-panel.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    border-radius: 0;
    border: none;
    z-index: 10050;
  }
  body.pwchat-locked { overflow: hidden; }
}

/* ── FAB mobile ──────────────────────────────────────────────────── */
.pwchat-fab {
  position: fixed;
  right: 14px;
  bottom: 86px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, #1A2230, #10161F);
  color: var(--pwchat-gold);
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.pwchat-fab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pwchat-gold);
  color: #0B0F14;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

/* ── Header ──────────────────────────────────────────────────────── */
.pwchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--pwchat-border);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}
.pwchat-title-wrap { display: flex; align-items: center; gap: 10px; }
.pwchat-title {
  margin: 0;
  font-family: 'Bebas Neue', 'Oswald', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #FFFFFF;
  line-height: 1;
}
.pwchat-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--pwchat-gold);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(251, 191, 36, 0.08);
}
.pwchat-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pwchat-gold);
  animation: pwchat-pulse 1.6s ease-in-out infinite;
}
@keyframes pwchat-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); }
  50% { opacity: 0.6; transform: scale(0.85); box-shadow: 0 0 0 5px rgba(251, 191, 36, 0); }
}
.pwchat-header-right { display: flex; align-items: center; gap: 8px; }
.pwchat-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--pwchat-muted);
  white-space: nowrap;
}
.pwchat-slowmode-btn,
.pwchat-close {
  background: none;
  border: 1px solid var(--pwchat-border);
  border-radius: 8px;
  color: var(--pwchat-muted);
  font-size: 0.85rem;
  padding: 4px 8px;
  cursor: pointer;
}
.pwchat-slowmode-btn.is-on {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
}
.pwchat-slowmode-banner {
  padding: 6px 14px;
  font-size: 0.72rem;
  color: var(--pwchat-gold);
  background: rgba(251, 191, 36, 0.08);
  border-bottom: 1px solid rgba(251, 191, 36, 0.18);
  flex-shrink: 0;
}

/* ── Fil ─────────────────────────────────────────────────────────── */
.pwchat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.pwchat-loading {
  color: var(--pwchat-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 24px 0;
}

.pwchat-msg { position: relative; }

/* Message user */
.pwchat-user { display: flex; gap: 9px; align-items: flex-start; }
.pwchat-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #F2F5FA;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.pwchat-msg-main { flex: 1; min-width: 0; }
.pwchat-msg-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}
.pwchat-pseudo {
  font-size: 0.8rem;
  font-weight: 700;
  color: #D7DEE9;
  overflow-wrap: anywhere;
}
.pwchat-badge-pro {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #0B0F14;
  background: linear-gradient(135deg, var(--pwchat-gold), var(--pwchat-gold-deep));
  border-radius: 4px;
  padding: 1.5px 5px;
  line-height: 1.3;
}
.pwchat-time { font-size: 0.66rem; color: #76849A; }
.pwchat-body {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--pwchat-text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Réactions */
.pwchat-reactions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.pwchat-react-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--pwchat-border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.74rem;
  color: var(--pwchat-text);
  cursor: pointer;
}
.pwchat-react-chip.is-mine {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.12);
}
.pwchat-react-n { font-size: 0.66rem; color: var(--pwchat-muted); font-weight: 700; }
.pwchat-react-add {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: none;
  border-radius: 999px;
  width: 22px;
  height: 20px;
  font-size: 0.78rem;
  line-height: 1;
  color: var(--pwchat-muted);
  cursor: pointer;
}
.pwchat-picker {
  position: absolute;
  bottom: 24px;
  left: 0;
  display: flex;
  gap: 2px;
  background: #1A2230;
  border: 1px solid var(--pwchat-border);
  border-radius: 10px;
  padding: 4px 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  z-index: 5;
}
.pwchat-picker-btn {
  background: none;
  border: none;
  font-size: 1.05rem;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 6px;
}
.pwchat-picker-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* Bouton delete staff */
.pwchat-del {
  background: none;
  border: none;
  color: #76849A; /* ≥3:1 composant UI sur #0E141D */
  font-size: 0.66rem;
  cursor: pointer;
  padding: 0 4px;
}
.pwchat-del:hover { color: #F87171; }
/* Messages système : le ✕ staff se place dans le coin (sinon il retombe
   seul sous les réactions). .pwchat-msg est position:relative. */
.pwchat-sys .pwchat-del {
  position: absolute;
  top: 7px;
  right: 8px;
}
.pwchat-sys-sep .pwchat-del { top: -2px; right: 0; }

/* ── Messages système ────────────────────────────────────────────── */
.pwchat-sys { font-size: 0.8rem; }
.pwchat-sys-badge {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--pwchat-gold);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

/* But : carte or, score en gras */
.pwchat-sys-goal .pwchat-goal-card {
  display: block;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 12px;
  padding: 10px 26px 10px 12px; /* droite : réserve le coin pour le ✕ staff */
}
.pwchat-goal-body {
  font-weight: 800;
  font-size: 0.88rem;
  color: #FFE9B3;
  letter-spacing: 0.2px;
}

/* Carton : liseré jaune */
.pwchat-sys-card {
  border-left: 3px solid #FACC15;
  background: rgba(250, 204, 21, 0.06);
  border-radius: 0 10px 10px 0;
  padding: 7px 10px;
  color: #E8DFC0;
}

/* Kickoff / mi-temps / fin : séparateurs centrés */
.pwchat-sys-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--pwchat-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
}
.pwchat-sys-sep::before,
.pwchat-sys-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}
.pwchat-sys-fulltime .pwchat-sep-label,
.pwchat-sys-kickoff .pwchat-sep-label { color: #C9D2DF; }

/* Info (programme du soir) : encadré discret */
.pwchat-sys-info {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 9px 26px 9px 11px; /* droite : réserve le coin pour le ✕ staff */
  color: #B9C3D4;
  background: rgba(255, 255, 255, 0.02);
  line-height: 1.5;
}

/* ── Bouton « nouveaux messages » ────────────────────────────────── */
.pwchat-jump {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 118px;
  background: var(--pwchat-gold);
  color: #0B0F14;
  border: none;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 4;
}
.pwchat-panel { position: relative; } /* ancre du bouton jump en mobile overlay */
@media (min-width: 1200px) { .pwchat-panel { position: fixed; } }

/* ── Footer / saisie ─────────────────────────────────────────────── */
.pwchat-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--pwchat-border);
  background: var(--pwchat-bg-soft);
  padding: 9px 12px 11px;
}
.pwchat-error {
  font-size: 0.74rem;
  color: #FCA5A5;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  padding: 6px 9px;
  margin-bottom: 7px;
}
.pwchat-quick-emojis {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 7px;
}
.pwchat-quick-emojis button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--pwchat-border);
  border-radius: 8px;
  font-size: 0.92rem;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.4;
}
.pwchat-quick-emojis button:hover { border-color: rgba(251, 191, 36, 0.4); }
.pwchat-charcount {
  margin-left: auto;
  font-size: 0.66rem;
  color: #76849A;
}
.pwchat-input-row { display: flex; gap: 7px; }
.pwchat-input {
  flex: 1;
  min-width: 0;
  background: #0B1018;
  border: 1px solid var(--pwchat-border);
  border-radius: 10px;
  color: var(--pwchat-text);
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-size: 0.86rem;
  padding: 9px 12px;
}
.pwchat-input::placeholder { color: #8493AB; } /* ≥4.5:1 sur #0B1018 */
.pwchat-input:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}
.pwchat-send {
  flex-shrink: 0;
  width: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--pwchat-gold), var(--pwchat-gold-deep));
  color: #0B0F14;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pwchat-send:disabled { opacity: 0.5; cursor: default; }

/* CTA anonyme */
.pwchat-login-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--pwchat-muted);
}
.pwchat-login-btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--pwchat-gold), var(--pwchat-gold-deep));
  color: #0B0F14;
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 7px 16px;
  text-decoration: none;
}

/* ── Divers ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pwchat-live-dot { animation: none; }
}

/* ── Animations événements de match (ajout 13/06) ──────────────────────────
   Jouées à l'insertion du nœud par le polling → un but qui tombe en direct
   glisse dans le fil avec un double pulse d'or ; un carton « s'allume ».   */
.pwchat-sys-goal .pwchat-goal-card {
  animation:
    pwchat-event-in 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    pwchat-goal-glow 1.1s ease-out 2;
}
@keyframes pwchat-event-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pwchat-goal-glow {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.55); }
  70%  { box-shadow: 0 0 18px 6px rgba(251, 191, 36, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}
.pwchat-sys-card {
  animation: pwchat-event-in 0.4s cubic-bezier(0.22, 1, 0.36, 1), pwchat-card-flash 1.2s ease-out 1;
}
@keyframes pwchat-card-flash {
  0%   { background: rgba(250, 204, 21, 0.28); }
  100% { background: rgba(250, 204, 21, 0.06); }
}
.pwchat-sys-fulltime, .pwchat-sys-kickoff, .pwchat-sys-halftime {
  animation: pwchat-event-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .pwchat-sys-goal .pwchat-goal-card,
  .pwchat-sys-card,
  .pwchat-sys-fulltime, .pwchat-sys-kickoff, .pwchat-sys-halftime { animation: none; }
}

/* Badge équipe (comptes staff) : couleurs maison, distinct du badge PRO abonné */
.pwchat-badge-staff {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #0B0F14;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}
