.gestionpro-chatbot-root {
  --gp-navy: #102542;
  --gp-navy-soft: #183153;
  --gp-gold: #c89b3c;
  --gp-cream: #f7f7f4;
  --gp-white: #ffffff;
  --gp-shadow: 0 18px 45px rgba(16, 37, 66, 0.12);
  --gp-radius: 24px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: "Segoe UI", sans-serif;
  color: #152238;
}

.gestionpro-chatbot-root * {
  box-sizing: border-box;
}

.gestionpro-chatbot-root a {
  color: inherit;
  text-decoration: none;
}

.gestionpro-chatbot-root button,
.gestionpro-chatbot-root input {
  font: inherit;
}

.gestionpro-chatbot-root .hidden {
  display: none !important;
}

.gestionpro-chatbot-root .chat-toggle,
.gestionpro-chatbot-root .chat-send,
.gestionpro-chatbot-root .message-suggestion,
.gestionpro-chatbot-root .chat-end {
  border: none;
  cursor: pointer;
}

.gestionpro-chatbot-root .chat-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(306px, calc(100vw - 24px));
  min-height: 62px;
  padding: 7px 14px 7px 78px;
  border-radius: 26px;
  text-align: left;
  background: linear-gradient(135deg, rgba(16, 37, 66, 0.96) 0%, rgba(24, 49, 83, 0.95) 58%, rgba(200, 155, 60, 0.82) 140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--gp-white);
  box-shadow: var(--gp-shadow);
  overflow: visible;
  animation: gp-bob 4s ease-in-out infinite;
}

@keyframes gp-bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.gestionpro-chatbot-root .chat-toggle:hover {
  animation-play-state: paused;
}

.gestionpro-chatbot-root .chat-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 45%),
    radial-gradient(circle at 82% 20%, rgba(240, 199, 103, 0.16), transparent 24%);
  pointer-events: none;
}

.gestionpro-chatbot-root .chat-toggle-agent {
  position: absolute;
  left: 2px;
  bottom: -1px;
  width: 66px;
  height: auto;
  display: block;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 5px 12px rgba(16, 37, 66, 0.14));
  transform-origin: bottom left;
}

.gestionpro-chatbot-root .chat-toggle-mobile-label {
  display: none !important;
}

.gestionpro-chatbot-root .chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px !important;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.gestionpro-chatbot-root .chat-toggle-copy {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 155px;
  position: relative;
  z-index: 1;
  align-content: center;
}

.gestionpro-chatbot-root .chat-toggle-copy strong {
  font-size: 0.92rem;
  line-height: 1.05;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.gestionpro-chatbot-root .chat-toggle-copy small {
  font-size: 0.72rem;
  line-height: 1.08;
  color: rgba(255, 255, 255, 0.8);
  max-width: 170px;
  white-space: nowrap;
}

.gestionpro-chatbot-root .chat-toggle-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.95rem;
  flex: 0 0 30px;
  position: relative;
  z-index: 1;
}

.gestionpro-chatbot-root .chat-window {
  width: min(440px, calc(100vw - 24px));
  height: min(600px, 80vh);
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(16, 37, 66, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.7);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gestionpro-chatbot-root .chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  color: var(--gp-white);
  background: linear-gradient(135deg, var(--gp-navy) 0%, #1c385c 100%);
  border-bottom: 2.5px solid #f0c767;
}

.gestionpro-chatbot-root .chat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gestionpro-chatbot-root .chat-header-avatar {
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.gestionpro-chatbot-root .chat-header span {
  display: block;
  font-size: 0.8rem;
  opacity: 0.85;
}

.gestionpro-chatbot-root .chat-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.gestionpro-chatbot-root .chat-close:hover {
  opacity: 1;
}

.gestionpro-chatbot-root .chat-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(circle at top right, rgba(240, 199, 103, 0.02), transparent 60%);
}

.gestionpro-chatbot-root .message-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.gestionpro-chatbot-root .message-row.user {
  justify-content: flex-end;
}

.gestionpro-chatbot-root .message-row.user .message {
  order: 1;
}

.gestionpro-chatbot-root .message-row.user .message-avatar {
  order: 2;
}

.gestionpro-chatbot-root .message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  object-fit: cover;
}

.gestionpro-chatbot-root .message-avatar.bot {
  background: rgba(16, 37, 66, 0.08);
}

.gestionpro-chatbot-root .message-avatar.user {
  background: linear-gradient(180deg, #f0c767, #c89b3c);
  color: var(--gp-navy);
  box-shadow: 0 4px 10px rgba(200, 155, 60, 0.25);
}

.gestionpro-chatbot-root .message-user-icon {
  width: 16px;
  height: 16px;
}

.gestionpro-chatbot-root .message {
  max-width: 78%;
  padding: 11px 14px;
  line-height: 1.48;
  white-space: pre-wrap;
  font-size: 0.92rem;
}

.gestionpro-chatbot-root .message.bot {
  background: #f0f3f8;
  color: var(--gp-navy);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid rgba(16, 37, 66, 0.03);
  box-shadow: 0 2px 8px rgba(16, 37, 66, 0.02);
}

.gestionpro-chatbot-root .message.user {
  background: linear-gradient(135deg, var(--gp-navy) 0%, #1e3c66 100%);
  color: var(--gp-white);
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 12px rgba(16, 37, 66, 0.1);
}

.gestionpro-chatbot-root .message-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(16, 37, 66, 0.1);
  background: rgba(255, 255, 255, 0.95);
  color: var(--gp-navy);
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(16, 37, 66, 0.04);
  transition: all 0.2s ease;
}

.gestionpro-chatbot-root .message-link:hover {
  background: var(--gp-navy);
  color: var(--gp-white);
  border-color: var(--gp-navy);
  box-shadow: 0 6px 16px rgba(16, 37, 66, 0.15);
}

.gestionpro-chatbot-root .message.bot .message-link {
  color: var(--gp-navy);
}

.gestionpro-chatbot-root .message-link::after {
  content: "↗";
  font-size: 0.85rem;
  line-height: 1;
}

.gestionpro-chatbot-root .message.typing {
  display: flex;
  align-items: center;
  gap: 8px;
  font-style: normal;
  opacity: 0.88;
  padding: 12px 18px;
  width: fit-content;
  max-width: 70px;
  justify-content: center;
}

.gestionpro-chatbot-root .message-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 38px;
  width: calc(100% - 38px);
}

.gestionpro-chatbot-root .message-suggestion {
  border: 1px solid rgba(16, 37, 66, 0.1);
  background: rgba(255, 255, 255, 0.95);
  color: var(--gp-navy);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 37, 66, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gestionpro-chatbot-root .message-suggestion:hover {
  transform: translateY(-2px);
  background: var(--gp-navy);
  color: var(--gp-white);
  border-color: var(--gp-navy);
  box-shadow: 0 10px 20px rgba(16, 37, 66, 0.15);
}

.gestionpro-chatbot-root .chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 20px 8px;
  padding: 4px 6px 4px 16px;
  border: 1px solid rgba(16, 37, 66, 0.12);
  border-radius: 999px;
  background: #f5f7fa;
  transition: all 0.2s ease;
}

.gestionpro-chatbot-root .chat-form:focus-within {
  border-color: var(--gp-navy);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 37, 66, 0.1);
}

.gestionpro-chatbot-root .chat-form input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 8px 0 !important;
  color: var(--gp-navy);
  font-size: 0.92rem;
  box-shadow: none !important;
  outline: none !important;
}

.gestionpro-chatbot-root .chat-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gp-navy) 0%, #1e3c66 100%);
  color: var(--gp-white);
  border: none;
  box-shadow: 0 2px 8px rgba(16, 37, 66, 0.12);
  transition: all 0.2s ease;
  cursor: pointer;
}

.gestionpro-chatbot-root .chat-send-icon {
  display: block !important;
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0 !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
  fill: none !important;
  transform: translate(-1px, 0.5px) !important;
  transition: transform 0.2s ease !important;
}

.gestionpro-chatbot-root .chat-send:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 10px rgba(16, 37, 66, 0.2);
}

.gestionpro-chatbot-root .chat-scroll-bottom {
  position: absolute;
  bottom: 124px;
  right: 20px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(16, 37, 66, 0.12);
  color: var(--gp-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 37, 66, 0.15);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1;
  transform: scale(1);
}

.gestionpro-chatbot-root .chat-scroll-bottom.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8) translateY(10px);
}

.gestionpro-chatbot-root .chat-scroll-bottom:hover {
  background: #f5f7fa;
  transform: scale(1.05);
}

.gestionpro-chatbot-root .chat-footer {
  padding: 0 20px 16px;
  background: #fff;
}

.gestionpro-chatbot-root .chat-end {
  width: fit-content;
  border: 1px solid rgba(16, 37, 66, 0.12);
  border-radius: 999px;
  padding: 8px 16px;
  background: #f5f7fa;
  color: var(--gp-navy);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.gestionpro-chatbot-root .chat-end:hover {
  background: #eef1f6;
  border-color: rgba(16, 37, 66, 0.2);
}
}

@keyframes gestionpro-chatbot-bounce {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* TYPING INDICATOR — Trois points animés quand l'IA réfléchit */
.gestionpro-chatbot-root .typing-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.gestionpro-chatbot-root .typing-label {
  display: block;
  margin-top: 6px;
  color: var(--gp-navy);
  font-size: 0.8rem;
  line-height: 1.25;
  opacity: 0.8;
}

.gestionpro-chatbot-root .typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(16, 37, 66, 0.55);
  animation: gp-typing-bounce 1.2s infinite ease-in-out;
}

.gestionpro-chatbot-root .typing-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.gestionpro-chatbot-root .typing-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes gp-typing-bounce {
  0%, 80%, 100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@media (max-width: 640px) {
  .gestionpro-chatbot-root {
    right: 14px;
    bottom: 14px;
  }

  .gestionpro-chatbot-root .chat-toggle {
    width: 76px;
    min-height: 56px;
    height: 56px;
    border-radius: 18px;
    padding: 0 9px 0 0;
    justify-content: flex-end;
    gap: 0;
    margin-bottom: 0;
    overflow: visible !important;
    transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1), padding 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s ease, box-shadow 0.18s ease;
  }

  .gestionpro-chatbot-root .chat-toggle-agent {
    left: 5px;
    bottom: 0;
    width: 56px;
  }

  .gestionpro-chatbot-root .chat-toggle-mobile-label {
    position: absolute;
    top: -46px;
    left: 20px;
    display: inline-flex !important;
    transform: translateX(-10%);
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(16, 37, 66, 0.94);
    color: #ffffff;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    box-shadow: 0 6px 16px rgba(16, 37, 66, 0.18);
    pointer-events: none;
    z-index: 3;
  }

  .gestionpro-chatbot-root .chat-toggle-mobile-label::after {
    content: "";
    position: absolute;
    left: 20px;
    bottom: -5px;
    width: 10px;
    height: 10px;
    background: rgba(16, 37, 66, 0.94);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
  }

  .gestionpro-chatbot-root .chat-toggle-copy {
    display: none !important;
    min-width: 0;
  }

  .gestionpro-chatbot-root .chat-toggle.mobile-expanded {
    width: min(272px, calc(100vw - 84px));
    padding: 8px 12px 8px 72px;
    justify-content: space-between;
  }

  .gestionpro-chatbot-root .chat-toggle.mobile-expanded .chat-toggle-mobile-label {
    opacity: 0;
  }

  .gestionpro-chatbot-root .chat-toggle.mobile-expanded .chat-toggle-copy {
    display: grid !important;
    gap: 2px;
    min-width: 0;
    align-content: center;
    animation: toggleCopyIn 0.22s ease;
  }

  .gestionpro-chatbot-root .chat-toggle.mobile-expanded .chat-toggle-copy strong,
  .gestionpro-chatbot-root .chat-toggle.mobile-expanded .chat-toggle-copy small {
    white-space: nowrap;
  }

  .gestionpro-chatbot-root .chat-toggle.mobile-expanded .chat-toggle-arrow {
    display: grid;
  }

  .gestionpro-chatbot-root .chat-toggle-arrow {
    display: none;
  }

  .gestionpro-chatbot-root .chat-window {
    width: min(440px, calc(100vw - 24px));
    height: min(720px, 88vh);
  }
}

@keyframes toggleCopyIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
