/* Humanibot — couleurs logo HCW (#28a745, #1e7e34, #111) */

.hcw-chat {
  position: fixed;
  bottom: 5.25rem;
  right: 1rem;
  z-index: 9999;
  font-family: inherit;
}

/* Bouton flottant — tête humaine */
.hcw-chat__toggle {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: transparent;
  box-shadow: 0 8px 28px rgba(40, 167, 69, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  opacity: 0.88;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease;
}

.hcw-chat__toggle:hover {
  transform: scale(1.1) rotate(-3deg);
  box-shadow: 0 12px 36px rgba(40, 167, 69, 0.5);
  opacity: 1;
}

.hcw-chat__toggle-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(40, 167, 69, 0.35);
  animation: humanibotPulse 2.5s ease-in-out infinite;
}

@keyframes humanibotPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}

.hcw-chat__toggle-face {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: none;
}

.hcw-chat.is-open .hcw-chat__toggle {
  transform: scale(0.92);
}

.hcw-chat.is-open .hcw-chat__toggle-ring {
  animation: none;
  opacity: 0;
}

/* Panneau */
.hcw-chat__panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: min(340px, calc(100vw - 1.5rem));
  max-height: min(480px, calc(100vh - 8rem));
  background: white;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(17, 17, 17, 0.2);
  border: 2px solid rgba(40, 167, 69, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
}

.hcw-chat.is-open .hcw-chat__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.hcw-chat__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
  color: white;
}

.hcw-chat__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  flex-shrink: 0;
  border: none;
  overflow: hidden;
}

.hcw-chat__avatar-img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.hcw-chat__header-text strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.hcw-chat__header-text span {
  font-size: 0.68rem;
  opacity: 0.92;
  line-height: 1.3;
  display: block;
  margin-top: 0.15rem;
}

.hcw-chat__close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.hcw-chat__close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.hcw-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f9fcf9;
  min-height: 190px;
}

@media (max-width: 576px) {
  .hcw-chat {
    bottom: 4.75rem;
    right: 0.75rem;
  }

  .hcw-chat__toggle {
    width: 50px;
    height: 50px;
  }

  .hcw-chat__panel {
    width: min(320px, calc(100vw - 1rem));
    max-height: min(440px, calc(100vh - 7.5rem));
  }
}

.hcw-chat__msg {
  max-width: 92%;
  font-size: 0.84rem;
  line-height: 1.55;
  animation: chatFadeIn 0.3s ease;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hcw-chat__msg--bot {
  align-self: flex-start;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  max-width: 95%;
}

.hcw-chat__msg-face {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50%;
  flex-shrink: 0;
  border: none;
}

.hcw-chat__msg-body {
  background: white;
  color: #222;
  border: 1px solid #dce9de;
  border-bottom-left-radius: 4px;
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
}

.hcw-chat__msg-body a {
  color: #1e7e34;
  font-weight: 700;
}

.hcw-chat__msg-body a:hover {
  color: #28a745;
}

.hcw-chat__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #28a745, #1e7e34);
  color: white;
  border-bottom-right-radius: 4px;
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
}

.hcw-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.65rem;
  background: #f9fcf9;
}

.hcw-chat__quick button {
  padding: 0.35rem 0.65rem;
  border-radius: 100px;
  border: 1.5px solid #28a745;
  background: white;
  color: #1e7e34;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.hcw-chat__quick button:hover {
  background: #28a745;
  color: white;
}

.hcw-chat__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #dce9de;
  background: white;
}

.hcw-chat__input {
  flex: 1;
  border: 1.5px solid #dce9de;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
}

.hcw-chat__input:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.hcw-chat__send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #28a745;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.hcw-chat__send:hover {
  background: #1e7e34;
}

.hcw-chat__send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@media (max-width: 480px) {
  .hcw-chat {
    bottom: 0.85rem;
    right: 0.85rem;
  }

  .hcw-chat__panel {
    width: calc(100vw - 1.5rem);
    right: -0.35rem;
  }

  .hcw-chat__toggle {
    width: 58px;
    height: 58px;
  }

  .hcw-chat__toggle-face {
    width: 46px !important;
    height: 46px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hcw-chat__panel,
  .hcw-chat__msg,
  .hcw-chat__toggle-ring {
    animation: none;
    transition: none;
  }
}
