/* SUPPRIMER les transitions CSS lentes */
.chat-body, .chat-input,.chat-header, .chat-header-option, .chat-session-end, 
.chat-session-new, .chat-mail, .whatsapp_chat_support, .chat-screen {
    transition: none !important;
}
/* Container des étoiles */
        .rating-stars {
            display: flex;
            justify-content: center;
            gap: 5px;
            margin-top: 15px;
            /* Suppression de direction: rtl */
        }

        /* Style des étoiles */
        .rating-stars button {
            background: none;
            border: none;
            color: #ccc; /* Couleur de base (grise) */
            font-size: 24px;
            cursor: pointer;
            transition: color 0.2s;
            outline: none;
        }

        .chat-session-new{
          padding: 20px;
          text-align: center;
          font-family: Arial, sans-serif;
        }

        .chat-session-new p {
            font-size: 16px;
            color: #333;
            margin-bottom: 20px;
            line-height: 1.4;
        }

        .start-new-chat-btn {
          background-color: #007bff;
          color: #fff;
          border: none;
          padding: 12px 24px;
          border-radius: 8px;
          font-size: 14px;
          cursor: pointer;
          transition: background-color 0.3s ease, transform 0.2s ease;
        }

        .start-new-chat-btn:hover {
          background-color: #0056b3;
          transform: translateY(-2px);
        }

        /* Étoiles sélectionnées après clic */
        .rating-stars button.selected {
            color: #FFD700; /* Or pour la sélection permanente */
        }

        /* Section de fin de chat */
        .chat-session-end {
            display: block; /* Visible pour la démo */
            padding: 20px;
            text-align: center;
        }

        .chat-session-end h5 {
            color: #4CAF50;
            margin-bottom: 10px;
        }

        .chat-session-end p {
            color: #666;
            font-size: 14px;
        }

        /* Zone commentaire */
        #rating-comment {
            width: 100%;
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 10px;
            resize: vertical;
            font-size: 14px;
            box-sizing: border-box;
            margin-top: 10px;
            min-height: 80px;
        }

        /* Bouton d'envoi */
        #submit-rating {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            background-color: #4CAF50;
            color: white;
            transition: background-color 0.3s;
            margin-top: 10px;
        }

        #submit-rating:hover {
            background-color: #45a049;
        }

        .demo-info {
            background: #e3f2fd;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            border-left: 4px solid #2196f3;
        }

        .current-rating {
            margin-top: 15px;
            text-align: center;
            font-weight: bold;
            color: #333;
        }

/*
 * ==========================================================
 * CHAT - CSS AMÉLIORÉ
 * ==========================================================
 */

/* Définition des variables pour une maintenance facile */
:root {
  --primary-color: #db2f69;
  --secondary-color: #683db8;
  --bg-light: #fbfbfb;
  --bg-message-user: #ecf1f8;
  --text-color: #7a7a7a;
  --text-dark: #333;
  --border-color: #f8f8f8;
  --radius-sm: 5px;
  --radius-md: 10px;
  --radius-lg: 15px;
  --shadow-main: 0px 15px 20px rgba(0, 0, 0, 0.1);
  --shadow-popup: 0 0.125rem 0.25rem rgba(165, 163, 174, 0.3);
}

/* Styles globaux et utilitaires */
.hide {
  display: none !important;
}

.recording {
  color: red !important;
}

/* Styles pour le conteneur principal du chat */
.chat-screen {
  position: fixed;
  bottom: 68px;
  right: 60px;
  z-index: 99999;
  width: 350px;
  background: white;
  box-sizing: border-box;
  border-radius: 0.375rem;
  box-shadow: var(--shadow-main);
  visibility: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease-in-out;
}

.chat-screen.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  bottom: 82px;
}

/* En-tête du chat */
.chat-screen .chat-header {
  background: linear-gradient(135deg, #ff6b35 0%, #ff8e53 100%);
  border-radius: 0.375rem 0.375rem 0 0;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-screen .chat-header .chat-header-title {
  color: white;
  font-size: 14px;
  font-weight: 500;
}

.chat-screen .chat-header .chat-header-option {
  color: white;
}

.chat-screen .chat-header .chat-header-option .dropdown #dropdownMenuLink i {
  color: white;
}

/* Corps du chat */
.chat-screen .chat-body {
  padding: 25px 25px 0px;
  min-height: 400px;
  max-height: 382px;
  background: var(--bg-light);
  overflow-y: auto;
  position: relative;
  /* Retrait du pseudo-élément de fond pour une meilleure performance et flexibilité */
}

/* Message de début de chat */
.chat-screen .chat-body .chat-start {
  border: 1px solid #f8d4ff;
  width: fit-content;
  border-radius: 50px;
  padding: 6px 15px;
  font-size: 12px;
  margin: 0 auto 15px;
  text-align: center;
  background: white;
}

/* Liens dans le chat */
.chat-screen .chat-body a {
  pointer-events: auto;
  z-index: 10;
  color: #007bff;
  text-decoration: underline;
  position: relative;
}

/* Conteneur pour la saisie de texte */
.chat-screen .chat-input {
  display: flex;
  position: relative;
  margin-top: -5px;
}

.chat-screen .chat-input input {
  width: 100%;
  background: white;
  padding: 15px 70px 15px 15px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 1px solid var(--border-color);
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: var(--text-color);
  font-weight: normal;
  font-size: 13px;
  transition: border-color 0.3s ease;
}

.chat-screen .chat-input input:focus {
  border-color: #f9dcff;
  outline: none;
}

.chat-screen .chat-input .input-action-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-screen .chat-input .input-action-icon a {
  cursor: pointer;
}

.chat-screen .chat-input .input-action-icon svg {
  height: 17px;
  width: 17px;
  color: #a9a9a9;
  transition: color 0.3s ease;
}

.chat-screen .chat-input input:focus + .input-action-icon svg.feather-send {
  color: var(--secondary-color);
}

/* Zone d'enregistrement et de transcription */
.chat-input .recording-text {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  color: red;
  font-size: 13px;
}

.chat-input #stop-recording {
  position: absolute;
  right: 65px;
  top: 50%;
  transform: translateY(-50%);
  background-color: red;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: none;
  z-index: 1;
  transition: background-color 0.3s ease;
}

.chat-input #stop-recording:hover {
  background-color: darkred;
}

.chat-screen .transcriptions {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
  max-width: 80%;
  width: 400px;
  z-index: 9999;
}

.chat-screen .transcriptions p {
  margin-bottom: 15px;
}

.chat-screen .transcriptions input[type="email"] {
  margin: 2px 0;
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
}

.chat-screen .transcriptions .trans-alert {
  height: 16px;
  margin: 0;
  transition: height 0.3s ease;
  overflow: hidden;
  color: rgb(217, 51, 17);
  font-size: 0.75rem;
  font-weight: normal;
}

.chat-screen .transcriptions button.btn-close {
  position: absolute;
  top: 10px;
  right: 10px;
  transform: translate(23px, -25px);
  background-color: white;
  border-radius: 0.375rem;
  opacity: 1;
  padding: 0.44rem;
  box-shadow: var(--shadow-popup);
  transition: all 0.23s ease;
  border: none;
}
.chat-screen .powered-by {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
}

/* Bouton de chat WhatsApp */
.whatsapp_chat_support {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
}

.wcs_button_label {
  cursor: pointer;
  display: inline-block;
  font-size: 12px;
  margin-right: 10px;
  background: #d4f3e6;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.wcs_button {
  text-align: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background:linear-gradient(135deg, #26AE61, #1d8f50);
  color: white;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.wcs_button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.wcs_button .fas {
  font-size: 25px;
}

.show .wcs_button_label {
  opacity: 0;
  visibility: hidden;
}

.wcs_button_circle .animate {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Styles pour les messages de chat */
.chat-message-group {
  display: flex;
  margin-bottom: 15px;
  align-items: flex-start;
  gap: 10px;
}

.chat-message-group .chat-thumb {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.chat-message-group .chat-thumb img {
  border-radius: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-message-group .chat-messages {
  flex-grow: 1;
}

.chat-message-group .msg {
  padding: 10px 15px;
  background: var(--bg-message-user);
  font-size: 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
  word-wrap: break-word;
  word-break: break-word;
}

.chat-messages .from {
  display: block;
  font-size: 11px;
  color: #999;
  margin-bottom: 5px;
}

/* Styles pour les messages de l'utilisateur (à droite) */
.writer-user {
  flex-direction: row-reverse;
}

.writer-user .chat-messages {
  text-align: right;
}

.writer-user .chat-messages .msg {
  background: var(--secondary-color);
  color: white;
}

.writer-user .chat-messages .from {
  text-align: right;
}

/* Images dans les messages */
.msg img {
  max-width: 150px;
  border-radius: var(--radius-sm);
}

/* Indicateur de frappe */
.chat-messages .dot-container {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-message-user);
  border-radius: 15px;
  padding: 8px 12px;
}

.chat-messages .dot {
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background-color: #aaa;
  animation: typingDots 1.2s infinite linear;
}

.chat-messages .dot:nth-child(1) {
  animation-delay: 0s;
}

.chat-messages .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-messages .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDots {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-2px);
    opacity: 1;
  }
}


@media (max-width: 768px) {
  /* Le chat prend toute la largeur de l'écran sur mobile */
  .chat-screen {
    width: 100%;
    right: 0;
    bottom: 0;
    border-radius: 0;
    transform: translateY(0);
  }

  /* Le bouton de chat WhatsApp se déplace sur la gauche et est plus petit */
  .whatsapp_chat_support {
    bottom: 10px;
    right: auto;
    left: 10px;
  }

  .wcs_button {
    width: 45px;
    height: 45px;
  }

  .wcs_button .fas {
    font-size: 20px;
  }

  /* Le message d'enregistrement et le bouton d'arrêt sont réajustés */
  .chat-input .recording-text {
    left: 15px;
  }

  .chat-input #stop-recording {
    right: 50px; /* Ajusté pour éviter le chevauchement avec l'icône d'envoi */
  }

  /* Le conteneur du chat s'adapte à l'écran */
  .chat-screen .chat-body {
    max-height: calc(100vh - 120px); /* Ajuste la hauteur pour que l'écran soit visible */
    min-height: auto;
  }

  .chat-screen .chat-input input {
    border-radius: 0; /* Pas de coins arrondis en bas sur mobile */
  }

  .chat-screen .transcriptions {
    width: 90%;
  }
}