/* BODY et BACKGROUND */
body {
  font-family: 'Poppins', sans-serif;
  background: #000; 
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease;
  color: white;
}

h1 {
  margin: 0;
  font-size: 26px;
  margin-bottom: 10px;
  padding-left: 10px;
}

#start-message {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #fff;
  text-align: center;
  padding: 20px;
}


@property --glow-deg {
  syntax: "<angle>";
  inherits: true;
  initial-value: -90deg;
}

@property --clr-1 { syntax: "<color>"; inherits: true; initial-value: #ff0000; }
@property --clr-2 { syntax: "<color>"; inherits: true; initial-value: #ffcc00; }
@property --clr-3 { syntax: "<color>"; inherits: true; initial-value: #00ff00; }
@property --clr-4 { syntax: "<color>"; inherits: true; initial-value: #00ccff; }
@property --clr-5 { syntax: "<color>"; inherits: true; initial-value: #ff00ff; }

/* CONTAINER PRINCIPAL */
#app-container {
  position: relative;
  display: flex;
  width: 800px;
  height: 700px;
  border: 3px solid transparent;
  border-radius: 16px;
  background: linear-gradient(#111 0 0) padding-box,
              conic-gradient(from var(--glow-deg), var(--clr-1), var(--clr-2), var(--clr-3), var(--clr-4), var(--clr-5), var(--clr-1)) border-box;
  overflow: hidden;
  isolation: isolate;
  animation: glow 10s linear infinite;
}


#app-container::before,
#app-container::after {
  content: "";
  position: absolute;
  border-radius: inherit;
}

#app-container::before {
  z-index: -1;
  background: #111;
  inset: 0.5rem;
  scale: 1.05 1;
  transform-origin: center;
  filter: blur(1rem);
}

#app-container::after {
  z-index: -2;
  inset: -1.5rem;
  background: conic-gradient(from var(--glow-deg), var(--clr-1), var(--clr-2), var(--clr-3), var(--clr-4), var(--clr-5), var(--clr-1));
  filter: blur(1rem);
  opacity: 0.2;
}

@keyframes glow {
  0% { --glow-deg: -90deg; }
  100% { --glow-deg: 270deg; }
}

/* COLONNE CONTACTS */
#contacts-column {
  width: 30%;
  background: #111;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow-y: auto;
}

#search-wrapper {
  display: flex;
  align-items: center;
  
  padding: 5px 10px;
  
  margin-bottom: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.506);
}

#contact-search {
  flex: 1;
  padding: 6px 10px;
  border: none;
  
  
  outline: none;
  font-size: 14px;
  background: #111;
  color: white;
}

#contact-search::placeholder {
  color: #888;
}

#search-wrapper i {
  color: #888;
  
}

.contact {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.3s;
}

.contact:hover {
  background: #222; 
}

.contact.selected {
  
  color: white;
  border: #00ccff 2px solid;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

.contact-name {
  font-size: 16px;
  font-weight: bold;
}

/* COLONNE CHAT */
#chat-column {
  width: 70%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #111;
}

#placeholder {
  flex: 1;
  display: flex;
  flex-direction: column; 
  justify-content: center; 
  align-items: center;     
  color: rgb(255, 255, 255);
  font-size: 12px;
  text-align: center;
  padding: 20px;
  
}



.profile-wrapper {
  position: relative;
  display: inline-block;
}

/* Badge en ligne */
.online-badge {
  position: absolute;
  bottom: 0;
  right: 4px;
  width: 12px;
  height: 12px;
  background-color: #4caf50; 
  border: 2px solid #111;    
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}


/* MESSAGES */
#messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.message {
  max-width: 70%;
  padding: 10px 15px;
  margin: 5px 0;
  border-radius: 20px;      
  word-wrap: break-word;
  display: flex;
  flex-direction: column;    
  align-items: flex-start;   
  position: relative;
  font-size: 14px;
  background: #222;          
  color: #fff;
}

/* Bulles utilisateur */
.message.user {
  background: #007bff;
  color: white;
  align-self: flex-end;
  border-radius: 20px;   
  border-bottom-right-radius: 0
}

.message.bot {
  background: #222;
  color: white;
  align-self: flex-start;
  border-radius: 20px;   
  border-bottom-left-radius: 0
}


.message-wrapper {
  display: flex;
  align-items: flex-end;
  margin: 8px 0;
  max-width: 80%;
}

.message-wrapper.bot {
  flex-direction: row;
}

.message-wrapper.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}


.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 8px;
}

.time {
  font-size: 11px;
  color: #aaa;
  margin: 0 5px;
  align-self: flex-end;
}

.status {
  font-size: 11px;
  color: #888;
  margin: 2px 5px;
}

.status.error {
  color: #ff4d4d;
}


/* Avatars dans messages */
.message img.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 8px;
}

.user img.avatar {
  margin-left: 8px;
  margin-right: 0;
}

/* INPUT AREA */
#input-area {
  display: flex;
  align-items: center;
  padding: 10px;
  border-top: 1px solid #333;
  background: #111;
}


#user-input {
  flex: 1;
  padding: 10px 15px;
  border: none;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  background: #222;
  color: white;
  transition: background 0.3s, box-shadow 0.3s;
}

#user-input:focus {
  background: #333;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}


#send-btn {
  padding: 10px 13px;
  margin-left: 8px;
  border: none;
  border-radius: 50%;
  background: #007bff;
  color: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s;
}

#send-btn:hover {
  background: #0056b3;
  transform: scale(1.1);
}

#send-btn:active {
  transform: scale(0.95);
}

#background-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(10px) brightness(0.6);      
  z-index: -1;             
  transition: background-image 0.5s ease, filter 0.3s ease;
}


#contacts-column::-webkit-scrollbar,
#messages::-webkit-scrollbar {
  width: 10px;
}


#contacts-column::-webkit-scrollbar-track,
#messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05); 
  border-radius: 10px;
}


#contacts-column::-webkit-scrollbar-thumb,
#messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.1); 
  transition: background 0.3s;
}


#contacts-column::-webkit-scrollbar-thumb:hover,
#messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}


/* --- CHAT HEADER --- */
#chat-header {
  display: none;
  align-items: center;
  padding: 10px;
  background: #111;
  border-bottom: 1px solid #333;
}

#chat-header #menu-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  margin-right: 10px;
  cursor: pointer;
}

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#chat-avatar {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-contact-info i {
  display: inline-block; 
}

#chat-name {
  font-size: 16px;
  font-weight: bold;
}


#overlay {
  position: fixed;
  top: 0;
  left: 330px; 
  width: calc(100% - 250px);
  height: 100%;
  background: rgba(237, 21, 21, 0);
  display: none;
  z-index: 10;
}


#contacts-column {
  position: relative;
  z-index: 20;
}



/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  body {
    height: 100dvh; 
  }

  #app-container {
    width: 100%;
    height: 100dvh; 
    border: none;
    border-radius: 0;
  }

  #contacts-column {
    position: absolute;
    top: 0;
    left: -100%;
    width: 70%;
    height: 100dvh; 
    background: #111;
    z-index: 10;
    transition: left 0.3s ease;
    border-right: #aaa 2px solid;
  }

  #contacts-column.open {
    left: 0;
  }

  #chat-column {
    width: 100%;
    height: 100%; 
  }

  #chat-header {
    display: flex; 
  }
}

