/* WhatsApp floating widget — style CongoCloud / WeCreativez template 6 */

#wws-layout-6 {
  --wws-brand: #095e54;
  --wws-brand-dark: #064e46;
  --wws-wa: #25d366;
  --wws-text: #444;
  --wws-muted: #777;
  --wws-soft: #f5f5f5;
  --wws-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);

  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999999;
  width: auto;
  max-width: calc(100vw - 24px);
  font-family: "Source Sans Pro", system-ui, -apple-system, sans-serif;
  opacity: 1;
  visibility: visible;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  box-sizing: border-box;
  pointer-events: none;
}

#wws-layout-6 .wws-popup__footer,
#wws-layout-6 .wws-popup.wws-active,
#wws-layout-6 .wws-popup[data-wws-popup-status="1"] {
  pointer-events: auto;
}

#wws-layout-6 *,
#wws-layout-6 *::before,
#wws-layout-6 *::after {
  box-sizing: border-box;
}

#wws-layout-6.wws-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

#wws-layout-6:not(.wws-scrolled) .wws-popup__footer {
  opacity: 0.94;
}

.wws-gradient {
  z-index: -1;
  position: fixed;
  width: min(500px, 100vw);
  height: min(500px, 100vh);
  pointer-events: none;
  display: none;
  bottom: 0;
  right: 0;
  background: radial-gradient(ellipse at bottom right, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
}

.wws-clearfix {
  clear: both;
}

.wws-shadow {
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

/* ---- Bouton flottant (pastille comme CongoCloud) ---- */
.wws-popup__footer {
  margin-top: 12px;
  pointer-events: auto;
}

.wws-popup__open-btn {
  float: right;
  display: inline-flex !important;
  align-items: center;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px !important;
  margin: 0 !important;
  border: none;
  border-radius: 24px !important;
  background: var(--wws-brand) !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 24px rgba(9, 94, 84, 0.35) !important;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  width: auto !important;
  height: auto !important;
  max-width: min(320px, calc(100vw - 32px));
  pointer-events: auto;
}

.wws-popup__open-btn:hover {
  background: var(--wws-brand-dark) !important;
}

@media (hover: hover) and (pointer: fine) {
  .wws-popup__open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(9, 94, 84, 0.42) !important;
  }
}

.wws-popup__open-btn:active {
  transform: translateY(0);
}

.wws-popup__open-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: currentColor;
}

.wws-popup__open-btn span {
  display: inline !important;
  max-width: none !important;
  opacity: 1 !important;
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wws-popup.wws-active,
.wws-popup[data-wws-popup-status="1"] {
  pointer-events: auto;
}

/* ---- Carte popup : slideDown / slideUp comme CongoCloud ---- */
.wws-popup {
  display: none;
  position: relative;
  width: 100%;
  max-width: 320px;
  margin-bottom: 0;
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
}

.wws-popup__close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--wws-brand) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

.wws-popup__close-btn:hover {
  background: #fff !important;
}

@media (hover: hover) and (pointer: fine) {
  .wws-popup__close-btn:hover {
    transform: scale(1.06);
  }
}

.wws-popup__close-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Corps */
.wws-popup__body {
  padding: 0;
  background: transparent;
  overflow: visible;
}

.wws-popup__support-wrapper {
  position: relative;
  margin-top: 0;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  box-shadow: var(--wws-shadow);
}

.wws-popup__support {
  width: 100%;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
}

.wws-popup__support-about {
  background: var(--wws-brand) !important;
  color: #fff !important;
  text-align: center;
  padding: 20px 16px;
  line-height: 1.45;
  font-size: 15px;
  font-weight: 500;
  user-select: none;
  border-radius: 10px 10px 0 0;
}

.wws-popup__support-about::after {
  display: none;
}

/* Liste agents — fond blanc */
.wws-popup__support-person-container {
  background: #fff;
  border-radius: 0 0 10px 10px;
  box-shadow: var(--wws-shadow);
  overflow: hidden;
}

.wws-popup__support-person-wrapper {
  padding: 12px 10px;
  min-height: 100px;
  max-height: 250px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wws-popup__support-person-wrapper::-webkit-scrollbar {
  width: 6px;
}

.wws-popup__support-person-wrapper::-webkit-scrollbar-thumb {
  background: rgba(9, 94, 84, 0.25);
  border-radius: 999px;
}

.wws-popup__support-person {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 7px 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wws-popup__support-person:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.wws-popup__support-person:hover {
  background: #f8fafc;
}

@media (hover: hover) and (pointer: fine) {
  .wws-popup__support-person:hover {
    border-radius: 8px;
  }
}

.wws-popup__support-person-img-wrapper {
  width: 54px;
  height: 54px;
  position: relative;
  overflow: hidden;
  margin-right: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.wws-popup__support-person-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.wws-popup__support-person-available,
.wws-popup__support-person-away {
  position: absolute;
  z-index: 2;
  bottom: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  box-shadow: none;
}

.wws-popup__support-person-available {
  background: #00c853;
}

.wws-popup__support-person-away {
  background: #ffd600;
}

.wws-popup__support-person-info-wrapper {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wws-popup__support-person-title {
  color: #777;
  font-size: 13px;
  line-height: 1.2;
  margin-bottom: 0;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.wws-popup__support-person-title:empty {
  display: none;
}

.wws-popup__support-person-name {
  color: #444;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}

.wws-popup__support-person-status {
  margin-top: 4px;
  display: block;
  width: auto;
  max-width: 100%;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #999;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.wws-popup__support-person:not(.is-offline) .wws-popup__support-person-status {
  color: #999;
  font-weight: 400;
}

.wws-popup__support-person.is-offline {
  opacity: 1;
  cursor: not-allowed;
  background: transparent;
  border-color: #f1f5f9;
  box-shadow: none;
}

.wws-popup__support-person.is-offline:hover {
  background: #f8fafc;
  box-shadow: none;
  border-color: #f1f5f9;
}

.wws-popup__support-person.is-offline .wws-popup__support-person-img {
  filter: none;
  opacity: 1;
}

.wws-popup__support-person.is-offline .wws-popup__support-person-status {
  color: #999;
  font-size: 12px;
  font-weight: 400;
}

/* Formulaire (écran message) */
.wws-popup__support-person-form {
  display: none;
  padding: 16px 12px;
  background-color: #ece5dd;
  background-image:
    linear-gradient(180deg, rgba(236, 229, 221, 0.92) 0%, rgba(236, 229, 221, 0.88) 100%),
    url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
  background-size: auto, 360px;
  background-repeat: repeat;
  min-height: 180px;
}

.wws-popup__support-person-form.is-loading {
  display: block;
}

.wws-popup__support-person-form.is-ready {
  animation: wws-form-in 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.wws-popup__support-person-form.is-leaving {
  animation: wws-form-out 0.18s ease forwards;
}

.wws-popup__support-person-wrapper.is-hiding {
  animation: wws-list-out 0.22s ease forwards;
  pointer-events: none;
}

.wws-popup__support-person-wrapper.is-entering {
  animation: wws-list-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.wws-popup__support-person.is-activating {
  animation: wws-card-press 0.28s ease;
}

@keyframes wws-card-press {
  0% { transform: scale(1); }
  45% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@keyframes wws-list-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-12px); }
}

@keyframes wws-list-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes wws-form-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes wws-form-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(16px); }
}

@keyframes wws-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  100% { transform: translateX(0); }
}

.wws-shake-animation {
  animation: wws-shake 300ms;
}

/* Spinner CongoCloud */
.wws-spinner {
  margin: 56px auto 40px;
  width: 70px;
  text-align: center;
}

.wws-spinner > div {
  width: 14px;
  height: 14px;
  margin: 0 3px;
  background-color: var(--wws-brand);
  border-radius: 100%;
  display: inline-block;
  animation: wws-sk-bouncedelay 1.2s infinite ease-in-out both;
}

.wws-spinner .wws-bounce1 {
  animation-delay: -0.32s;
}

.wws-spinner .wws-bounce2 {
  animation-delay: -0.16s;
}

@keyframes wws-sk-bouncedelay {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.wws-popup__support-person-back,
.wws-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 30px;
  margin-bottom: 12px;
  cursor: pointer;
  background: var(--wws-brand);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wws-form-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.wws-form-header h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--wws-brand);
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.wws-contact-form {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.wws-contact-form .form-group {
  margin-bottom: 12px;
}

.wws-contact-form .form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
  font-size: 13px;
}

.wws-contact-form .form-group input,
.wws-contact-form .form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  color: #333;
}

.wws-contact-form .form-group textarea {
  resize: vertical;
  min-height: 90px;
}

.wws-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--wws-brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wws-submit-btn:hover {
  background: var(--wws-brand-dark);
}

/* Mobile : widget + liste agents ancrés en bas à droite (CongoCloud) */
@media (max-width: 767px) {
  /* Bouton fermé : coin bas droit */
  #wws-layout-6 {
    right: 12px;
    left: auto;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    align-items: flex-end;
    flex-direction: column;
    justify-content: flex-end;
  }

  .wws-popup__footer {
    margin-top: 10px;
    width: auto;
    flex-shrink: 0;
  }

  .wws-popup__open-btn {
    float: none;
    width: auto !important;
    max-width: min(280px, calc(100vw - 32px));
    padding: 10px 14px !important;
    justify-content: center;
    border-radius: 999px !important;
  }

  .wws-popup__open-btn span {
    white-space: nowrap;
    text-align: left;
    font-size: 13px !important;
  }

  /* Ouverture : grand panneau bas, quasi plein largeur */
  .wws-popup {
    width: min(380px, calc(100vw - 24px));
    max-width: min(380px, calc(100vw - 24px));
    flex-shrink: 0;
  }

  .wws-popup[data-wws-popup-status="1"],
  .wws-popup.wws-active {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
  }

  .wws-popup__body,
  .wws-popup__support-wrapper,
  .wws-popup__support,
  .wws-popup__support-person-container,
  .wws-popup__support-person-form {
    width: 100%;
    max-width: 100%;
  }

  .wws-popup__support-about {
    font-size: 14px;
    padding: 16px 12px;
    line-height: 1.45;
  }

  .wws-popup__support-person-wrapper {
    max-height: min(340px, 55vh);
    padding: 10px 8px;
    -webkit-overflow-scrolling: touch;
  }

  .wws-popup__support-person {
    padding: 7px 0;
  }

  .wws-popup__support-person-img-wrapper {
    width: 46px;
    height: 46px;
    margin-right: 10px;
  }

  .wws-popup__support-person-name {
    font-size: 14px;
  }

  .wws-popup__support-person-title {
    font-size: 12px;
  }

  .wws-popup__support-person-status {
    font-size: 11px;
    padding: 0;
  }
}
