*{ box-sizing:border-box; }

html, body{
  margin:0;
  background:#0a0a0f;
  color:#fff;
  font-family:Inter, sans-serif;
  -webkit-font-smoothing:antialiased;
}

.hidden{ display:none !important; }

.boot-spin{
  width:30px; height:30px;
  border:3px solid rgba(255,255,255,0.14);
  border-top-color:#7c3aed;
  border-radius:50%;
  animation:cx-spin .8s linear infinite;
}
@keyframes cx-spin{ to{ transform:rotate(360deg); } }

.contact-wrap{
  max-width:760px;
  margin:0 auto;
  padding:calc(80px + var(--cx-announce-h, 38px) + 28px) 16px 28px;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.contact-card{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-height:0;
  height:calc(100vh - 80px - var(--cx-announce-h, 38px) - 56px);
  background:linear-gradient(180deg, rgba(124,58,237,0.05), rgba(255,255,255,0.02));
  border:1px solid rgba(255,255,255,0.08);
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 24px 60px rgba(0,0,0,0.45);
}

/* ===== En-tête ===== */
.chat-head{
  display:flex;
  align-items:center;
  gap:14px;
  padding:18px 22px;
  border-bottom:1px solid rgba(255,255,255,0.07);
  background:rgba(124,58,237,0.10);
  backdrop-filter:blur(8px);
}
.chat-head-avatar{
  width:46px; height:46px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%;
  background:linear-gradient(45deg, #7c3aed, #a78bfa);
  color:#fff; flex:0 0 46px;
  box-shadow:0 6px 18px rgba(124,58,237,0.4);
}
.chat-head-text{ flex:1 1 auto; min-width:0; }
.chat-head-text h1{ margin:0; font-size:1.08rem; font-weight:800; letter-spacing:-.01em; }
.chat-head-text p{ margin:3px 0 0; font-size:.82rem; color:rgba(255,255,255,0.55); }

.chat-head-actions{ display:flex; gap:8px; flex:0 0 auto; }
.chat-act{
  padding:7px 13px; font-size:.8rem; font-weight:600; cursor:pointer;
  color:rgba(255,255,255,0.8); background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12); border-radius:9px;
  transition:background .16s, border-color .16s, color .16s;
}
.chat-act:hover{ background:rgba(255,255,255,0.12); color:#fff; }
.chat-act:disabled{ opacity:.5; cursor:default; }
.chat-act-danger{ color:#fca5a5; background:rgba(248,113,113,0.10); border-color:rgba(248,113,113,0.28); }
.chat-act-danger:hover{ background:rgba(248,113,113,0.2); color:#fff; }
@media (max-width:560px){
  .chat-head{ flex-wrap:wrap; }
  .chat-head-actions{ width:100%; justify-content:flex-end; }
}

/* ===== Chargement ===== */
.chat-loading{
  flex:1 1 auto;
  display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,0.5); font-size:.9rem;
}

/* ===== Création ===== */
.contact-create{
  flex:1 1 auto;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  text-align:center;
  padding:30px 26px;
  gap:6px;
}
.create-illus{
  width:84px; height:84px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%;
  margin-bottom:8px;
  color:#a78bfa;
  background:rgba(124,58,237,0.12);
  border:1px solid rgba(124,58,237,0.25);
}
.contact-create h2{ margin:0; font-size:1.3rem; font-weight:800; }
.contact-create p{
  margin:0 0 14px;
  max-width:420px;
  color:rgba(255,255,255,0.6);
  font-size:.92rem; line-height:1.5;
}
.create-form{
  display:flex; gap:10px;
  width:100%; max-width:480px;
  flex-wrap:wrap;
  justify-content:center;
}
.create-form input{
  flex:1 1 240px;
  min-width:0;
  padding:14px 16px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.05);
  color:#fff; font-family:inherit; font-size:.95rem;
  outline:none;
}
.create-form input:focus{ border-color:rgba(124,58,237,0.6); background:rgba(255,255,255,0.07); }
.create-form button{
  flex:0 0 auto;
  padding:14px 22px;
  border:none; border-radius:14px;
  background:#7c3aed; color:#fff;
  font-weight:700; font-size:.92rem; cursor:pointer;
  transition:background .2s ease, transform .2s ease;
}
.create-form button:hover{ background:#8b5cf6; transform:translateY(-1px); }
.create-form button:disabled{ opacity:.55; cursor:default; transform:none; }

/* ===== Chat ===== */
.chat-pane{ display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }

.chat-body{
  flex:1 1 auto; min-height:0; overflow-y:auto;
  padding:20px;
  display:flex; flex-direction:column; gap:12px;
  scrollbar-width:thin;
}

.msg{ display:flex; max-width:78%; animation:msg-in .18s ease; }
@keyframes msg-in{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:none; } }
.msg-user{ align-self:flex-end; }
.msg-staff{ align-self:flex-start; }
.msg-system{ align-self:center; max-width:92%; }

.bubble{
  padding:10px 14px; border-radius:16px;
  font-size:.92rem; line-height:1.45;
  word-break:break-word;
  display:flex; flex-direction:column; gap:4px;
}
.msg-user .bubble{ background:#7c3aed; color:#fff; border-bottom-right-radius:5px; }
.msg-staff .bubble{ background:rgba(255,255,255,0.07); border:1px solid rgba(255,255,255,0.08); border-bottom-left-radius:5px; }
/* Message « ultra important » (paiement entre proches PayPal). */
.msg-alert{ max-width:92%; }
.msg-alert .bubble{
  background:rgba(239,68,68,0.12);
  border:1.5px solid rgba(239,68,68,0.55);
  color:#fff;
  box-shadow:0 0 0 1px rgba(239,68,68,0.18), 0 6px 18px rgba(239,68,68,0.12);
  animation:alert-pulse 1.8s ease-in-out 2;
}
.msg-alert .sender{ color:#f87171; }
.msg-alert .text{ font-weight:600; }
@keyframes alert-pulse{
  0%,100%{ box-shadow:0 0 0 1px rgba(239,68,68,0.18), 0 6px 18px rgba(239,68,68,0.12); }
  50%{ box-shadow:0 0 0 2px rgba(239,68,68,0.55), 0 6px 22px rgba(239,68,68,0.30); }
}
.msg-system .bubble{
  background:rgba(52,211,153,0.10);
  border:1px solid rgba(52,211,153,0.22);
  color:rgba(255,255,255,0.85);
  border-radius:14px; font-size:.88rem; text-align:center;
}
.bubble .sender{ font-size:.74rem; font-weight:700; color:#34d399; }
.bubble .time{ font-size:.68rem; opacity:.6; align-self:flex-end; }

.chat-input{
  display:flex; align-items:flex-end; gap:10px;
  padding:14px 16px;
  border-top:1px solid rgba(255,255,255,0.07);
  background:rgba(0,0,0,0.22);
}
.chat-input textarea{
  flex:1 1 auto; resize:none; max-height:140px;
  padding:12px 14px; border-radius:14px;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.05);
  color:#fff; font-family:inherit; font-size:.92rem; line-height:1.4;
  outline:none;
}
.chat-input textarea:focus{ border-color:rgba(124,58,237,0.6); background:rgba(255,255,255,0.07); }
.chat-input button{
  flex:0 0 46px; width:46px; height:46px;
  border:none; border-radius:14px;
  background:#7c3aed; color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .2s ease, transform .2s ease;
}
.chat-input button:hover{ background:#8b5cf6; transform:translateY(-1px); }
.chat-input button:disabled{ opacity:.5; cursor:default; transform:none; }

/* ===== Non connecté ===== */
.contact-gate{
  flex:1 1 auto;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  text-align:center; padding:40px 20px;
}
.contact-gate p{ color:rgba(255,255,255,0.7); margin-bottom:18px; }
.contact-gate-btn{
  display:inline-block; padding:12px 24px;
  border-radius:12px; background:#7c3aed; color:#fff;
  font-weight:600; text-decoration:none;
}
.contact-gate-btn:hover{ background:#8b5cf6; }

/* ===== Onglets de canal (Support / Abonnement) ===== */
.cx-channel-tabs{
  display:flex; gap:4px;
  padding:8px 12px 0;
  background:rgba(124,58,237,0.08);
  border-bottom:1px solid rgba(255,255,255,0.07);
  flex:0 0 auto;
}
.cx-channel-tab{
  position:relative;
  padding:11px 18px;
  background:transparent; border:none;
  border-bottom:2px solid transparent;
  border-radius:10px 10px 0 0;
  color:rgba(255,255,255,0.55);
  font-family:inherit; font-size:.9rem; font-weight:700; cursor:pointer;
  transition:color .16s ease, border-color .16s ease, background .16s ease;
}
.cx-channel-tab:hover{ color:#fff; background:rgba(255,255,255,0.04); }
.cx-channel-tab.active{ color:#fff; border-bottom-color:#7c3aed; }
.cx-abo-dot{
  position:absolute; top:6px; right:8px;
  width:8px; height:8px; border-radius:50%;
  background:#34d399; box-shadow:0 0 0 2px #0a0a0f;
}

/* Chaque canal occupe toute la hauteur restante de la carte. */
#channel-support, #channel-abonnement{
  display:flex; flex-direction:column;
  flex:1 1 auto; min-height:0;
}

/* ===== Accusé de lecture « Vu · il y a X » ===== */
.msg{ flex-wrap:wrap; }
.msg-read-receipt{
  flex-basis:100%;
  text-align:right;
  margin-top:3px;
  padding-right:2px;
  font-size:.68rem;
  color:rgba(255,255,255,0.5);
}

@media (max-width:600px){
  .contact-wrap{ padding-left:10px; padding-right:10px; }
  .msg{ max-width:88%; }
  .contact-card{ border-radius:18px; }
  .cx-channel-tab{ padding:10px 14px; font-size:.85rem; }
}
