/* Boutons flottants WhatsApp + chatbot (e-com) */

.contact-float {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

body:not(.ecom-invoice-body) .progress-wrap {
  right: 92px;
  bottom: 28px;
}

.contact-float__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.contact-float__btn:hover,
.contact-float__btn:focus {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  color: #fff;
  text-decoration: none;
  outline: none;
}

.contact-float__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
}

.contact-float__label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 8px;
  background: #222;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.contact-float__label::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-left-color: #222;
}

.contact-float__btn:hover .contact-float__label,
.contact-float__btn:focus .contact-float__label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.contact-float__btn--whatsapp {
  background: #25d366;
}

.contact-float__btn--whatsapp:hover,
.contact-float__btn--whatsapp:focus {
  background: #1ebe57;
}

.contact-float__btn--chat {
  background: #ff8b00;
}

.contact-float__btn--chat:hover,
.contact-float__btn--chat:focus {
  background: #e67d00;
}

.contact-float__btn--chat.is-open {
  background: #1a1a1d;
}

.contact-chatbot {
  position: fixed;
  right: 18px;
  bottom: 160px;
  z-index: 1081;
  width: min(340px, calc(100vw - 28px));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform-origin: var(--genie-ox, 100%) var(--genie-oy, 120%);
  transform: translate3d(0, 0, 0) scale(0.04);
  clip-path: polygon(47% 100%, 53% 100%, 53% 100%, 47% 100%);
  backface-visibility: hidden;
}

.contact-chatbot[hidden] {
  display: none !important;
}

.contact-chatbot.is-animating {
  visibility: visible;
}

.contact-chatbot.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0) scale(1);
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.contact-chatbot.is-opening {
  animation: ecom-genie-open 0.72s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.contact-chatbot.is-closing {
  animation: ecom-genie-close 0.62s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes ecom-genie-open {
  0% {
    opacity: 0.25;
    transform: translate3d(0, 0, 0) scale(0.04);
    clip-path: polygon(47% 100%, 53% 100%, 54% 100%, 46% 100%);
  }
  18% {
    opacity: 0.55;
    transform: translate3d(0, 0, 0) scale(0.18);
    clip-path: polygon(34% 78%, 66% 78%, 62% 100%, 38% 100%);
  }
  38% {
    opacity: 0.82;
    transform: translate3d(0, 0, 0) scale(0.42);
    clip-path: polygon(16% 42%, 84% 42%, 74% 100%, 26% 100%);
  }
  58% {
    opacity: 0.95;
    transform: translate3d(0, 0, 0) scale(0.72);
    clip-path: polygon(4% 14%, 96% 14%, 100% 100%, 0% 100%);
  }
  78% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(0.94);
    clip-path: polygon(0% 2%, 100% 2%, 100% 100%, 0% 100%);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  }
}

@keyframes ecom-genie-close {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  }
  18% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(0.94);
    clip-path: polygon(0% 2%, 100% 2%, 100% 100%, 0% 100%);
  }
  40% {
    opacity: 0.92;
    transform: translate3d(0, 0, 0) scale(0.68);
    clip-path: polygon(4% 14%, 96% 14%, 100% 100%, 0% 100%);
  }
  62% {
    opacity: 0.7;
    transform: translate3d(0, 0, 0) scale(0.38);
    clip-path: polygon(16% 42%, 84% 42%, 74% 100%, 26% 100%);
  }
  82% {
    opacity: 0.35;
    transform: translate3d(0, 0, 0) scale(0.14);
    clip-path: polygon(34% 78%, 66% 78%, 62% 100%, 38% 100%);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.04);
    clip-path: polygon(47% 100%, 53% 100%, 54% 100%, 46% 100%);
  }
}

.contact-chatbot__panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.contact-chatbot__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  background: #fff;
  color: #222;
  border-bottom: 1px solid #ececec;
}

.contact-chatbot__avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff8b00;
  color: #fff;
  font-size: 18px;
}

.contact-chatbot__meta {
  flex: 1;
  min-width: 0;
}

.contact-chatbot__meta strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.contact-chatbot__meta span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #6b7280;
}

.contact-chatbot__close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #555;
  cursor: pointer;
  transition: background 0.15s ease;
}

.contact-chatbot__close:hover {
  background: #e5e7eb;
  color: #222;
}

.contact-chatbot__body {
  padding: 16px 16px 0;
  background: transparent;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.contact-chatbot__scroll {
  padding-bottom: 16px;
  background: linear-gradient(180deg, #f7f7f7 0%, #f0f0f0 100%);
  min-height: 160px;
  max-height: 280px;
  overflow-y: auto;
}

.contact-chatbot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 0 16px;
}

.contact-chatbot__new-wrap {
  padding: 12px 16px 0;
}

.contact-chatbot__new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #ff8b00;
  background: #fff;
  color: #ff8b00;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.contact-chatbot__new-btn:hover {
  background: #ff8b00;
  color: #fff;
}

.contact-chatbot__form[hidden] {
  display: none !important;
}

.contact-chatbot__bubble {
  display: inline-block;
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  color: #333;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-top: 10px;
}

.contact-chatbot__bubble:first-child {
  margin-top: 0;
}

.contact-chatbot__bubble--client {
  display: block;
  margin-left: auto;
  border-radius: 14px 14px 4px 14px;
  background: #ff8b00;
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 139, 0, 0.25);
}

.contact-chatbot__bubble--staff {
  display: block;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  color: #222;
}

.contact-chatbot__bubble--system,
.contact-chatbot__bubble--bot {
  display: block;
  background: #fff;
  color: #444;
}

.contact-chatbot__bubble--system {
  background: #fff8ef;
  border: 1px solid #ffe0b8;
  color: #6a4a1a;
  font-size: 12px;
}

.contact-chatbot__bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  border: 1px solid #ececec;
  color: #6b7280;
  font-size: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.contact-chatbot__typing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #ececec;
  color: #6b7280;
  font-size: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.contact-chatbot__typing[hidden] {
  display: none !important;
}

.contact-chatbot__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.contact-chatbot__typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .35;
  animation: contact-chat-typing-bounce 1.2s infinite ease-in-out;
}

.contact-chatbot__typing-dots i:nth-child(2) {
  animation-delay: .15s;
}

.contact-chatbot__typing-dots i:nth-child(3) {
  animation-delay: .3s;
}

@keyframes contact-chat-typing-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: .35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.contact-chatbot__chip {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e4e4e4;
  color: #333;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.contact-chatbot__chip:hover {
  border-color: #ff8b00;
  color: #ff8b00;
  background: #fff8ef;
  text-decoration: none;
}

.contact-chatbot__form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #ececec;
  background: #fff;
}

.contact-chatbot__form input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.contact-chatbot__form input:focus {
  border-color: #ff8b00;
}

.contact-chatbot__form button {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #ff8b00;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.contact-chatbot__form button:hover {
  background: #e67d00;
  transform: scale(1.04);
}

@media (max-width: 767px) {
  .contact-float {
    right: 12px;
    bottom: 18px;
    gap: 10px;
  }

  .contact-float__btn {
    width: 52px;
    height: 52px;
  }

  .contact-float__icon {
    font-size: 24px;
  }

  .contact-float__label {
    display: none;
  }

  .contact-chatbot {
    right: 12px;
    bottom: 148px;
    width: calc(100vw - 24px);
  }

  body:not(.ecom-invoice-body) .progress-wrap {
    right: 80px;
    bottom: 22px;
  }
}

@media print {
  .contact-float,
  .contact-chatbot {
    display: none !important;
  }
}

body.ecom-invoice-body .contact-float,
body.ecom-invoice-body .contact-chatbot {
  display: none !important;
}
