/* ===== IEB EXPERT IA CHATBOT - DESIGN PROPRE ===== */

/* Reset et base */
.ieb-chatbot-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Palette B (indigo → cobalt) */
:root{
  --ieb-blue-1: #0E2B6D;
  --ieb-blue-2: #2456D3;
  --ieb-blue-1-hover: #0b2155;
  --ieb-blue-2-hover: #1c49ba;
}

/* Bouton flottant principal */
.ieb-chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2271b1, #1a5a8a);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ieb-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(34, 113, 177, 0.3);
}

.ieb-chatbot-toggle:active {
    transform: scale(0.95);
}

/* Widget principal */
.ieb-chatbot-widget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.ieb-chatbot-widget.ieb-open {
    display: flex;
}

/* Header du widget */
.ieb-chatbot-header {
    background: linear-gradient(135deg, #2271b1, #1a5a8a);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.ieb-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ieb-bot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ieb-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.ieb-header-text p {
    margin: 5px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
    color: white;
}

.ieb-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.ieb-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Zone des messages */
.ieb-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
    scroll-behavior: smooth;
}

.ieb-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ieb-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ieb-chatbot-messages::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.ieb-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Messages */
.ieb-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    animation: ieb-message-slide 0.3s ease-out;
}

@keyframes ieb-message-slide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ieb-message.ieb-user {
    justify-content: flex-end;
}

.ieb-message.ieb-assistant {
    justify-content: flex-start;
}

/* Masquer l’avatar à côté des bulles */
.ieb-message-avatar { display: none !important; }

/* Bulles style WhatsApp */
.ieb-message-content {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
}

/* Bulle utilisateur (droite) */
.ieb-message.ieb-user .ieb-message-content {
  background: linear-gradient(135deg, #2271b1, #1a5a8a);
  color: #fff;
  border-top-right-radius: 6px;
  margin-right: 8px;
  position: relative;
}
.ieb-message.ieb-user .ieb-message-content::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 12px;
  width: 12px; height: 12px;
  background: linear-gradient(135deg, #2271b1, #1a5a8a);
  transform: rotate(45deg);
  border-radius: 2px;
}

/* Bulle assistant (gauche) */
.ieb-message.ieb-assistant .ieb-message-content {
  background: #fff;
  color: #333;
  border: 1px solid #e0e0e0;
  border-top-left-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  margin-left: 8px;
  position: relative;
}
.ieb-message.ieb-assistant .ieb-message-content::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 12px;
  width: 12px; height: 12px;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  transform: rotate(45deg);
  border-radius: 2px;
}

/* Indicateur de frappe */
.ieb-typing-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    animation: ieb-typing-pulse 1.5s infinite;
}

@keyframes ieb-typing-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.ieb-typing-dots {
    display: flex;
    gap: 4px;
}

.ieb-typing-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: ieb-typing-bounce 1.4s infinite ease-in-out;
}

.ieb-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.ieb-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes ieb-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Zone de saisie */
.ieb-chatbot-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #dee2e6;
}

.ieb-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.ieb-input-container:focus-within {
    border-color: #2271b1;
    background: white;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.ieb-chatbot-input input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: #333;
}

.ieb-chatbot-input input::placeholder {
    color: #6c757d;
}

/* Bouton d’envoi: cercle bleu avec icône avion */
.ieb-send-button {
  appearance: none;
  -webkit-appearance: none;
  background: #2271b1 !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 9999px !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 10px rgba(34,113,177,.25);
  cursor: pointer;
}
.ieb-send-button:hover { background: #1a5a8a !important; transform: translateY(-1px); }
.ieb-send-button:active { transform: translateY(0); }
.ieb-send-button:disabled { background: #8aaecb !important; cursor: not-allowed; opacity: .8; }

.ieb-send-button .ieb-send-icon,
.ieb-send-icon {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  fill: currentColor !important;
  color: #ffffff !important;
}

/* Options de conversion */
.ieb-conversion-options {
    padding: 20px;
    background: white;
    border-top: 1px solid #dee2e6;
}

.ieb-conversion-options h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.ieb-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ieb-action-button {
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.ieb-action-button:hover {
    border-color: #2271b1;
    background: #f8f9fa;
}

.ieb-action-button.ieb-primary {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.ieb-action-button.ieb-primary:hover {
    background: #1a5a8a;
    border-color: #1a5a8a;
}

/* Responsive */
@media (max-width: 480px) {
    .ieb-chatbot-widget {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
    
    .ieb-chatbot-toggle {
        bottom: 20px;
        right: 20px;
    }
}

/* Mobile layout type WhatsApp */
@media (max-width: 768px) {
  .ieb-chatbot-widget {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh; /* Changé de 70vh à 100vh pour éviter les problèmes */
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
    border: none;
    /* Ajout de règles pour éviter les problèmes de zoom */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  .ieb-chatbot-header {
    padding: 14px 16px;
    flex-shrink: 0; /* Empêche le header de se rétrécir */
  }
  
  .ieb-chatbot-messages {
    flex: 1;
    min-height: 0; /* Permet au contenu de se rétrécir correctement */
    overflow-y: auto;
  }
  
  .ieb-chatbot-input {
    padding: 12px;
    flex-shrink: 0; /* Empêche l'input de se rétrécir */
  }
  
  .ieb-input-container {
    padding: 10px 12px;
  }
  
  /* Force la taille de police pour éviter le zoom automatique sur iOS */
  .ieb-chatbot-input input,
  .ieb-chatbot-widget button {
    font-size: 16px !important;
    -webkit-appearance: none;
    border-radius: 8px;
  }
  
  .ieb-chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  
  /* Ajustement spécifique pour les petits écrans */
  @media (max-height: 600px) {
    .ieb-chatbot-widget {
      height: 100vh;
      border-radius: 0;
    }
    
    .ieb-chatbot-header {
      padding: 10px 16px;
    }
    
    .ieb-chatbot-input {
      padding: 8px 12px;
    }
  }
}

/* Accessibilité */
.ieb-chatbot-toggle:focus,
.ieb-chatbot-close:focus,
.ieb-send-button:focus,
.ieb-action-button:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Entête dégradé */
.ieb-chatbot-header{
  background: linear-gradient(135deg, var(--ieb-blue-1), var(--ieb-blue-2)) !important;
}

/* Bouton flottant dégradé */
.ieb-chatbot-toggle{
  background: linear-gradient(135deg, var(--ieb-blue-1), var(--ieb-blue-2)) !important;
}

/* Bulle utilisateur dégradé */
.ieb-message.ieb-user .ieb-message-content{
  background: linear-gradient(135deg, var(--ieb-blue-1), var(--ieb-blue-2)) !important;
}
/* Pointe bulle utilisateur = couleur du côté droit du dégradé pour cohérence */
.ieb-message.ieb-user .ieb-message-content::after{
  background: var(--ieb-blue-2) !important;
}

/* Bouton d’envoi dégradé */
.ieb-send-button{
  background: linear-gradient(135deg, var(--ieb-blue-1), var(--ieb-blue-2)) !important;
}
.ieb-send-button:hover{
  background: linear-gradient(135deg, var(--ieb-blue-1-hover), var(--ieb-blue-2-hover)) !important;
}

/* Boutons primaires (si utilisés) */
.ieb-action-button.ieb-primary{
  background: linear-gradient(135deg, var(--ieb-blue-1), var(--ieb-blue-2)) !important;
  border-color: transparent !important;
}
.ieb-action-button.ieb-primary:hover{
  background: linear-gradient(135deg, var(--ieb-blue-1-hover), var(--ieb-blue-2-hover)) !important;
}

/* Ajustements de couleurs de bordures/outline pour rester cohérent */
.ieb-input-container:focus-within{ box-shadow: 0 0 0 3px rgba(14,43,109,0.15); border-color: var(--ieb-blue-2); }
.ieb-action-button:hover{ border-color: var(--ieb-blue-2); }
.ieb-action-button.ieb-primary{ border-color: transparent; }
.ieb-chatbot-toggle:focus,
.ieb-chatbot-close:focus,
.ieb-send-button:focus,
.ieb-action-button:focus{ outline: 2px solid var(--ieb-blue-2); }

/* Correction pointe bulle utilisateur: triangle bordure au lieu de losange */
.ieb-message.ieb-user .ieb-message-content::after{
  content: '' !important;
  position: absolute !important;
  right: -8px !important;
  top: 14px !important;
  width: 0 !important;
  height: 0 !important;
  background: none !important;
  transform: none !important;
  border-left: 10px solid var(--ieb-blue-2) !important;
  border-top: 8px solid transparent !important;
  border-bottom: 8px solid transparent !important;
  border-radius: 2px !important;
}
