 @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

    body {
      margin: 0;
      background: #f0f2f5; /* fond gris clair façon Facebook */
      color: #1c1e21; /* texte sombre */
      display: flex;
      flex-direction: column;
      height: 100vh;
      overflow-x: hidden;
      font-family: 'Open Sans', sans-serif;
    }

    /* HEADER */
    header {
      background: #ffffff; /* blanc */
      padding: 15px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #ddd;
      box-shadow: 0 2px 4px rgba(0,0,0,0.08);
      z-index: 1000;
    }

    header h1 {
      font-size: 1.2rem;
      color: #1877f2; /* bleu Facebook */
      margin: 0;
    }

    nav {
      display: flex;
      align-items: center;
      gap: 15px;
    }

    nav a {
      color:#1c1e21;
      text-decoration: none;
    }

    .toggle-btn {
      background: #1877f2;
      color: white;
      border: none;
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
    }

main {
  flex: 1;
  display: flex;
  height: calc(100vh - 60px);
  margin: 0 auto;         /* ✅ centrer sur PC */
  width: 100%;            /* par défaut prend toute la largeur */
  max-width: 900px;       /* ✅ limite max en PC */
}

    /* Fenêtre de chat */
    .chat-window {
      flex: 1;
      display: flex;
      flex-direction: column;
      border-radius: 12px;
      background: #fff;
      overflow: hidden;
      border: 1px solid #ddd;
    }

    #chatHeader {
      padding: 12px 16px;
      background: #f0f2f5;
      border-bottom: 1px solid #ddd;
      font-weight: bold;
      color: #1877f2;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .chat-messages {
      flex: 1;
      padding: 16px 8px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 12px;
      background: white;
    }

    
/* ✅ Bulles de message façon Google Messages */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 98%;
  margin-bottom: 8px;
}

.message-text {
  padding: 10px 14px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  max-width: 100%;
  white-space: pre-line;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ Message reçu (autre) */
.message.other {
  flex-direction: row;
  animation: fadeSlideInLeft 0.3s ease forwards;
}


.message.other .message-text {
  background: #edf2f7;
  color: #202124;
  border-radius: 18px 18px 18px 4px; /* plus arrondi à gauche */
  box-shadow: 0 8px 15px rgba(32, 33, 36, 0.12), 0 4px 6px rgba(32, 33, 36, 0.08);
  font-size: 16px;
}

/* ✅ Message envoyé (moi) */
.message.me {
  flex-direction: row-reverse;
  margin-left: auto;
  text-align: right;
  animation: fadeSlideInRight 0.3s ease forwards;
}

.message.me .message-text {
  background: #cce0ff;
  color: #202124;
  border-radius: 18px 18px 4px 18px; /* plus arrondi à droite */
  text-align: start;
  box-shadow: 0 8px 15px rgba(32, 33, 36, 0.12), 0 4px 6px rgba(32, 33, 36, 0.08);
  font-size: 16px;
}

    /* Zone de saisie */
.chat-input {
  display: flex;
  padding: 12px;
  border-top: 1px solid #ddd;
  background: #fff;
  align-items: flex-end; /* ✅ pour que le bouton s'aligne en bas */
}

.chat-input textarea {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 1rem;
  outline: none;
  background: #f0f2f5;
  resize: none;           /* ✅ désactive le redimensionnement manuel */
  min-height: 40px;       /* ✅ hauteur par défaut */
  max-height: 120px;      /* ✅ limite quand l’utilisateur tape beaucoup */
  line-height: 1.4;
}

.chat-input button {
  margin-left: 10px;
  background: green;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  align-self: flex-end; /* ✅ bouton aligné en bas du textarea */
}

.chat-input button:hover {
  background: #166fe5;
}

    /* Sidebar (users) */
    .sidebar {
      position: fixed;
      top: 0;
      left: -280px;
      width: 260px;
      height: 100%;
      background: rgba(10, 25, 47, 0.95);
      border-right: 1px solid #ddd;
      padding: 20px;
      transition: left 0.3s ease-in-out;
      z-index: 9999;
      overflow-y: auto;
    }

    .sidebar.open {
      left: 0;
    }

    .sidebar h3 {
      margin-top: 0;
      color: #1877f2;
    }

    #userSearch {
      width: 100%;
      padding: 8px 10px;
      margin-bottom: 12px;
      border-radius: 8px;
      border: 1px solid #ddd;
      outline: none;
      font-size: 0.9rem;
      background: #f0f2f5;
    }

    .chat-user {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
      padding: 8px;
      border-radius: 12px;
      background: #f0f2f5;
      transition: 0.2s;
      cursor: pointer;
  box-shadow: 0 8px 15px rgba(32, 33, 36, 0.12), 0 4px 6px rgba(32, 33, 36, 0.08);

    }

    .chat-user:hover {
      background: #e4e6eb;
    }

    .chat-user img {
      width: 35px;
      height: 35px;
      border-radius: 50%;
      margin-right: 10px;
      border: 2px solid #1877f2;
      
    }

    /* Overlay */
    .overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.5);
      z-index: 998;
      display: none;
    }

    .overlay.show {
      display: block;
    }

    
/* --- Notifications 🔔 (centrées sous le bouton) --- */
.notif-wrapper {
  position: relative;
  display: inline-block;
  z-index: 2000;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  min-width: 250px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.15);
  color: #000;
  z-index: 3000;
}

/* mark all as read */
/* Bouton "Mark all as read" */
#markAllReadBtn {
  display: block;
  width: 90%;
  margin: 5px auto 8px auto;
  padding: 6px 10px;
  font-size: 0.8rem;
  background-color: #f3f4f6;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

/* Hover effect */
#markAllReadBtn:hover {
  background-color: #e5e7eb;
  color: #000;
}

/* Séparateur visuel sous le bouton */
#markAllReadBtn::after {
  content: "";
  display: block;
  margin-top: 8px;
  border-bottom: 1px solid #ddd;
}



/* --- Messages 💬 (alignés à gauche du bouton) --- */
.msg-wrapper {
  position: relative;
  display: inline-block;
  z-index: 2000;
  background-color: #000 :;
}

.msg-dropdown {
  display: none;
  position: absolute;
  top: 120%;   /* un peu sous le bouton */
  left: -50px;     /* commence pile au bord gauche */
  transform: none; /* supprime tout centrage hérité */
  background: #fff;
  min-width: 250px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.15);
  color: #000;
  z-index: 3000;
}


    /* Typing indicator dots */
    .typing-indicator {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-left: 10px;
      height: 20px;
    }

    .typing-indicator .dot {
      width: 6px;
      height: 6px;
      background-color: #bbb;
      border-radius: 50%;
      animation: bounce 1.2s infinite;
      font-size: 18px;
    }

    .typing-indicator .dot:nth-child(2) {
      animation-delay: 0.2s;
    }

    .typing-indicator .dot:nth-child(3) {
      animation-delay: 0.4s;
    }

    @keyframes bounce {
      0%, 80%, 100% { transform: scaleY(0.6); opacity: 0.5; }
      40% { transform: scaleY(1.2); opacity: 1; }
    }

    /* Avatar */
    .message > .avatar {
      width: 35px;
      height: 35px;
      border-radius: 50%;
      border: 2px solid #1877f2;
      flex-shrink: 0;
    }

    /* Images envoyées */
    .message-text .chat-image img {
      max-width: 240px;
      max-height: 240px;
      border-radius: 10px;
      cursor: pointer;
      transition: transform 0.2s ease;
      display: block;
      margin-top: 6px;
    }

    .message-text .chat-image img:hover {
      transform: scale(1.05);
    }

    /* Inbox list */
    .inbox-item {
      padding: 10px;
      border-radius: 10px;
      margin-bottom: 8px;
      background: #f0f2f5;
      transition: 0.2s;
    }

    .inbox-item:hover {
      background: #e4e6eb;
    }


    /* Animations */
    @keyframes fadeSlideInLeft {
      from { opacity: 0; transform: translateX(-20px); }
      to { opacity: 1; transform: translateX(0); }
    }

    @keyframes fadeSlideInRight {
      from { opacity: 0; transform: translateX(20px); }
      to { opacity: 1; transform: translateX(0); }
    }

    /* Responsive : sur mobile, image prend toute la largeur */
@media (max-width: 600px) {
  .message-text .chat-image img {
    max-width: 100%;
    height: auto;
  }
}


/* Date separator */
/* Séparateur de date - style pro */
.date-separator {
  display: inline-block;
  margin: 24px auto;
  padding: 6px 14px;
  color: #95a6bb;
  background-color: #edf2f7;
  border-radius: 5px;
    box-shadow: 0 8px 15px rgba(32, 33, 36, 0.12), 0 4px 6px rgba(32, 33, 36, 0.08);
  text-align: center;
  user-select: none;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  -ms-border-radius: 5px;
  -o-border-radius: 5px;
}


/* 📷 Preview image avant envoi */
#imagePreview {
  margin-top: 10px;
  display: flex;
  justify-content: center;   /* ✅ centre horizontalement */
  align-items: center;       /* ✅ centre verticalement si plusieurs lignes */
  flex-wrap: wrap;
  gap: 12px;
}

#imagePreview .img-preview-card {
  position: relative;        
  display: inline-block;
}

#imagePreview .img-preview-pic {
  max-width: 160px;
  max-height: 160px;
  border-radius: 10px;
  border: 2px solid #ddd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  display: block;
}

#imagePreview .img-preview-cancel {
  position: absolute;
  top: -8px;
  right: -8px;
  background: red;
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.2s;
}

#imagePreview .img-preview-cancel:hover {
  background: darkred;
}


/* video iframe */
/* ✅ Rendre les vidéos responsives */
.message-text iframe {
  max-width: 100%;   /* jamais plus large que le conteneur */
  width: 100%;       /* prend toute la largeur dispo */
  height: auto;      /* ajuste la hauteur automatiquement */
  border-radius: 8px;
}




/* 📱 Sur petits écrans (< 600px par exemple) */
@media (max-width: 600px) {
  main {
    max-width: 100%;      /* ✅ prend toute la largeur */
    width: 100%;          /* garde full width */
    height: 100vh;
  }
}
