@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ══════════════════════════════════════════════════════════
   DESIGN SYSTEM
   ══════════════════════════════════════════════════════════ */
:root {
  --c-red:          #C50202;
  --c-red-dark:     #9a0000;
  --c-red-glow:     rgba(197,2,2,0.35);
  --c-red-soft:     rgba(197,2,2,0.12);

  --c-glass:        rgba(12,12,14,0.82);
  --c-glass-2:      rgba(18,18,22,0.88);
  --c-glass-msg:    rgba(255,255,255,0.065);
  --c-blur:         blur(32px) saturate(180%) brightness(1.06);
  --c-blur-soft:    blur(16px) saturate(150%);

  --c-border:       rgba(255,255,255,0.10);
  --c-border-hi:    rgba(255,255,255,0.20);
  --c-white:        #ffffff;
  --c-off-white:    rgba(242,240,237,0.93);
  --c-gray:         rgba(165,165,175,0.75);
  --c-dark:         rgba(255,255,255,0.04);

  --shadow-panel:
    0 40px 100px rgba(0,0,0,0.70),
    0 10px 30px  rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 -1px 0 rgba(0,0,0,0.28);

  --shadow-bubble-out:
    0 3px 18px rgba(197,2,2,0.28),
    inset 0 1px 0 rgba(255,255,255,0.22);

  --shadow-bubble-in:
    0 2px 10px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.12);

  --radius:   22px;
  --tr:       0.28s cubic-bezier(.4,0,.2,1);
  --font:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --w:        340px;
}

/* ══════════════════════════════════════════════════════════
   PANEL COMMUN (.form / .users)
   ══════════════════════════════════════════════════════════ */
.form,
.users {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 1000;
  width: var(--w);
  font-family: var(--font);
  background: var(--c-glass);
  backdrop-filter: var(--c-blur);
  -webkit-backdrop-filter: var(--c-blur);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-panel);
  isolation: isolate;
  overflow: hidden;
}

/* Reflet lumineux top */
.form::before,
.users::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.45) 30%,
    rgba(197,2,2,0.55) 65%,
    transparent 100%);
  pointer-events: none;
  animation: shimmerTop 5s ease-in-out infinite;
}

/* Lueur ambiante rouge */
.form::after {
  content: '';
  position: absolute;
  bottom: -50px; right: -50px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(197,2,2,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ══════════════════════════════════════════════════════════
   BOUTON FERMER
   ══════════════════════════════════════════════════════════ */
.close_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  border: 1px solid var(--c-border);
  border-radius: 50%;
  color: var(--c-gray);
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  font: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background var(--tr), border-color var(--tr), color var(--tr), transform var(--tr), box-shadow var(--tr);
  position: absolute;
  top: 13px; right: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
  z-index: 5;
}

.close_button svg { width: 10px; height: 10px; }

.close_button:hover {
  background: rgba(197,2,2,0.3);
  border-color: rgba(197,2,2,0.5);
  color: #fff;
  box-shadow: 0 0 14px rgba(197,2,2,0.3);
  transform: scale(1.12) rotate(90deg);
}

/* ══════════════════════════════════════════════════════════
   FORMULAIRE DE CONNEXION
   ══════════════════════════════════════════════════════════ */
.form { padding: 30px 28px 26px; }

.form header {
  font-size: 17px;
  font-weight: 600;
  color: var(--c-white);
  padding-bottom: 18px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--c-border);
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form header::before {
  content: '';
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-red);
  box-shadow: 0 0 10px var(--c-red-glow), 0 0 22px var(--c-red-glow);
  animation: pulseDot 2s ease-in-out infinite;
}

.form form { margin-top: 20px; }

.form form .error-text {
  color: #ff8585;
  padding: 9px 14px;
  text-align: center;
  border-radius: 12px;
  background: rgba(197,2,2,0.14);
  border: 1px solid rgba(197,2,2,0.28);
  margin-bottom: 14px;
  font-size: 12px;
  display: none;
}

.form form .name-details {
  display: flex;
  gap: 10px;
}

.form form .field {
  display: flex;
  margin-bottom: 12px;
  flex-direction: column;
  position: relative;
}

.form form .field label {
  margin-bottom: 5px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--c-gray);
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.form form .input input,
.form form .field input[type="text"],
.form form .field input[type="email"],
.form form .field input[type="password"] {
  height: 42px;
  width: 100%;
  font-size: 13px;
  font-family: var(--font);
  padding: 0 14px;
  border-radius: 11px;
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--c-border);
  color: var(--c-white);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

.form form .input input:focus,
.form form .field input:focus {
  background: rgba(255,255,255,0.085);
  border-color: rgba(197,2,2,0.65);
  box-shadow:
    0 0 0 3px rgba(197,2,2,0.18),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

.form form .field input::placeholder { color: rgba(255,255,255,0.22); }

/* Bouton Continuer */
.form form .button input {
  height: 46px;
  border: none;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  width: 100%;
  margin-top: 6px;
  border-radius: 13px;
  cursor: pointer;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--c-red) 0%, var(--c-red-dark) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,90,90,0.28);
  box-shadow:
    0 4px 22px rgba(197,2,2,0.42),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(0,0,0,0.18);
  transition: transform var(--tr), box-shadow var(--tr);
}

.form form .button input::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}

.form form .button input:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(197,2,2,0.52), inset 0 1px 0 rgba(255,255,255,0.28);
}

.form form .button input:hover::after { left: 150%; }
.form form .button input:active { transform: translateY(0) scale(0.98); }

/* ══════════════════════════════════════════════════════════
   LISTE UTILISATEURS (admin)
   ══════════════════════════════════════════════════════════ */
.users { padding: 0 0 12px; }

.users_admin { position: initial; margin-top: 0; }

.users header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

.users header .content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.users header img {
  height: 38px; width: 38px;
  border-radius: 50%;
  border: 2px solid rgba(197,2,2,0.55);
  box-shadow: 0 0 14px rgba(197,2,2,0.28);
  object-fit: cover;
}

.users header .details span {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-white);
  letter-spacing: -0.2px;
}

/* Groupe logout + fermer dans le header admin */
.users header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.users header .logout {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(10px);
  color: var(--c-gray);
  border: 1px solid var(--c-border);
  padding: 5px 11px;
  text-decoration: none;
  border-radius: 8px;
  font-size: 11px;
  font-family: var(--font);
  white-space: nowrap;
  transition: all var(--tr);
}

.users header .logout:hover {
  background: rgba(197,2,2,0.18);
  border-color: rgba(197,2,2,0.38);
  color: #fff;
}

/* Bouton fermer inline dans le header admin (non absolu) */
.users header .close_button {
  position: relative;
  top: auto; right: auto;
  flex-shrink: 0;
}

/* Barre de recherche modernisée — toujours visible */
.users .search {
  margin: 10px 14px 8px;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.users .search:focus-within {
  border-color: rgba(197,2,2,0.45);
  box-shadow: 0 0 0 3px rgba(197,2,2,0.10);
}

.users .search .text { display: none; }

.users .search input {
  position: static;
  flex: 1;
  height: 36px;
  width: 100%;
  padding: 0 14px;
  font-size: 12.5px;
  font-family: var(--font);
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--c-white);
  outline: none;
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: none;
  transition: none;
}

.users .search input::placeholder { color: rgba(255,255,255,0.28); }
.users .search input.show { opacity: 1; pointer-events: auto; }

.users .search button {
  position: static;
  z-index: auto;
  width: 38px; height: 36px;
  cursor: pointer;
  border: none;
  border-left: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-gray);
  outline: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--tr), color var(--tr);
  flex-shrink: 0;
}

.users .search button:hover {
  background: rgba(197,2,2,0.28);
  color: #fff;
}

.users-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 4px 10px 8px;
}

.users-list .no-users {
  color: rgba(255,255,255,0.28);
  text-align: center;
  padding: 24px 0;
  font-size: 12.5px;
}

/* Scrollbar */
:is(.users-list, .chat-box)::-webkit-scrollbar { width: 3px; }
:is(.users-list, .chat-box)::-webkit-scrollbar-track { background: transparent; }
:is(.users-list, .chat-box)::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
}
:is(.users-list, .chat-box)::-webkit-scrollbar-thumb:hover {
  background: rgba(197,2,2,0.45);
}

.users-list a {
  display: flex;
  align-items: center;
  padding: 9px 8px;
  margin-bottom: 2px;
  border-radius: 13px;
  border: none;
  text-decoration: none;
  transition: background var(--tr);
}

.users-list a:hover { background: rgba(255,255,255,0.055); }
.users-list a:last-child { margin-bottom: 0; }

.users-list a img {
  height: 38px; width: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  transition: border-color var(--tr);
}

.users-list a:hover img { border-color: rgba(197,2,2,0.45); }

:is(.users, .users-list) .content { display: flex; align-items: center; }
:is(.users, .users-list) .content .details { color: var(--c-white); margin-left: 12px; }
:is(.users, .users-list) .details span { font-size: 13.5px; font-weight: 500; }
.users-list a .details p { color: var(--c-gray); font-size: 11.5px; margin-top: 2px; }

.users-list a .status-dot { font-size: 8px; color: #4ade80; padding-left: 8px; }
.users-list a .status-dot.offline { color: rgba(255,255,255,0.12); }

.user_link { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.user_delete {
  cursor: pointer;
  color: rgba(255,255,255,0.25);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  flex-shrink: 0;
  transition: all var(--tr);
  outline: none;
}

.user_delete:hover {
  background: rgba(197,2,2,0.14);
  border-color: rgba(197,2,2,0.28);
  color: var(--c-red);
}

@keyframes deleteOut {
  0%   { opacity: 1; transform: scaleY(1); max-height: 60px; }
  100% { opacity: 0; transform: scaleY(0); max-height: 0; padding: 0; margin: 0; }
}

.user_link.deleting {
  animation: deleteOut 0.28s ease forwards;
  overflow: hidden;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   ZONE DE CHAT
   ══════════════════════════════════════════════════════════ */
.chat-area {
  font-family: var(--font);
  display: flex;
  flex-direction: column;
}

.chat-area header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: linear-gradient(135deg, rgba(8,8,10,0.94) 0%, rgba(18,18,22,0.88) 100%);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--c-border);
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  overflow: hidden;
}

.chat-area header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3) 40%, rgba(197,2,2,0.45) 70%, transparent);
  pointer-events: none;
}

.chat-area header .back-icon {
  color: var(--c-gray);
  font-size: 15px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.065);
  border: 1px solid var(--c-border);
  transition: all var(--tr);
  flex-shrink: 0;
  text-decoration: none;
}

.chat-area header .back-icon:hover {
  background: rgba(197,2,2,0.28);
  border-color: rgba(197,2,2,0.45);
  color: #fff;
  box-shadow: 0 0 12px rgba(197,2,2,0.28);
}

.chat-area header .user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.chat-area header img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(197,2,2,0.55);
  box-shadow: 0 0 14px rgba(197,2,2,0.30);
}

.chat-area header .details span {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-white);
  letter-spacing: -0.2px;
}

.chat-area header .details .status {
  font-size: 11px;
  color: #4ade80;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.chat-area header .details .status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74,222,128,0.6);
  animation: pulseDot 2s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════
   BOÎTE DE MESSAGES
   ══════════════════════════════════════════════════════════ */
.chat-box {
  min-height: 380px;
  max-height: 380px;
  overflow-y: auto;
  padding: 16px 14px 18px;
  background:
    radial-gradient(ellipse at 10% 20%, rgba(197,2,2,0.04) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 80%, rgba(197,2,2,0.03) 0%, transparent 45%),
    rgba(6,6,8,0.95);
}

.chat-box .text {
  position: absolute;
  top: 45%; left: 50%;
  width: calc(100% - 50px);
  text-align: center;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.22);
  font-size: 12.5px;
  line-height: 1.6;
}

.chat-box .chat { margin: 7px 0; }

/* Message sortant */
.chat-box .outgoing { display: flex; justify-content: flex-end; }
.chat-box .outgoing .details { max-width: 80%; }

.outgoing .details p {
  background: linear-gradient(140deg, var(--c-red) 0%, var(--c-red-dark) 100%);
  color: rgba(255,255,255,0.96);
  border-radius: 18px 18px 4px 18px;
  font-size: 13px;
  line-height: 1.55;
  padding: 9px 14px;
  word-break: break-word;
  border: 1px solid rgba(255,90,90,0.22);
  box-shadow: var(--shadow-bubble-out);
  position: relative;
  overflow: hidden;
}

.outgoing .details p::before {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
  animation: shimmerBubble 4s ease-in-out infinite;
  pointer-events: none;
}

/* Message entrant */
.chat-box .incoming { display: flex; align-items: flex-end; gap: 7px; }

.chat-box .incoming img {
  height: 26px; width: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--c-border);
  flex-shrink: 0;
}

.chat-box .incoming .details { max-width: 80%; }

.incoming .details p {
  background: rgba(255,255,255,0.075);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--c-off-white);
  border-radius: 18px 18px 18px 4px;
  font-size: 13px;
  line-height: 1.55;
  padding: 9px 14px;
  word-break: break-word;
  border: 1px solid rgba(255,255,255,0.11);
  box-shadow: var(--shadow-bubble-in);
}

.chat-box .chat span.time {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.18);
  margin-top: 3px;
  font-weight: 400;
}
.outgoing span.time { text-align: right; }
.incoming span.time { padding-left: 2px; }

/* ══════════════════════════════════════════════════════════
   ZONE DE SAISIE
   ══════════════════════════════════════════════════════════ */
.typing-area {
  padding: 11px 12px;
  display: flex;
  gap: 9px;
  align-items: center;
  background: rgba(10,10,13,0.92);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-top: 1px solid var(--c-border);
  border-radius: 0 0 var(--radius) var(--radius);
  position: relative;
}

.typing-area::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12) 40%, rgba(255,255,255,0.12) 60%, transparent);
  pointer-events: none;
}

.typing-area input {
  flex: 1;
  height: 40px;
  font-size: 13px;
  font-family: var(--font);
  padding: 0 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.065);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--c-border);
  color: var(--c-white);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
}

.typing-area input:focus {
  background: rgba(255,255,255,0.095);
  border-color: rgba(197,2,2,0.48);
  box-shadow: 0 0 0 3px rgba(197,2,2,0.12);
}

.typing-area input::placeholder { color: rgba(255,255,255,0.20); }

.typing-area button {
  width: 40px; height: 40px;
  border: 1px solid var(--c-border);
  outline: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.22);
  font-size: 16px;
  cursor: pointer;
  pointer-events: none;
  opacity: 0.4;
  transition: all var(--tr);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.typing-area button.active {
  opacity: 1;
  pointer-events: auto;
  background: linear-gradient(135deg, var(--c-red) 0%, var(--c-red-dark) 100%);
  border-color: rgba(255,90,90,0.28);
  color: #fff;
  box-shadow: 0 3px 18px rgba(197,2,2,0.38), inset 0 1px 0 rgba(255,255,255,0.22);
}

.typing-area button.active:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 24px rgba(197,2,2,0.52);
}

.typing-area button.active:active { transform: scale(0.92); }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes shimmerTop {
  0%,100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

@keyframes shimmerBubble {
  0%       { left: -80%; }
  40%,100% { left: 160%; }
}

@keyframes pulseDot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.6; transform: scale(1.25); }
}

@keyframes msgIn {
  0%   { opacity: 0; transform: translateY(8px) scale(0.94); }
  65%  { transform: translateY(-1px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes panelOpen {
  0%   { opacity: 0; transform: translateY(20px) scale(0.90); }
  60%  { transform: translateY(-4px) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes panelClose {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(14px) scale(0.92); }
}

.form.chat-open,
.users.chat-open {
  animation: panelOpen 0.46s cubic-bezier(.34,1.56,.64,1) forwards;
}

.form.chat-closing,
.users.chat-closing {
  animation: panelClose 0.24s cubic-bezier(.4,0,1,1) forwards;
}

/* ══════════════════════════════════════════════════════════
   RIPPLE + LOADING + ERREUR
   ══════════════════════════════════════════════════════════ */
@keyframes rippleAnim { to { transform: scale(5); opacity: 0; } }

.field.button { position: relative; }

.chat-ripple {
  position: absolute;
  border-radius: 50%;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.28);
  transform: scale(0);
  animation: rippleAnim 0.55s ease-out forwards;
  pointer-events: none;
  margin-left: -22px; margin-top: -22px;
  z-index: 2;
}

@keyframes spin { to { transform: rotate(360deg); } }

.field.button.loading input {
  color: transparent !important;
  pointer-events: none;
}

.field.button.loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(255,255,255,0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  pointer-events: none;
  z-index: 3;
}

@keyframes errorShake {
  0%,100% { transform: translateX(0); }
  18%     { transform: translateX(-9px); }
  36%     { transform: translateX(9px); }
  54%     { transform: translateX(-6px); }
  72%     { transform: translateX(6px); }
  88%     { transform: translateX(-2px); }
}

.form.shake { animation: errorShake 0.46s ease !important; }

/* ══════════════════════════════════════════════════════════
   OVERLAY SUCCÈS
   ══════════════════════════════════════════════════════════ */
.chat-success {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: rgba(8,8,10,0.90);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  overflow: hidden;
  animation: panelOpen 0.40s cubic-bezier(.34,1.56,.64,1) forwards;
}

.chat-check-circle {
  width: 66px; height: 66px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(197,2,2,0.22), rgba(120,0,0,0.32));
  border: 2px solid rgba(197,2,2,0.60);
  box-shadow: 0 0 32px rgba(197,2,2,0.42), 0 0 10px rgba(197,2,2,0.22), inset 0 1px 0 rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.chat-check-circle svg { width: 32px; height: 32px; overflow: visible; }

.chat-check-circle svg path {
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 42;
  stroke-dashoffset: 42;
  animation: drawCheck 0.50s 0.18s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes drawCheck { to { stroke-dashoffset: 0; } }

.chat-success-text {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.38s 0.40s ease forwards;
}

.chat-success-sub {
  color: rgba(255,255,255,0.38);
  font-size: 12px;
  font-family: var(--font);
  margin-top: 5px;
  opacity: 0;
  transform: translateY(6px);
  animation: fadeUp 0.38s 0.56s ease forwards;
}

@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.chat-particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFly var(--duration, 0.75s) ease-out forwards;
}

@keyframes particleFly {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(0.1); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media screen and (max-width: 450px) {
  .form, .users { width: calc(100vw - 32px); right: 16px; }
  .form { padding: 22px 20px 20px; }
  .form form .name-details { flex-direction: column; gap: 0; }
  .chat-box { min-height: 320px; max-height: 320px; }
  .users-list { max-height: 300px; }
}
