 /* CSS de l'Assistant */
:root {
  --user-color: #007bff;
  --bot-bg: #d2e3ff;
  --user-bg: #f9f9f9;
  --text-color: #202123;
  --bg-color: #ffffff;
}

body {
  margin: 0;
  background-color: var(--bg-color);
  font-family: ui-sans-serif, -apple-system, system-ui, Segoe UI, Helvetica, Apple Color Emoji, Arial, sans-serif, Segoe UI Emoji, Segoe UI Symbol;
  color: var(--text-color);
  display: flex;
  justify-content: center;
  height: 100vh;
}

#chatbot-cap {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
}

#header {
    display: flex;
    flex-direction: column;
    align-content: center;
    align-items: center;
    width: 100%;
    max-width: 48rem;
    position: sticky;
    top : 0;z-index: 1000;
    background-color: var(--bg-color);
    box-shadow: 1px 11px 11px -8px #e7e7e7;
}
#header p {
    font-size: 0.8rem;
    margin-top: -20px;
    margin-right: -4%;
}
#entete {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
}
#entete h1 { width: 100%; text-align: center; }

#chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 48rem;
    height: 100vh;
    background: var(--bg-color);
}
#logo  { max-width: 15%;}
.bot-entete { max-width: 12%;}
#logo img {max-width:100% }

#messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background-color: var(--bg-color);
}

.message {
  display: flex;
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.message.show { opacity: 1; transform: translateY(0); }

.message .bubble {
  max-width: 90%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.message.user { justify-content: flex-end; }
.message.user .bubble { background-color: var(--user-bg); }
.message.bot, .message.erreur { justify-content: flex-start; }

.message.erreur .bubble {
    background: url(../../img/capbot-hp.png) no-repeat top left #ffd2d2;
    background-size: 32px;
    background-position-x: 8px;
    background-position-y: 8px;
    padding-left: 48px;
    color: #ff1515;
}
.message .bubble a > i { font-size: 0.8rem; margin: 2px 0 0 5px; }
.message.erreur .bubble a {text-decoration: none;background-color: #ff6868;color: #ffffff;padding: 1px 10px 4px;border-radius: 8px;font-size: 0.8rem;line-height: 22px;}
.message.erreur .bubble a:hover { background-color: #b13535;}
.message.bot .bubble a {text-decoration: none;background-color: #98bbf5;color: #ffffff;padding: 1px 10px 4px;border-radius: 8px;font-size: 0.8rem;line-height: 22px;}
.message.bot .bubble a:hover { background-color: #2f78f0;}

.message.bot .bubble {    
    background: url(../../img/capbot-hp.png) no-repeat top left var(--bot-bg);
    background-size: 32px;
    background-position-x: 8px;
    background-position-y: 8px;
    padding-left: 48px;
}

.message .bubble h1 { font-size: 20px;margin-top: 0; }
.message .bubble h2 { font-size: 18px;margin-top: 20px; }
.message .bubble h3,.message .bubble h4,.message .bubble h5,.message .bubble h6 { font-size: 16px;margin-top: 20px; }
.message .bubble hr { border: 1px solid #000; }
.message .bubble em {
    font-size: 12px !important;
    color: #2465d0;
    line-height: normal;
    text-align: justify;
    margin: 10px 0 0 0;
    padding: 0; }
.advert { margin-top: 40px;}
.message .bubble em a {
    font-size: 12px;
}
#typing-indicator {
     display: none;
     align-items: center;
     gap: 6px;
     color: #666;
     font-style: italic;
     padding: 5px 8px;
     margin: 5px 0 20px 25px;
     background-color: #f5f5f5;
     border-radius: 12px;
     max-width: 15%;
     width:15%;
    position: relative;
}

#listening-indicator {
     display: none;
     align-items: center;
     gap: 6px;
     color: #666;
     font-style: normal;
     padding: 5px 8px;
     margin: 5px 0 20px 25px;
     background-color: #f5f5f5;
     border-radius: 12px;
     max-width: 25%;
     width:25%;
    position: relative; 
    margin-left: 67%;
}

.play-btn {
    background-color: #010101;
    border-radius: 8px;
    border: 0;
    padding: 0;
    color: #fff;
    float: right;
    margin-right: 4px;
    cursor: pointer;
    height: 28px;
    width: 28px;
    filter: opacity(0.3);
}
.play-btn:hover {
    filter: opacity(1);
}
.duration {
    float: right;
    padding: 5px;
    font-size: 10px;
    border-radius: 4px;
    margin: -18px 0 0 0;
    color: #999999;
}

#typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #888;
  border-radius: 50%;
  animation: blink 1s infinite;
  margin: 0 1px;
}

#listening-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #888;
  color:#000;
  border-radius: 50%;
  animation: blink 1s infinite;
  margin: 0 1px;
}
#typing-indicator span:nth-child(2), #listening-indicator span:nth-child(2) { animation-delay: 0.2s; }
#typing-indicator span:nth-child(3), #listening-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

#input-area {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    padding: 10px 20px;
    background-color: var(--bg-color);
    box-shadow: 1px 1px 11px 2px #e7e7e7;
    position: sticky;
    bottom: 0;
    border-radius: 28px;
}
#user-input, textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 10px;
  background-color: transparent;
  color: var(--text-color);
  max-height: 200px; 
    font-family: ui-sans-serif, -apple-system, system-ui, Segoe UI, Helvetica, Apple Color Emoji, Arial, sans-serif, Segoe UI Emoji, Segoe UI Symbol;
}

#send-btn {
    background: #000;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s ease;
}

#send-btn:hover {
  background: #505050;
}
#mic-btn {
    background: #fff;
    color: black;
    border: none;
    border-radius: 20px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s ease;
    margin-right:10px;
}

#mic-btn:hover {
  background: #f1f1f1;
}
.mentions {
    margin-bottom: 1rem;
    font-size: 0.8rem;
    text-align: center;
    color: #999;
    margin-top: 0.6rem;
}
.mentions a {
    color: #8f8f8f;
    font-weight: 600;
    text-decoration: none;
}
.mentions a:hover {
    color: #333;
    text-decoration: underline;
}
.arrow {
    transform: rotate(-90deg);
    font-size: 18px;
    display: inline-block;
    color: #fff;
}
.bot-avatar {
    width: 32px;
    vertical-align: middle;
    margin-right: 10px;
    }
    #timer-user {
    margin-left: 8px;
    position: absolute;
    bottom: -10px;
    right: 5px;
    background-color: #aaa;
    border-radius: 8px;
    font-size: 0.7rem;
    padding: 1px 10px 2px;
    color: #fff;
    font-style: normal;
}
    #timer-bot {
    margin-left: 8px;
    position: absolute;
    bottom: -10px;
    left: 42px;
    background-color: #88c0d7;
    border-radius: 8px;
    font-size: 0.7rem;
    padding: 1px 10px 2px;
    color: #fff;
    font-style: normal;
}
.footer-ticket-btn{
    background-color: #c3c3c3;
    padding: 2px 10px;
    border-radius: 8px;
    color: #fff !important;
    text-transform: uppercase;
    font-weight: normal;
    font-size: 11px;
}
.footer-ticket-btn:hover{
    background-color: #505050;
    color: #fff;
    text-decoration: none !important;
}
  

 /* CSS du popup */
  .hidden { display: none !important; }
  .ticket-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(240, 240, 240, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
  }
  .ticket-popup, .ticket-success, .ticket-error {
    background: #fff;
    border-radius: 1rem;
    padding: 1.8rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    width: 34rem;
    max-width: 90%;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    font-family: Arial, sans-serif;
  }
  @keyframes fadeIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

.ticket-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.ticket-text {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 1rem;
}

.ticket-input {
  width: 95%;
  padding: 0.6rem;
  margin-bottom: 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid #ccc;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.ticket-input:focus {
  border-color: #2563eb;
}

/* Boutons */
.ticket-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.ticket-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease-in-out;
}
.cancel-btn {
  background-color: #e0e0e0;
  color: #333;
}
.cancel-btn:hover {
  background-color: #d5d5d5;
}
.submit-btn {
  background-color: #67c94d;
  color: #fff;
}
.submit-btn:hover {
  background-color: #1d4ed8;
}

/* Bouton fermer */
.ticket-close {
  position: absolute;
  top: 0.6rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}
.ticket-close:hover { color: #333; }
#ticketPopup .mentions {margin-top: -10px !important;}
.ticket-success .reponse {
    text-align: center;
    font-size: 23px;
    color: green;
    margin: 40px 0 0;
    background-color: #dcf1dc;
    border-radius: 8px;
    padding: 20px;
}

.ticket-success .reponse i {
    color: green;
    font-size: 42px;
    margin-right: 10px;
}
.ticket-success .ticket-text {
    text-align: center;
    color: #000;
    margin-bottom: 40px;
}

.ticket-error .reponse {
    text-align: center;
    font-size: 23px;
    color: red;
    margin: 40px 0 0;
    background-color: #f1dcdc;
    border-radius: 8px;
    padding: 20px;
}

.ticket-error .reponse i {
    color: red;
    font-size: 42px;
    margin-right: 10px;
}
.ticket-error .ticket-text {
    text-align: center;
    color: #000;
    margin-bottom: 40px;
}

#mic-btn.recording { background: red; color:#fff; animation: pulse 1s infinite; padding: 8px 14px 8px 10px; }
    @keyframes pulse {
      0% { box-shadow: 0 0 0 0 rgba(255,0,0,.6); }
      70% { box-shadow: 0 0 0 10px rgba(255,0,0,0); }
      100% { box-shadow: 0 0 0 0 rgba(255,0,0,0); }
    }

    button svg {
  pointer-events: none;
}

.user .bubble .speaker {
    height: 24px;
    transform: rotate(180deg);
    float: right;
    margin-top: 10px;
    color: #fff;
}

/* === Toast d’erreur vocale === */
.voice-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) scale(1);
  background-color: #f44336;
  color: white;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 9999;
  opacity: 0;
  animation: toastFadeIn 0.3s forwards;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  to { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.95); }
}

.voice .bubble  { padding: 8px 12px; border-radius: 18px; 
    display: block;
    width: 30%;
    height: 40px; }

.waveform{
    width: 80%;
    height: 32px;
    border-radius: 4px;
    padding: 4px 0;
}

.audio-playing {
  animation: pulseGlow 1.4s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
  border-radius: 12px;
  transition: box-shadow 0.3s ease;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
  }
  50% {
    box-shadow: 0 0 18px rgba(76, 175, 80, 0.8);
  }
  100% {
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
  }
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
    width: 65% !important;
    text-align: center !important;
    margin: 20px auto;
    line-height: 1.6rem;
  }
  #logo {
    max-width: 20%;
    position: absolute;
    top: 22px;
    left: 13px;
  }
  .bot-entete {
    max-width: 15%;
    position: absolute;
    right: 18px;
    top: 13px;
  }
  #header p {
    width: 100%;
    text-align: center;
    font-size: 0.6rem;
    margin: -10px 0 5px 0;
  }
  #input-area {
    margin: 0 4% !important;
  }
  .voice .bubble{
    width: 50% !important;}
    
    #listening-indicator {
    max-width: 50% !important;
    width: 50% !important;
    margin-left: 41% !important;
    font-size: 1.3rem !important;
}
}