#mxchat-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 999998;
  transition: transform 0.15s ease;
}
#mxchat-bubble:hover { transform: scale(1.08); }
#mxchat-bubble.mxchat-pulse { animation: mxchat-pulse 1.2s infinite; }
@keyframes mxchat-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(88,101,242,0.6); }
  70%  { box-shadow: 0 0 0 14px rgba(88,101,242,0); }
  100% { box-shadow: 0 0 0 0 rgba(88,101,242,0); }
}

#mxchat-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 340px;
  height: 460px;
  max-height: 70vh;
  background: #17181f;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#mxchat-header {
  background: #5865f2;
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#mxchat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
#mxchat-logo {
  width: 20px;
  height: auto;
  color: #fff;
  flex-shrink: 0;
}
#mxchat-close {
  cursor: pointer;
  opacity: 0.85;
  display: flex;
  align-items: center;
  padding: 4px;
}
#mxchat-close:hover { opacity: 1; }

#mxchat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mxchat-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.mxchat-out {
  align-self: flex-end;
  background: #5865f2;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mxchat-in {
  align-self: flex-start;
  background: #2a2d38;
  color: #e6e8ef;
  border-bottom-left-radius: 4px;
}

#mxchat-inputzone {
  display: flex;
  border-top: 1px solid #262b36;
  flex-shrink: 0;
}
#mxchat-input {
  flex: 1;
  border: none;
  background: #0d0f13;
  color: #e6e8ef;
  padding: 12px;
  font-size: 16px; /* 16px minimum pour éviter le zoom auto iOS Safari */
  outline: none;
}
#mxchat-send {
  background: #5865f2;
  color: #fff;
  border: none;
  padding: 0 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#mxchat-send:hover { background: #6f7bfa; }

/* --- Responsive mobile : plein écran --- */
@media (max-width: 600px) {
  #mxchat-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  #mxchat-header {
    padding-top: max(14px, env(safe-area-inset-top));
  }
  #mxchat-inputzone {
    padding-bottom: env(safe-area-inset-bottom);
  }
  #mxchat-bubble {
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(20px, env(safe-area-inset-right));
  }
  /* cache la bulle quand le panel plein écran est ouvert */
  body.mxchat-open #mxchat-bubble {
    display: none;
  }
}
