/* ============================================================
   CE WhatsApp Popup v1.1 – Styles
   ============================================================ */

:root {
  --wa-green:      #25D366;
  --wa-green-dark: #128C7E;
  --wa-surface:    #F0F2F5;
  --wa-text:       #111B21;
  --wa-sub:        #667781;
  --wa-radius:     16px;
  --wa-shadow:     0 8px 32px rgba(0,0,0,.18);
  --wa-fab-size:   68px;
}

/* ── Wrapper ── */
#ce-wa-wrapper {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* ── Label clignotant ── */
#ce-wa-label-tag {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0,0,0,.72);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 6px 14px;
  color: rgba(255,255,255,.88);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  animation: ce-wa-label-blink 2.8s ease-in-out infinite;
}

.ce-wa-label-arrow {
  display: inline-block;
  color: var(--wa-green);
  animation: ce-wa-arrow-bounce 1.4s ease-in-out infinite;
}

@keyframes ce-wa-label-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}

@keyframes ce-wa-arrow-bounce {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(4px); }
}

/* ── FAB ── */
#ce-wa-fab {
  position: relative;
  width: var(--wa-fab-size);
  height: var(--wa-fab-size);
  border-radius: 50%;
  background: var(--wa-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(37,211,102,.42);
  animation: ce-wa-float 3s ease-in-out infinite;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#ce-wa-fab:hover {
  transform: scale(1.1) translateY(-2px) !important;
  box-shadow: 0 8px 32px rgba(37,211,102,.55);
  animation-play-state: paused;
}

#ce-wa-fab:active { transform: scale(.95) !important; }

@keyframes ce-wa-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

#ce-wa-fab svg {
  width: 34px;
  height: 34px;
  fill: #fff;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* Double pulse ring */
.ce-wa-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  opacity: 0;
  animation: ce-wa-pulse 2.4s ease-out infinite;
}

.ce-wa-pulse:nth-child(2) { animation-delay: .8s; }

@keyframes ce-wa-pulse {
  0%   { transform: scale(1);    opacity: .6; }
  70%  { transform: scale(1.75); opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}

/* ── Pop-up ── */
#ce-wa-popup {
  width: 320px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--wa-radius);
  box-shadow: var(--wa-shadow);
  transform-origin: bottom right;
  animation: ce-wa-in .25s cubic-bezier(.34,1.56,.64,1) forwards;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#ce-wa-popup[hidden] { display: none; }

@keyframes ce-wa-in {
  from { opacity: 0; transform: scale(.85) translateY(12px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* Header */
.ce-wa-popup-header {
  background: var(--wa-green-dark);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ce-wa-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ce-wa-avatar svg { width: 24px; height: 24px; fill: #fff; }

.ce-wa-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ce-wa-info strong {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ce-wa-info span {
  color: rgba(255,255,255,.8);
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ce-wa-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.85);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
  margin-left: auto;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}

#ce-wa-close:hover { color: #fff; }

/* Body */
.ce-wa-popup-body { padding: 16px; background: var(--wa-surface); }

.ce-wa-hint {
  font-size: 12.5px;
  color: var(--wa-sub);
  margin: 0 0 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#ce-wa-text {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid #D1D7DB;
  border-radius: 10px;
  /* 16px minimum → pas de zoom automatique iOS */
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--wa-text);
  background: #fff;
  resize: vertical;
  line-height: 1.5;
  transition: border-color .2s;
  -webkit-appearance: none;
}

#ce-wa-text:focus { outline: none; border-color: var(--wa-green); }

/* Footer */
.ce-wa-popup-footer { padding: 12px 16px 16px; background: var(--wa-surface); }

#ce-wa-send {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: var(--wa-green);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: background .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#ce-wa-send:hover  { background: var(--wa-green-dark); }
#ce-wa-send:active { transform: scale(.97); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */

/* Mobile portrait (≤ 480px) */
@media (max-width: 480px) {
  #ce-wa-wrapper {
    right: 16px;
    bottom: 16px;
  }

  #ce-wa-popup {
    width: calc(100vw - 32px);
    max-height: 75vh;
  }

  /* Label masqué : le bouton suffit sur mobile */
  #ce-wa-label-tag { display: none; }
}

/* Mobile paysage ou écrans très courts */
@media (max-height: 500px) {
  :root { --wa-fab-size: 54px; }

  #ce-wa-wrapper { bottom: 10px; right: 16px; }

  #ce-wa-popup {
    max-height: 80vh;
    width: calc(100vw - 32px);
  }

  .ce-wa-popup-header { padding: 10px 14px; }
  .ce-wa-popup-body   { padding: 10px 14px; }
  .ce-wa-popup-footer { padding: 8px 14px 12px; }
  #ce-wa-label-tag    { display: none; }
}

/* Très petits écrans (320px) */
@media (max-width: 320px) {
  #ce-wa-wrapper { right: 10px; bottom: 10px; }
  #ce-wa-popup   { width: calc(100vw - 20px); }
}
