/* ============================================================
   GESTIVA · Chat Interne Style Messenger
   Widget Chatbox flottant, bulles de discussion, partage de fichiers/images,
   enregistreur de notes vocales (micro), groupes de discussion et réactions
   ============================================================ */

/* ── Exclusions strictes : Pages Publiques & Authentification ─ */
body.landing-body .chat-launcher-wrap,
body.landing-body #chatLauncherWrap,
body.landing-body #chatboxCard,
body.auth-body .chat-launcher-wrap,
body.auth-body #chatLauncherWrap,
body.auth-body #chatboxCard,
body[class*="landing"] .chat-launcher-wrap,
body[class*="landing"] #chatLauncherWrap,
body[class*="landing"] #chatboxCard,
body[class*="auth"] .chat-launcher-wrap,
body[class*="auth"] #chatLauncherWrap,
body[class*="auth"] #chatboxCard {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Bouton Lanceur Flottant (Bas Droite) ──────────────────── */
.chat-launcher-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
}

.chat-launcher-btn {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px -2px rgba(37, 99, 235, 0.45);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
  position: relative;
  overflow: visible;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.chat-launcher-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
}

.chat-launcher-btn .icon-open,
.chat-launcher-btn .icon-close {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  font-size: 26px !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
}

.chat-launcher-btn .icon-open::before,
.chat-launcher-btn .icon-close::before {
  display: block !important;
  vertical-align: 0 !important;
  line-height: 1 !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

.chat-launcher-btn .icon-open[style*="display: none"],
.chat-launcher-btn .icon-open[style*="display:none"],
.chat-launcher-btn .icon-close[style*="display: none"],
.chat-launcher-btn .icon-close[style*="display:none"] {
  display: none !important;
}

.chat-floating-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ── Fenêtre Chatbox Flottante ─────────────────────────────── */
.chatbox-card {
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 395px;
  height: 580px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 16px 48px -4px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(226, 232, 240, 0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatPopUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.chat-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* ── Drag & Drop Overlay ───────────────────────────────────── */
.chat-drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.92);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.drop-overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  text-align: center;
  padding: 24px;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  margin: 20px;
}

.drop-overlay-box i {
  font-size: 42px;
}

.drop-overlay-box strong {
  font-size: 16px;
}

.drop-overlay-box span {
  font-size: 12px;
  opacity: 0.85;
}

/* ── Header du Chat ────────────────────────────────────────── */
.chat-header {
  height: 64px;
  padding: 0 16px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.chat-header-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.chat-header-sub {
  font-size: 11px;
  color: #64748b;
  display: block;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-head-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.chat-head-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-new-group-head {
  color: #2563eb;
  font-size: 17px;
}

.btn-new-group-head:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.chat-head-btn.btn-back {
  font-size: 17px;
  margin-right: 4px;
}

/* Header Conversation Active */
.convo-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.convo-user-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.convo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
}

.convo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.convo-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
}

.convo-online-dot.offline {
  background: #94a3b8;
}

.convo-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.convo-name {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.convo-status {
  font-size: 11px;
  color: #10b981;
  font-weight: 600;
}

.convo-status.offline {
  color: #94a3b8;
}

/* ── Barre de Recherche Contacts ──────────────────────────── */
.chat-search-bar {
  padding: 10px 14px 6px;
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
}

.chat-search-bar i {
  position: absolute;
  left: 24px;
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}

.chat-search-bar input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12.5px;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}

.chat-search-bar input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-scroll-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Canal Général Fixé */
.chat-pinned-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 6px 12px 4px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-pinned-channel:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}

.channel-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.channel-meta {
  flex: 1;
  min-width: 0;
}

.channel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-name {
  font-size: 13px;
  color: #0f172a;
  font-weight: 800;
}

.channel-time {
  font-size: 10px;
  color: #94a3b8;
}

.channel-preview {
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.chat-unread-pill {
  background: #2563eb;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.chat-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 4px;
}

.chat-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

.btn-add-section {
  border: none;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
}

.btn-add-section:hover {
  background: #dbeafe;
}

/* ── Liste des Groupes ─────────────────────────────────────── */
.chat-groups-scroll {
  padding: 2px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.chat-group-item:hover {
  background: #f8fafc;
}

.group-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.group-member-count-badge {
  font-size: 9.5px;
  background: #f1f5f9;
  color: #64748b;
  padding: 1px 5px;
  border-radius: 6px;
  font-weight: 700;
  margin-left: 6px;
}

/* ── Liste Scrollable des Collaborateurs ───────────────────── */
.chat-contacts-scroll {
  padding: 2px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.chat-contact-item:hover {
  background: #f8fafc;
}

.contact-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
}

.contact-dot.offline {
  background: #cbd5e1;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contact-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-time {
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 500;
}

.contact-sub {
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.contact-sub.unread {
  font-weight: 700;
  color: #0f172a;
}

.chat-loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px 0;
  color: #94a3b8;
  font-size: 12px;
}

/* ── Vue Formulaire Création de Groupe ─────────────────────── */
.chat-group-form-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-form-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.group-form-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.group-form-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.group-icon-picker {
  display: flex;
  gap: 6px;
}

.icon-pick-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-pick-btn.active, .icon-pick-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  transform: scale(1.1);
}

.group-members-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.member-check-item:hover {
  border-color: #cbd5e1;
}

.member-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #2563eb;
}

.member-check-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.member-check-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}

.member-check-role {
  font-size: 10.5px;
  color: #64748b;
}

.chat-group-form-footer {
  padding: 10px 16px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-group-cancel {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-group-submit {
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-group-submit:hover {
  background: #1d4ed8;
}

/* ── Zone des Messages (Conversation Active) ───────────────── */
.chat-messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}

.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Date Divider */
.chat-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.chat-date-divider span {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  background: #f8fafc;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #f1f5f9;
}

/* Ligne de Message */
.chat-msg-row {
  display: flex;
  gap: 8px;
  max-width: 86%;
  position: relative;
  animation: msgPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes msgPopIn {
  0% { opacity: 0; transform: translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg-row.msg-received {
  align-self: flex-start;
}

.chat-msg-row.msg-sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
  align-self: flex-end;
  overflow: hidden;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  position: relative;
}

.chat-msg-row.msg-sent .msg-bubble-wrap {
  align-items: flex-end;
}

.msg-sender-name {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 2px;
  padding-left: 4px;
}

/* Bulles de Discussion */
.msg-bubble {
  padding: 9px 13px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.chat-msg-row.msg-received .msg-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 18px 18px 18px 4px;
}

.chat-msg-row.msg-sent .msg-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border-radius: 18px 18px 4px 18px;
}

.chat-msg-row.msg-sent .msg-bubble a {
  color: #ffffff;
}

/* ── Barre de Réactions au Survol (Hover Toolbar) ──────────── */
.msg-reaction-toolbar {
  position: absolute;
  top: -28px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  display: none;
  align-items: center;
  padding: 2px 6px;
  gap: 4px;
  z-index: 20;
  animation: popInQuick 0.15s ease;
}

.chat-msg-row.msg-received .msg-reaction-toolbar {
  left: 0;
}

.chat-msg-row.msg-sent .msg-reaction-toolbar {
  right: 0;
}

.chat-msg-row:hover .msg-reaction-toolbar {
  display: flex;
}

.msg-react-quick-btn {
  border: none;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  line-height: 1;
  transition: transform 0.15s ease;
}

.msg-react-quick-btn:hover {
  transform: scale(1.35);
}

@keyframes popInQuick {
  from { opacity: 0; transform: translateY(4px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Lecteur Audio / Note Vocale Messenger ─────────────────── */
.msg-voice-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  min-width: 200px;
}

.voice-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.chat-msg-row.msg-sent .voice-play-btn {
  background: #ffffff;
  color: #2563eb;
}

.voice-play-btn:hover {
  transform: scale(1.1);
}

.voice-wave-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.voice-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.chat-msg-row.msg-sent .voice-progress-bar {
  background: rgba(255, 255, 255, 0.3);
}

.voice-progress-fill {
  width: 0%;
  height: 100%;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.chat-msg-row.msg-sent .voice-progress-fill {
  background: #ffffff;
}

.voice-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  opacity: 0.8;
}

/* Pièces Jointes : Fichiers */
.msg-attachment-img {
  max-width: 230px;
  max-height: 200px;
  border-radius: 12px;
  cursor: pointer;
  object-fit: cover;
  display: block;
  margin-bottom: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.msg-attachment-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  margin-top: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.chat-msg-row.msg-received .msg-attachment-file {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.file-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-icon-pdf { background: #fee2e2; color: #ef4444; }
.file-icon-word { background: #dbeafe; color: #2563eb; }
.file-icon-excel { background: #d1fae5; color: #10b981; }
.file-icon-ppt { background: #ffedd5; color: #f97316; }
.file-icon-zip { background: #ede9fe; color: #8b5cf6; }
.file-icon-audio { background: #fce7f3; color: #ec4899; }
.file-icon-default { background: #eff6ff; color: #2563eb; }

.file-meta-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.file-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.file-size {
  font-size: 10px;
  opacity: 0.8;
}

.file-dl-icon {
  font-size: 14px;
  margin-left: auto;
  opacity: 0.7;
}

/* Réactions Emoji sous la bulle */
.msg-reaction-badge {
  position: absolute;
  bottom: -9px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 12px;
  padding: 1px 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.chat-msg-row.msg-received .msg-reaction-badge {
  left: 8px;
}

.chat-msg-row.msg-sent .msg-reaction-badge {
  right: 8px;
}

.msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 4px;
}

/* Preview d'attachement avant envoi */
.chat-attachment-preview {
  padding: 8px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.att-prev-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.att-prev-remove {
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  font-size: 16px;
}

/* ── Barre d'Enregistrement Vocal Messenger ─────────────────── */
.chat-voice-bar {
  padding: 10px 14px;
  background: #fef2f2;
  border-top: 1px solid #fee2e2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 0.15s ease;
}

.voice-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rec-pulsing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.7);
  animation: recPulse 1.2s infinite;
}

@keyframes recPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.rec-timer {
  font-size: 13.5px;
  font-weight: 800;
  color: #ef4444;
  font-variant-numeric: tabular-nums;
}

.rec-soundwave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.rec-soundwave span {
  width: 3px;
  background: #ef4444;
  border-radius: 2px;
  animation: wave 0.8s ease-in-out infinite alternate;
}

.rec-soundwave span:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.rec-soundwave span:nth-child(2) { height: 14px; animation-delay: 0.25s; }
.rec-soundwave span:nth-child(3) { height: 8px; animation-delay: 0.4s; }
.rec-soundwave span:nth-child(4) { height: 16px; animation-delay: 0.15s; }
.rec-soundwave span:nth-child(5) { height: 10px; animation-delay: 0.3s; }

@keyframes wave {
  from { height: 4px; }
  to { height: 18px; }
}

.voice-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cancel-voice {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-cancel-voice:hover {
  background: #fca5a5;
  color: #ffffff;
}

.btn-send-voice {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
  transition: transform 0.15s ease;
}

.btn-send-voice:hover {
  background: #1d4ed8;
  transform: scale(1.08);
}

/* ── Barre d'Envoi Standard ────────────────────────────────── */
.chat-input-bar {
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-bar-actions-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.chat-tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-tool-btn:hover {
  background: #eff6ff;
  transform: scale(1.1);
}

.chat-tool-btn.btn-mic:hover {
  color: #ef4444;
  background: #fef2f2;
}

.chat-input-field-wrap {
  flex: 1;
}

.chat-input-field-wrap input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
}

.chat-input-field-wrap input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-bar-actions-right {
  display: flex;
  align-items: center;
}

.chat-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.btn-quick-like {
  background: transparent;
  font-size: 18px;
}
.btn-quick-like:hover {
  transform: scale(1.2);
}

.btn-send-msg {
  background: #2563eb;
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.btn-send-msg:hover {
  background: #1d4ed8;
  transform: scale(1.08);
}

/* ── Popover Émojis ────────────────────────────────────────── */
.chat-emoji-popover {
  position: absolute;
  bottom: 60px;
  left: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  padding: 10px;
  z-index: 100;
  animation: chatPopUp 0.15s ease;
}

.emoji-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.emoji-pop-close {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  line-height: 1;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.emoji-btn {
  border: none;
  background: transparent;
  font-size: 19px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.1s ease;
}

.emoji-btn:hover {
  background: #f1f5f9;
  transform: scale(1.2);
}

/* ── Lightbox Image Modal ──────────────────────────────────── */
.chat-lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.lightbox-content {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.lightbox-header {
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.lightbox-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.lightbox-body {
  padding: 12px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
}

/* ── Badges & Top Bar ──────────────────────────────────────── */
.side-rail-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.top-chat-btn {
  position: relative;
}

.top-chat-btn i {
  color: #64748b;
  font-size: 18px;
  transition: color 0.15s ease;
}

.top-chat-btn:hover i {
  color: #2563eb;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
