/**
 * CHATBOT WELLCONSEIL - CSS
 * ✅ Compatible Hostinger
 * ✅ Responsive mobile/tablet/desktop
 * ✅ Pur CSS vanille
 */

/* ============================================================
   VARIABLES DESIGN WELLCONSEIL
   ============================================================ */
:root {
  --chatbot-navy: #242454;
  --chatbot-terra: #24cca8;
  --chatbot-terra-dark: #1aa08a;
  --chatbot-blanc: #ffffff;
  --chatbot-fond: #f6f7fb;
  --chatbot-texte: #1a1c35;
  --chatbot-gris: #8a8faa;
  --chatbot-gris-light: #d8daea;
  --chatbot-ombre: 0 4px 28px rgba(13, 31, 53, 0.12);
  --chatbot-tr: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   BOUTON FLOTTANT - TOGGLE
   ============================================================ */
.chatbot-btn-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--chatbot-terra) 0%, var(--chatbot-terra-dark) 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--chatbot-blanc);
  box-shadow: var(--chatbot-ombre);
  z-index: 999;
  transition: all var(--chatbot-tr);
}

.chatbot-btn-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(36, 204, 168, 0.35);
}

.chatbot-btn-toggle:active {
  transform: scale(0.95);
}

/* Badge notification */
.chatbot-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4757;
  color: white;
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--chatbot-blanc);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ============================================================
   WIDGET PRINCIPAL
   ============================================================ */
.chatbot-widget {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 600px;
  background: var(--chatbot-blanc);
  border-radius: 16px;
  box-shadow: var(--chatbot-ombre);
  display: flex;
  flex-direction: column;
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all var(--chatbot-tr) ease;
  overflow: hidden;
}

.chatbot-widget.active,
.chatbot-widget.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0px) scale(1);
}

/* ============================================================
   HEADER
   ============================================================ */
.chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-navy) 0%, #3a4070 100%);
  color: var(--chatbot-blanc);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-close-btn {
  background: none;
  border: none;
  color: var(--chatbot-blanc);
  cursor: pointer;
  font-size: 20px;
  padding: 0 4px;
  transition: transform var(--chatbot-tr);
  line-height: 1;
}

.chatbot-close-btn:hover {
  transform: rotate(90deg);
}

/* ============================================================
   ZONE MESSAGES
   ============================================================ */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--chatbot-fond);
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--chatbot-gris-light);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: var(--chatbot-terra);
}

/* ============================================================
   MESSAGES UTILISATEUR
   ============================================================ */
.chat-message {
  display: flex;
  animation: slideIn 0.3s ease;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message.user p {
  background: var(--chatbot-navy);
  color: var(--chatbot-blanc);
  padding: 10px 14px;
  border-radius: 12px 12px 2px 12px;
  max-width: 80%;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  box-shadow: 0 2px 8px rgba(36, 36, 84, 0.15);
}

/* ============================================================
   MESSAGES BOT
   ============================================================ */
.chat-message.bot {
  justify-content: flex-start;
}

.chat-message.bot p {
  background: var(--chatbot-blanc);
  color: var(--chatbot-texte);
  padding: 10px 14px;
  border-radius: 12px 12px 12px 2px;
  border-left: 3px solid var(--chatbot-terra);
  max-width: 85%;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-message.bot a {
  color: var(--chatbot-terra);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--chatbot-terra);
  cursor: pointer;
  transition: color var(--chatbot-tr);
}

.chat-message.bot a:hover {
  color: var(--chatbot-terra-dark);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   INPUT ZONE
   ============================================================ */
.chatbot-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--chatbot-blanc);
  border-top: 1px solid var(--chatbot-gris-light);
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  border: 1px solid var(--chatbot-gris-light);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--chatbot-texte);
  transition: all var(--chatbot-tr);
  outline: none;
  background: var(--chatbot-blanc);
}

.chatbot-input::placeholder {
  color: var(--chatbot-gris);
}

.chatbot-input:focus {
  border-color: var(--chatbot-terra);
  box-shadow: 0 0 0 3px rgba(36, 204, 168, 0.1);
}

.chatbot-send-btn {
  background: var(--chatbot-terra);
  border: none;
  color: var(--chatbot-blanc);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--chatbot-tr);
  flex-shrink: 0;
  font-weight: bold;
}

.chatbot-send-btn:hover {
  background: var(--chatbot-terra-dark);
  transform: scale(1.05);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* ============================================================
   BOUTONS RAPIDES
   ============================================================ */
.chatbot-quick-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px;
  background: var(--chatbot-fond);
  border-top: 1px solid var(--chatbot-gris-light);
  flex-shrink: 0;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quick-btn {
  background: var(--chatbot-blanc);
  border: 1px solid var(--chatbot-gris-light);
  border-radius: 8px;
  padding: 12px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--chatbot-texte);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transition: all var(--chatbot-tr);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.quick-btn:hover {
  background: var(--chatbot-fond);
  border-color: var(--chatbot-terra);
  color: var(--chatbot-terra);
  transform: translateY(-2px);
}

.quick-btn:active {
  transform: translateY(0);
}

.quick-btn-text {
  text-align: center;
  line-height: 1.4;
}

/* ============================================================
   RESPONSIVE - TABLET (768px et moins)
   ============================================================ */
@media (max-width: 768px) {
  .chatbot-widget {
    width: calc(100vw - 32px);
    height: 500px;
    bottom: 80px;
    right: 16px;
    left: 16px;
  }

  .chat-message.user p,
  .chat-message.bot p {
    max-width: 100%;
  }

  .chatbot-quick-buttons {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 10px 12px;
  }

  .quick-btn {
    font-size: 11px;
    padding: 8px 10px;
    gap: 4px;
  }

  .quick-btn-icon {
    font-size: 14px;
  }

  .chatbot-btn-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
    bottom: 20px;
    right: 20px;
  }
}

/* ============================================================
   RESPONSIVE - MOBILE (480px et moins)
   ============================================================ */
@media (max-width: 480px) {
  .chatbot-widget {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    left: 0;
    border-radius: 0;
    max-height: 100vh;
  }

  .chatbot-header {
    padding: 12px 16px;
  }

  .chatbot-title {
    font-size: 13px;
    gap: 8px;
  }

  .chatbot-messages {
    padding: 12px;
    gap: 10px;
  }

  .chat-message.user p,
  .chat-message.bot p {
    font-size: 12px;
  }

  .chatbot-input-area {
    padding: 10px 12px;
    gap: 6px;
  }

  .chatbot-input {
    padding: 8px 12px;
    font-size: 12px;
  }

  .chatbot-send-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .chatbot-quick-buttons {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px 12px;
  }

  .quick-btn {
    font-size: 10px;
    padding: 8px 10px;
  }

  .quick-btn-icon {
    font-size: 14px;
  }

  .chatbot-btn-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
    bottom: 16px;
    right: 16px;
  }
}

/* ============================================================
   ACCESSIBILITÉ
   ============================================================ */
.quick-btn:focus-visible,
.chatbot-send-btn:focus-visible,
.chatbot-input:focus-visible,
.chatbot-close-btn:focus-visible {
  outline: 2px solid var(--chatbot-terra);
  outline-offset: 2px;
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
  .chatbot-widget {
    background: #1a1d3a;
  }

  .chatbot-messages {
    background: #15182a;
  }

  .chatbot-input {
    background: #20233d;
    border-color: #3a4070;
    color: #f0f0f0;
  }

  .chatbot-input::placeholder {
    color: #8a8faa;
  }

  .chat-message.bot p {
    background: #20233d;
    color: #f0f0f0;
  }

  .chatbot-quick-buttons {
    background: #15182a;
  }

  .quick-btn {
    background: #20233d;
    border-color: #3a4070;
    color: #f0f0f0;
  }

  .quick-btn:hover {
    background: #282d45;
  }
}

/* ============================================================
   ANIMATION OUVERTURE
   ============================================================ */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chatbot-widget.active {
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Désactiver animations pour utilisateurs qui le demandent */
@media (prefers-reduced-motion: reduce) {
  .chatbot-widget,
  .chatbot-btn-toggle,
  .chat-message,
  .quick-btn {
    animation: none !important;
    transition: none !important;
  }
}
.chatbot-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 20px 16px;   /* top: 12px | sides: 16px | bottom: 20px */
  background: var(--chatbot-blanc);
  border-top: 1px solid var(--chatbot-gris-light);
  flex-shrink: 0;
}

.chatbot-input-container .chatbot-input {
  flex: 1;
  min-width: 0;
}

.chatbot-input-container .chatbot-send-btn {
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .chatbot-input-container {
    padding: 10px 12px 18px 12px;   /* zayed espace mn taht f mobile */
    gap: 6px;
  }
}