body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  color: #f1f5f9;
  overflow: hidden;
}

#container {
  display: flex;
  height: 100%;
  backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.1);
  padding: 12px;
  gap: 12px;
}

#channels {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

#chat {
  flex: 2;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

#messages {
  flex: 1;
  border: none;
  max-height: 80%;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 24px;
  background: linear-gradient(145deg, #1e293b, #334155);
  border-radius: 16px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.3);
  overflow-wrap: break-word;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 transparent;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #3b82f6, #1d4ed8);
  border-radius: 3px;
}

#messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #2563eb, #1e40af);
}

#scroll-to-bottom {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  bottom: 160px;
  right: 30px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  color: white;
  font-size: 18px;
  z-index: 100;
}

#scroll-to-bottom:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

#scroll-to-bottom img {
  vertical-align: middle;
  cursor: pointer;
  filter: brightness(0) invert(1);
}

form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(30, 41, 59, 0.8);
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

input, button, textarea {
  padding: 8px 12px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(51, 65, 85, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #f1f5f9;
}

select {
  padding: 8px 12px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  background: rgba(51, 65, 85, 0.8);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #f1f5f9;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 4px 16px rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
  background: rgba(51, 65, 85, 0.9);
}

/*input[type="file"]*/
input[type="file"] {
  padding: 8px 12px;
  max-width: 220px;
  font-size: 14px;
}

button:not(.icon-del) {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

button:not(.icon-del)::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:not(.icon-del):hover::before {
  left: 100%;
}

.sens-btns {
  height: 36px;
  width: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

button:hover:not(.icon-del) {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

#file-button {
  background: linear-gradient(135deg, #64748b, #475569);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 12px;
}

#file-button:hover {
  background: linear-gradient(135deg, #475569, #334155);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(100, 116, 139, 0.3);
}

#file-button img {
  vertical-align: middle;
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

#boutons {
  display: flex;
  gap: 10px;
}

#channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#channel-list li {
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(51, 65, 85, 0.8), rgba(71, 85, 105, 0.6));
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  color: #e2e8f0;
}

#channel-list li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(29, 78, 216, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

#channel-list li:hover {
  background: linear-gradient(145deg, rgba(71, 85, 105, 0.9), rgba(100, 116, 139, 0.7));
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
  color: #f1f5f9;
}

#channel-list li:hover::before {
  opacity: 1;
}

#channel-list li.selected {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.8), rgba(29, 78, 216, 0.6));
  border-color: rgba(59, 130, 246, 0.6);
  color: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}


button.icon-del {
  background: linear-gradient(135deg, #64748b, #475569);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

button.icon-del:hover {
  background: linear-gradient(135deg, #475569, #334155);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
  border-color: rgba(59, 130, 246, 0.4);
}

textarea {
  flex: 1;
  resize: none;
  background: rgba(51, 65, 85, 0.8);
  border: 2px solid transparent;
  min-height: 36px;
  line-height: 1.5;
  color: #f1f5f9;
}

img:not(#send-btn) {
  height: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  max-height: 320px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

img:not(#send-btn):hover {
  transform: scale(1.02);
}

video {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

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

.popup h1 {
  /*affiche les elements a la verticale*/
  color: #fff;
  font-size: 24px;
}

.popup p {
  color: #fff;
  font-size: 16px;
}

.progress-bar {
  display: none;
  width: 100%;
  height: 8px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 12px;
  margin-top: 16px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#upload-progress {
  height: 23px;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 12px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
  padding-left: 5px;
  text-align: center;
}

#upload-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

#share-channel-button {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: auto;
  height: 40px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

#share-channel-button:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.user_id {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px 16px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(51, 65, 85, 0.9), rgba(71, 85, 105, 0.8));
  color: #e2e8f0;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.user_id:hover {
  background: linear-gradient(145deg, rgba(71, 85, 105, 1), rgba(100, 116, 139, 0.9));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
  color: #f1f5f9;
}

.small_text {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 5px;
}

.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.popup-content .close {
  position: absolute;
  top: 0px;
  right: 10px;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  font-weight: bold;
}

.popup-content {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
  backdrop-filter: blur(20px);
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  position: relative;
  max-width: 400px;
  margin: 20px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popup-content h1 {
  color: #f1f5f9;
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 600;
}

.popup-content p {
  color: #cbd5e1;
  margin: 12px 0;
  line-height: 1.6;
}

.popup-content .close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  color: #94a3b8;
  font-weight: bold;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.popup-content .close:hover {
  color: #f1f5f9;
  background: rgba(59, 130, 246, 0.2);
}

.popup-content .answers {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.popup-content .answer-button {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 14px;
}

.popup-content .answer-button:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}



/* Responsive Design */
@media (max-width: 768px) {
  #container {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
  }

  #channels {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 0;
  }

  #chat {
    display: none;
    padding: 16px;
    border-radius: 16px;
  }

  #chat.show {
    display: flex;
  }

  #messages {
    max-height: 400px;
    padding: 16px;
  }

  form {
    gap: 6px;
    padding: 10px;
  }

  input, button, textarea {
    font-size: 13px;
    padding: 8px 12px;
  }

  #share-channel-button {
    position: static;
    margin-bottom: 16px;
    align-self: flex-start;
  }

  #scroll-to-bottom {
    bottom: 120px;
    right: 20px;
    width: 40px;
    height: 40px;
  }

  /* Ajouter un bouton pour ouvrir le chat sur mobile */
  .mobile-chat-toggle {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .mobile-chat-toggle:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
  }
}

@media (min-width: 769px) {
  .mobile-chat-toggle {
    display: none;
  }
}

@media (max-width: 480px) {
  body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  #container {
    padding: 4px;
    gap: 4px;
  }

  #channels, #chat {
    padding: 12px;
    border-radius: 12px;
  }

  #messages {
    padding: 12px;
    max-height: 300px;
  }

  form {
    gap: 6px;
    padding: 8px;
  }

  input, button, textarea {
    font-size: 12px;
    padding: 6px 10px;
  }

  .popup-content {
    margin: 16px;
    padding: 20px;
    max-width: 90vw;
  }

  .popup-content .answers {
    flex-direction: column;
    gap: 8px;
  }

  #channel-list li {
    padding: 10px 12px;
    margin: 6px 0;
  }

  .mobile-chat-toggle {
    padding: 10px;
    margin-top: 12px;
    font-size: 14px;
  }
}


.modal-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
  backdrop-filter: blur(20px);
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 300px;
  max-width: 500px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  animation: slideIn 0.3s ease-out;
}

.modal-content input {
  font-size: 16px;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(51, 65, 85, 0.8);
  color: #f1f5f9;
  transition: all 0.3s ease;
}

.modal-content input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.modal-content button {
  font-size: 16px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.modal-content button[type="submit"] {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
}

.modal-content button[type="submit"]:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px);
}

.modal-content button[type="button"] {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
}

.modal-content button[type="button"]:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
  transform: translateY(-2px);
}

.error-message {
  color: #f8b4b4;
  font-size: 14px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(71, 85, 105, 0.3);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.success-message {
  color: #86efac;
  font-size: 14px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

#back-to-channels {
  color: #d3e2f0;
}