/* ============================================================
   🔵 IPTV SOCIAL MEDIA - CHAT UI COMPLET
   ============================================================ */

/* === SIDEBAR (amis connectés) === */
#chat-sidebar {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 250px;
  height: 450px; /* ✅ même hauteur que les boîtes de chat */
  background: rgba(8,16,32,0.96);
  border-left: 2px solid rgba(255,255,255,0.08);
  box-shadow: -6px 0 15px rgba(0,0,0,0.4);
  color: #fff;
  font-family: "Inter", sans-serif;
  display: flex;
  flex-direction: column;
  border-radius: 10px 0 0 0;
  z-index: 9999999;
}

/* Titre */
#chat-sidebar .chat-header {
  padding: 10px;
  font-weight: bold;
  background: #0a2a5e;
  border-bottom: 1px solid #334;
  text-align: center;
}

/* Liste d’amis */
#chat-friends-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: #2a63c2 #0d1a3a;
}

/* Apparence du scroll (pour Chrome) */
#chat-friends-list::-webkit-scrollbar {
  width: 6px;
}
#chat-friends-list::-webkit-scrollbar-thumb {
  background-color: #2a63c2;
  border-radius: 3px;
}
#chat-friends-list::-webkit-scrollbar-track {
  background-color: #0d1a3a;
}

/* Chaque ami */
.chat-friend {
  display: flex;
  align-items: center;
  padding: 6px;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-friend:hover {
  background: rgba(255,255,255,0.1);
}
.chat-friend img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-friend .name {
  flex: 1;
  font-size: 14px;
}
.chat-friend .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-online {
  background: #4caf50;
}
.status-offline {
  background: #777;
}

/* Champ de recherche */
#chat-search {
  border: 1px solid #2a63c2;
  outline: none;
  border-radius: 8px;
  background: #0b1f4a;
  color: #fff;
  font-size: 13px;
  padding: 6px 8px;
  margin: 6px;
  width: calc(100% - 12px);
}
#chat-search::placeholder {
  color: rgba(255,255,255,0.6);
}

/* === CHAT WINDOW === */
.chat-window {
  position: fixed;
  bottom: 0;                     
  margin-bottom: 4px;
  width: 250px;
  height: 450px;
  background: #fff;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 0 15px rgba(0,0,0,0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 100000;
  margin-right: 8px;
  animation: slideUpChat 0.35s ease-out;
}

/* Header du chat */
.chat-window-header {
  background: #0a2a5e;
  color: #fff;
  padding: 8px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.chat-controls {
  display: flex;
  gap: 5px;
}
.chat-controls button {
  background: none;
  border: none;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
}
.chat-controls button:hover {
  color: #ffcb05;
}

/* Zone de messages */
.chat-window-messages {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  background: #fff;
  font-size: 14px;
  color: #111;
}
.chat-window-messages p,
.chat-window-messages div {
  margin: 4px 0;
}

/* Barre d'outils (emoji + fichier) */
.chat-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0f3ff;
  border-top: 1px solid #ccc;
  padding: 6px 8px;
  justify-content: flex-start;
  order: 3;
}
.chat-toolbar button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #0a2a5e;
  transition: transform 0.15s;
}
.chat-toolbar button:hover {
  transform: scale(1.2);
}

/* Zone de saisie */
.chat-window-input {
  display: flex;
  border-top: 1px solid #ccc;
  order: 2;
}
.chat-window-input textarea {
  flex: 1;
  border: none;
  padding: 8px;
  resize: none;
  font-size: 13px;
  outline: none;
}
.chat-window-input button {
  background: #0a2a5e;
  color: white;
  border: none;
  width: 60px;
  cursor: pointer;
  font-weight: bold;
}

/* Texte vide */
.chat-window-messages:empty::before {
  content: "Aucune conversation encore.";
  color: #444;
  font-style: italic;
  opacity: 0.9;
}

/* Messages */
.chat-msg {
  margin: 4px 0;
  display: flex;
}

.chat-msg.me {
  justify-content: flex-end;
}

.chat-msg.other {
  justify-content: flex-start;
}

/* === Couleur du texte dans les bulles === */
.chat-msg .bubble {
  color: #c7d6f9; /* bleu gris pastel */
  font-size: 14px;
  line-height: 1.45;
}

/* === Bulles === */

/* Message de l'utilisateur (à droite) */
.chat-msg.me .bubble {
  background: #8ff2ff; /* ton bleu entête, légèrement plus clair */
  color: #121212;    /* texte noir */
}

/* Message de l'autre (à gauche) */
.chat-msg.other .bubble {
  background: #f5f7ff; /* blanc bleuté */
  color: #0a1a40;      /* bleu foncé pour contraste */
  border: 1px solid #e2e6ff;
}


/* Animation apparition */
@keyframes slideUpChat {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.chat-friend img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;        /* ✅ force le rendu */
  background: #0a2a5e;   /* ✅ couleur de fond visible si l’image manque */
}
/* === Animation d'apparition des messages === */
@keyframes msgFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg {
  opacity: 0;
  animation: msgFadeIn 0.35s ease forwards;
}
/* Tiny red badge for unread */
.chat-unread-badge {
  position: absolute;
  top: 6px;
  right: 36px;         /* sits left of the close “×” */
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #FF3B30; /* iOS red */
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  display: none;
}

/* show it when we have unread */
.chat-window.has-unread .chat-unread-badge { display: inline-block; }

/* Optional: a red dot on friend list rows */
.chat-friend .dot-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF3B30;
  margin-left: 6px;
  display: none;
}

.chat-friend.has-unread .dot-unread { display: inline-block; }
/* ==========================================================
   🌟 Streamo AI - Style spécial dans la liste des amis
   ========================================================== */
.friend[data-id="9999"] img {
  position: relative;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.7),
              0 0 20px rgba(0, 150, 255, 0.5),
              0 0 30px rgba(0, 255, 255, 0.3);
  animation: pulse-glow 2.5s infinite ease-in-out;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.7); }
  50% { box-shadow: 0 0 25px rgba(0, 200, 255, 1); }
  100% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.7); }
}

/* Petit badge "AI" à côté du nom */
.friend[data-id="9999"] .friend-name::after {
  content: "AI";
  font-size: 10px;
  font-weight: bold;
  margin-left: 6px;
  color: #fff;
  background: linear-gradient(90deg, #00c6ff, #0072ff);
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.6);
}

/* Lorsqu’on survole Streamo AI */
.friend[data-id="9999"]:hover {
  background: rgba(0, 100, 255, 0.15);
  transition: background 0.3s;
}
.friend[data-id="9999"]:hover img {
  transform: scale(1.05);
  transition: transform 0.3s;
}
.typing-indicator {
  color: #6cf;
  font-style: italic;
  font-size: 13px;
  margin: 5px 0;
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
/* 🔹 Comportement minimisé */
.chat-window.minimized {
  height: 42px; /* barre du haut seulement */
  overflow: hidden;
  transition: height 0.25s ease-in-out;
}

/* 🔹 Contenu caché quand minimisé */
.chat-window.minimized .chat-window-messages,
.chat-window.minimized .chat-window-input,
.chat-window.minimized .chat-toolbar {
  display: none;
}

/* 🔹 Bouton style */
.chat-controls button.chat-minimize {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  margin-right: 4px;
  cursor: pointer;
  line-height: 1;
}
.chat-controls button.chat-minimize:hover {
  color: #00eaff;
}
.chat-window {
  transition: height 0.25s ease-in-out, bottom 0.25s ease-in-out;
}
/* === Sidebar Chat === */
#chat-sidebar {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 250px;
  height: 410px;
  background: #0a1a3a;
  border-radius: 10px 0 0 0;
  box-shadow: -2px 0 6px rgba(0,0,0,0.4);
  color: #fff;
  overflow: hidden;
  transition: transform 0.4s ease;
  z-index: 9999;
}

#chat-sidebar.closed {
  transform: translateX(220px);
}

/* --- Bouton inline à l'intérieur du header --- */
.chat-toggle-inline {
  display: inline-block;
  font-size: 18px;
  margin-right: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
  user-select: none;
  color: #ffffffcc;
}

.chat-toggle-inline:hover {
  color: #00aaff;
  transform: scale(1.2);
}

#chat-sidebar.closed {
  transform: translateX(230px);
}

/* Le header du chat */
.chat-header {
  background: #071838;
  font-weight: 600;
  font-size: 15px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #0d2b66;
}
.chat-user-name a:hover {
  text-decoration: underline;
  color: #4da3ff;
}

/* Overflow CSS
/* === OVERFLOW CHAT BUTTON === */
.chat-overflow {
  position: fixed;
  bottom: 0;
  z-index: 9999999;
}


#chat-overflow.hidden {
  display: none;
}

/* Rond bleu Messenger */
#chat-overflow-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #007bff;
  border: 2px solid #fff;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}

#chat-overflow-toggle:hover {
  transform: scale(1.12);
}

/* Quand un message arrive dans overflow → clignote rouge */
#chat-overflow-toggle.has-unread {
  animation: blink-red 1s infinite;
}

@keyframes blink-red {
  0% { background: #ff3b30; }
  50% { background: #d90000; }
  100% { background: #ff3b30; }
}

/* === MENU OVERFLOW === */
#chat-overflow-list {
  position: absolute;
  bottom: 48px;
  right: 0;
  width: 250px; /* même largeur qu’une fenêtre */
  max-height: 300px;
  overflow-y: auto;
  background: #0a1a3a;
  border-radius: 10px 10px 0 10px;
  box-shadow: 0 0 15px rgba(0,0,0,0.45);
  display: none;
  padding: 6px 0;
}

#chat-overflow-list.visible {
  display: block;
}

/* Élément dans le menu */
.chat-overflow-item {
  padding: 10px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #12285a;
}

.chat-overflow-item:hover {
  background: #123c8a;
}

/* point rouge pour nouveaux messages */
.chat-overflow-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
}
