/* ===========================================
   Welcome Host Chatbot Widget v3
   Brand: Teal #008091, Green #9beabc
   =========================================== */

:root {
  --wh-teal: #008091;
  --wh-teal-dark: #006a78;
  --wh-teal-light: #00a0b4;
  --wh-green: #9beabc;
  --wh-green-light: #c4f2d8;
  --wh-white: #ffffff;
  --wh-gray-50: #f9fafb;
  --wh-gray-100: #f3f4f6;
  --wh-gray-200: #e5e7eb;
  --wh-gray-300: #d1d5db;
  --wh-gray-500: #6b7280;
  --wh-gray-700: #374151;
  --wh-gray-900: #111827;
  --wh-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  --wh-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --wh-radius: 16px;
  --wh-font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --wh-red: #ef4444;
}

/* ===== BUBBLE ===== */
#wh-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wh-teal), var(--wh-teal-dark));
  border: none;
  cursor: pointer;
  box-shadow: var(--wh-shadow);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#wh-chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 48px rgba(0, 128, 145, 0.45);
}
#wh-chat-bubble svg { width: 28px; height: 28px; fill: var(--wh-white); }
#wh-chat-bubble.wh-open svg.wh-icon-chat { display: none; }
#wh-chat-bubble.wh-open svg.wh-icon-close { display: block; }
#wh-chat-bubble svg.wh-icon-close { display: none; }

/* Pulse activé quand teaser visible */
#wh-chat-bubble.wh-pulse {
  animation: wh-pulse 2s infinite;
}
@keyframes wh-pulse {
  0%, 100% { transform: scale(1); box-shadow: var(--wh-shadow); }
  50% { transform: scale(1.12); box-shadow: 0 10px 50px rgba(0, 128, 145, 0.55); }
}

#wh-chat-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--wh-red); color: white;
  font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
  font-family: var(--wh-font); border: 2px solid white;
}

/* ===== TEASER ===== */
#wh-chat-teaser {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: var(--wh-teal);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--wh-shadow);
  z-index: 99998;
  font-family: var(--wh-font);
  font-size: 14px;
  color: var(--wh-white);
  font-weight: 500;
  max-width: 280px;
  display: none;
  animation: wh-slide-in 0.4s ease;
  cursor: pointer;
}
@keyframes wh-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#wh-chat-teaser::after {
  content: '';
  position: absolute; bottom: -8px; right: 28px;
  width: 16px; height: 16px;
  background: var(--wh-teal);
  transform: rotate(45deg);
}
#wh-chat-teaser-close {
  position: absolute; top: 4px; right: 8px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.7); font-size: 16px; line-height: 1;
}
#wh-chat-teaser-close:hover { color: var(--wh-white); }

/* ===== CHAT WINDOW ===== */
#wh-chat-window {
  position: fixed;
  bottom: 100px; right: 24px;
  width: 400px; max-width: calc(100vw - 48px);
  height: 580px; max-height: calc(100vh - 140px);
  border-radius: var(--wh-radius);
  background: var(--wh-white);
  box-shadow: var(--wh-shadow);
  z-index: 99998;
  display: none; flex-direction: column;
  overflow: hidden;
  font-family: var(--wh-font);
  animation: wh-slide-up 0.3s ease;
}
#wh-chat-window.wh-visible { display: flex; }

@keyframes wh-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes wh-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER ===== */
#wh-chat-header {
  background: linear-gradient(135deg, var(--wh-teal), var(--wh-teal-dark));
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
#wh-chat-header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative;
}
#wh-chat-header-avatar svg { width: 22px; height: 22px; fill: var(--wh-white); }
#wh-chat-header-avatar::after {
  content: ''; position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--wh-green); border: 2px solid var(--wh-teal-dark);
  animation: wh-dot-pulse 2s infinite;
}
@keyframes wh-dot-pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}
#wh-chat-header-info { flex: 1; }
#wh-chat-header-title {
  color: var(--wh-white); font-size: 15px; font-weight: 600; margin: 0;
}
#wh-chat-header-status {
  color: var(--wh-green-light); font-size: 12px; margin-top: 1px;
}
#wh-chat-restart {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
  transition: all 0.2s; line-height: 1;
}
#wh-chat-restart:hover { color: var(--wh-white); background: rgba(255,255,255,0.15); }

/* ===== MESSAGES ===== */
#wh-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--wh-gray-50); scroll-behavior: smooth;
}
#wh-chat-messages::-webkit-scrollbar { width: 4px; }
#wh-chat-messages::-webkit-scrollbar-track { background: transparent; }
#wh-chat-messages::-webkit-scrollbar-thumb { background: var(--wh-gray-300); border-radius: 10px; }

.wh-message {
  max-width: 85%; padding: 11px 14px;
  border-radius: 14px; font-size: 14px; line-height: 1.5;
  word-wrap: break-word; animation: wh-fade-in 0.3s ease;
}
.wh-message-bot {
  background: var(--wh-white); color: var(--wh-gray-900);
  align-self: flex-start; border-bottom-left-radius: 4px;
  box-shadow: var(--wh-shadow-sm);
}
.wh-message-user {
  background: linear-gradient(135deg, var(--wh-teal), var(--wh-teal-dark));
  color: var(--wh-white); align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.wh-message-bot a { color: var(--wh-teal); text-decoration: underline; }
.wh-message-bot strong { font-weight: 600; }
.wh-message-time {
  font-size: 10px; color: var(--wh-gray-500);
  margin-top: 4px; display: block;
}

/* ===== QUICK REPLIES ===== */
.wh-quick-replies {
  display: flex; flex-wrap: wrap; gap: 7px;
  align-self: flex-start; max-width: 92%;
  animation: wh-fade-in 0.4s ease;
}
.wh-quick-reply-btn {
  background: var(--wh-white); color: var(--wh-teal);
  border: 1.5px solid var(--wh-teal); border-radius: 20px;
  padding: 7px 14px; font-size: 13px; font-family: var(--wh-font);
  cursor: pointer; transition: all 0.2s ease; font-weight: 500;
  line-height: 1.3;
}
.wh-quick-reply-btn:hover {
  background: var(--wh-teal); color: var(--wh-white);
  transform: translateY(-1px); box-shadow: var(--wh-shadow-sm);
}
.wh-quick-reply-back {
  border-color: var(--wh-gray-300); color: var(--wh-gray-500);
  font-size: 12px;
}
.wh-quick-reply-back:hover {
  background: var(--wh-gray-200); color: var(--wh-gray-700);
  border-color: var(--wh-gray-300);
}

/* ===== TYPING ===== */
.wh-typing {
  display: flex; align-items: center; gap: 4px;
  padding: 11px 14px; background: var(--wh-white);
  border-radius: 14px; border-bottom-left-radius: 4px;
  align-self: flex-start; box-shadow: var(--wh-shadow-sm);
}
.wh-typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--wh-gray-300);
  animation: wh-typing-bounce 1.4s infinite ease-in-out;
}
.wh-typing-dot:nth-child(1) { animation-delay: 0s; }
.wh-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wh-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes wh-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); background: var(--wh-gray-300); }
  30% { transform: translateY(-5px); background: var(--wh-teal); }
}

/* ===== LEAD FORM ===== */
.wh-lead-form {
  background: var(--wh-white); border-radius: 12px;
  padding: 14px; align-self: flex-start; max-width: 90%;
  box-shadow: var(--wh-shadow-sm); animation: wh-fade-in 0.4s ease;
  border: 1.5px solid var(--wh-green);
}
.wh-lead-form-title {
  font-size: 13px; font-weight: 600; color: var(--wh-teal);
  margin-bottom: 10px;
}
.wh-lead-form input, .wh-lead-form textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--wh-gray-200);
  border-radius: 8px; font-size: 13px; font-family: var(--wh-font);
  margin-bottom: 8px; outline: none; box-sizing: border-box;
}
.wh-lead-form input:focus, .wh-lead-form textarea:focus { border-color: var(--wh-teal); }
.wh-lead-form input::placeholder, .wh-lead-form textarea::placeholder { color: var(--wh-gray-500); }
.wh-lead-form-submit {
  width: 100%; padding: 10px; border: none; border-radius: 8px;
  background: var(--wh-teal); color: white; font-size: 13px;
  font-weight: 600; font-family: var(--wh-font); cursor: pointer;
  transition: background 0.2s;
}
.wh-lead-form-submit:hover { background: var(--wh-teal-dark); }
.wh-lead-form-alt {
  text-align: center; margin-top: 6px; margin-bottom: 4px;
  font-size: 11px; color: var(--wh-gray-500); font-family: var(--wh-font);
}
.wh-lead-form-alt a {
  color: var(--wh-teal); text-decoration: underline; font-weight: 500;
}
.wh-lead-form-alt a:hover { color: var(--wh-teal-dark); }
.wh-lead-form-skip {
  display: block; text-align: center; margin-top: 4px;
  font-size: 11px; color: var(--wh-gray-500); cursor: pointer;
  background: none; border: none; font-family: var(--wh-font);
}
.wh-lead-form-skip:hover { color: var(--wh-gray-700); }

/* ===== INPUT AREA ===== */
#wh-chat-input-area {
  padding: 10px 14px; border-top: 1px solid var(--wh-gray-200);
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--wh-white); flex-shrink: 0;
}
#wh-chat-input {
  flex: 1; border: 1.5px solid var(--wh-gray-200);
  border-radius: 12px; padding: 9px 12px;
  font-size: 14px; font-family: var(--wh-font);
  resize: none; min-height: 40px; max-height: 100px;
  line-height: 1.4; outline: none; color: var(--wh-gray-900);
}
#wh-chat-input::placeholder { color: var(--wh-gray-500); }
#wh-chat-input:focus { border-color: var(--wh-teal); }

#wh-chat-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--wh-teal); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.2s, transform 0.2s;
}
#wh-chat-send:hover { background: var(--wh-teal-dark); transform: scale(1.05); }
#wh-chat-send:disabled { background: var(--wh-gray-300); cursor: not-allowed; }
#wh-chat-send svg { width: 17px; height: 17px; fill: var(--wh-white); }

/* ===== FOOTER ===== */
#wh-chat-footer {
  text-align: center; padding: 5px;
  font-size: 10px; color: var(--wh-gray-500);
  background: var(--wh-white); flex-shrink: 0;
}
#wh-chat-footer a { color: var(--wh-teal); text-decoration: none; }

/* ===== MOBILE ===== */
@media (max-width: 480px) {
  #wh-chat-window {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100%;
    border-radius: 0;
  }
  #wh-chat-bubble { bottom: 16px; right: 16px; width: 56px; height: 56px; }
  #wh-chat-teaser { display: none !important; }
}
