/**
 * Styles CSS pour Laura Chatbot - Interface Frontend
 * Design enfantin et coloré pour l'apprentissage du français
 */

/* Variables CSS pour la cohérence des couleurs */
:root {
    --laura-primary: #ff6b9d;
    --laura-secondary: #4ecdc4;
    --laura-accent: #45b7d1;
    --laura-success: #96ceb4;
    --laura-warning: #feca57;
    --laura-error: #ff6b6b;
    --laura-text: #2c3e50;
    --laura-text-light: #7f8c8d;
    --laura-bg: #f8f9fa;
    --laura-white: #ffffff;
    --laura-border: #e9ecef;
    --laura-shadow: rgba(0, 0, 0, 0.1);
    --laura-radius: 15px;
    --laura-radius-small: 8px;
}

/* Container principal du chatbot */
.laura-chatbot-container {
    max-width: 600px;
    margin: 20px auto;
    background: var(--laura-white);
    border-radius: var(--laura-radius);
    box-shadow: 0 8px 32px var(--laura-shadow);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    border: 2px solid var(--laura-border);
}

/* Header du chatbot */
.laura-chatbot-header {
    background: linear-gradient(135deg, var(--laura-primary), var(--laura-secondary));
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--laura-white);
}

.laura-avatar-container {
    flex-shrink: 0;
}

.laura-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--laura-white);
    background: var(--laura-white);
    padding: 2px;
}

.laura-header-info {
    flex: 1;
}

.laura-title {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.laura-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
}

.laura-controls {
    flex-shrink: 0;
}

.laura-mute-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
}

.laura-mute-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.laura-mute-btn.muted {
    background: var(--laura-error);
    border-color: var(--laura-error);
}

/* Zone des suggestions de conversation (Titre, description et boutons) */
.laura-suggestions-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--laura-bg);
    padding: 20px;
    border-top: 1px solid var(--laura-border);
    margin-top: 15px;
    /* Suppression de la bordure du bas pour la fusionner avec la zone de saisie si nécessaire */
}

.laura-suggestions-title,
.laura-suggestions-desc {
    width: 100%; /* Occuper toute la largeur pour être en bloc */
    color: var(--laura-text);
    text-align: left;
}

.laura-suggestions-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.laura-suggestions-desc {
    font-size: 13px;
    margin: 0 0 15px 0;
    color: var(--laura-text-light);
}

/* Pied de page personnalisable */
.laura-chatbot-footer {
    padding: 15px 20px;
    background: var(--laura-bg);
    color: var(--laura-text-light);
    font-size: 12px;
    text-align: center;
    border-top: 1px solid var(--laura-border);
}

.laura-chatbot-footer p {
    margin: 0;
}

.laura-chatbot-footer a {
    color: var(--laura-primary);
    text-decoration: none;
}

.laura-chatbot-footer a:hover {
    text-decoration: underline;
}

/* Ajustement pour le mode sombre */
@media (prefers-color-scheme: dark) {
    .laura-suggestions-title {
        color: var(--laura-text);
    }
    .laura-suggestions-desc,
    .laura-chatbot-footer {
        color: var(--laura-text-light);
    }
    .laura-chatbot-footer a {
        color: var(--laura-secondary);
    }
}

.laura-suggestion-btn {
    background: var(--laura-white);
    border: 1px solid var(--laura-secondary);
    color: var(--laura-secondary);
    padding: 8px 12px;
    border-radius: 20px; /* Boutons en forme de pilule */
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.laura-suggestion-btn:hover {
    background: var(--laura-secondary);
    color: var(--laura-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Spécificité pour contrer les thèmes agressifs */
.laura-chatbot-container .laura-suggestion-btn {
    background: var(--laura-white);
    border: 1px solid var(--laura-secondary);
    color: var(--laura-secondary);
}

.laura-chatbot-container .laura-suggestion-btn:hover {
    background: var(--laura-secondary);
    color: var(--laura-white);
}

/* Zone de conversation */
.laura-chat-area {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: var(--laura-bg);
    scroll-behavior: smooth;
}

.laura-messages-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Messages */
.laura-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease-out;
}

.laura-message-bot {
    align-self: flex-start;
}

.laura-message-user {
    align-self: flex-end;
    display: flex;
    justify-content: flex-end;
}

.laura-message-avatar {
    flex-shrink: 0;
}

.laura-message-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--laura-white);
}

.laura-message-content {
    max-width: 70%;
}

/* La bulle rose de l'utilisateur occupe la même largeur que celle de Laura */
.laura-message-user .laura-message-content {
    max-width: 70%;
    flex-basis: 70%;
}

.laura-message-bubble {
    padding: 12px 16px;
    border-radius: var(--laura-radius-small);
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.laura-message-bot .laura-message-bubble {
    background: var(--laura-white);
    color: var(--laura-text);
    border: 1px solid var(--laura-border);
    border-bottom-left-radius: 4px;
}

.laura-message-user .laura-message-bubble {
    background: var(--laura-primary);
    color: var(--laura-white);
    border-bottom-right-radius: 4px;
}

.laura-message-time {
    font-size: 11px;
    color: var(--laura-text-light);
    margin-top: 4px;
    text-align: right;
}

.laura-message-user .laura-message-time {
    text-align: left;
    color: rgba(255, 255, 255, 0.7);
}

/* Indicateur de frappe */
.laura-typing-indicator {
    animation: fadeIn 0.3s ease-in;
}

.laura-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.laura-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--laura-text-light);
    animation: typingDot 1.4s infinite ease-in-out;
}

.laura-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.laura-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Zone de saisie */
.laura-input-area {
    background: var(--laura-white);
    border-top: 1px solid var(--laura-border);
    padding: 20px;
}

.laura-input-container {
    position: relative;
}

.laura-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--laura-bg);
    border: 2px solid var(--laura-border);
    border-radius: var(--laura-radius);
    padding: 12px;
    transition: border-color 0.3s ease;
}

.laura-input-wrapper:focus-within {
    border-color: var(--laura-primary);
}

.laura-text-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    line-height: 1.4;
    color: var(--laura-text);
    min-height: 20px;
    max-height: 100px;
    outline: none;
    font-family: inherit;
}

.laura-text-input::placeholder {
    color: var(--laura-text-light);
}

.laura-input-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.laura-voice-btn,
.laura-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.laura-voice-btn {
    background: var(--laura-secondary);
    color: var(--laura-white);
}

.laura-voice-btn:hover {
    background: #3db5ac;
    transform: scale(1.05);
}

.laura-voice-btn.recording {
    background: var(--laura-error);
    animation: pulse 1s infinite;
}

.laura-send-btn {
    background: var(--laura-primary);
    color: var(--laura-white);
}

.laura-send-btn:hover {
    background: #e55a87;
    transform: scale(1.05);
}

.laura-send-btn:disabled {
    background: var(--laura-text-light);
    cursor: not-allowed;
    transform: none;
}

/* Indicateur d'enregistrement */
.laura-recording-indicator {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    background: var(--laura-error);
    color: var(--laura-white);
    padding: 12px;
    border-radius: var(--laura-radius-small);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease-out;
}

.laura-recording-animation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.laura-recording-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--laura-white);
    animation: pulse 1s infinite;
}

.laura-recording-text {
    font-weight: 500;
}

.laura-stop-recording {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--laura-white);
    padding: 6px 12px;
    border-radius: var(--laura-radius-small);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

.laura-stop-recording:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Message de confidentialité */
.laura-privacy-notice {
    background: var(--laura-bg);
    padding: 10px 20px;
    text-align: center;
    color: var(--laura-text-light);
    font-size: 12px;
    border-top: 1px solid var(--laura-border);
}

/* Animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .laura-chatbot-container {
        margin: 10px;
        border-radius: var(--laura-radius-small);
    }
    
    .laura-chatbot-header {
        padding: 15px;
    }
    
    .laura-avatar {
        width: 50px;
        height: 50px;
    }
    
    .laura-title {
        font-size: 18px;
    }
    
    .laura-subtitle {
        font-size: 13px;
    }
    
    .laura-chat-area {
        height: 350px;
        padding: 15px;
    }
    
    .laura-message-content {
        max-width: 85%;
    }
	
	.laura-message-user .laura-message-content {
        max-width: 85%;
        flex-basis: 85%;
    }
    
    .laura-input-area {
        padding: 15px;
    }
    
    .laura-input-wrapper {
        padding: 10px;
    }
    
    .laura-voice-btn,
    .laura-send-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .laura-chatbot-container {
        margin: 5px;
    }
    
    .laura-chat-area {
        height: 300px;
        padding: 10px;
    }
    
    .laura-message-content {
        max-width: 90%;
    }
	
	.laura-message-user .laura-message-content {
        max-width: 90%;
        flex-basis: 90%;
    }
    
    .laura-message-bubble {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .laura-input-area {
        padding: 10px;
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mode sombre (si supporté par le thème) */
@media (prefers-color-scheme: dark) {
    :root {
        --laura-bg: #2c3e50;
        --laura-white: #34495e;
        --laura-text: #ecf0f1;
        --laura-text-light: #bdc3c7;
        --laura-border: #4a5f7a;
        --laura-shadow: rgba(0, 0, 0, 0.3);
    }
    
    .laura-message-bot .laura-message-bubble {
        background: var(--laura-white);
        border-color: var(--laura-border);
    }
}

/* ====================================================================
 * Encapsulation & correctifs – Laura Chatbot
 *
 * Certains thèmes WordPress appliquent des styles globaux aux balises
 * button et aux classes génériques (.button, .btn…) qui peuvent venir
 * perturber l’aspect de Laura Chatbot. Pour éviter ces conflits,
 * toutes les règles ci‑dessous sont préfixées par le conteneur
 * `.laura-chatbot-container` afin d’augmenter la spécificité et de
 * neutraliser les styles hérités. Elles réappliquent ensuite les
 * couleurs, bordures et dimensions prévues pour les éléments du
 * chatbot (boutons micro et envoi, zones de saisie, etc.).
 *
 * En cas de modifications futures, pensez à dupliquer les règles
 * correspondantes ici, en veillant à conserver le préfixe
 * `.laura-chatbot-container` pour garantir l’isolation.
 */

/* Neutraliser les styles globaux sur les boutons à l’intérieur du chatbot */
.laura-chatbot-container button,
.laura-chatbot-container .laura-voice-btn,
.laura-chatbot-container .laura-send-btn {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    outline: none;
    font: inherit;
    line-height: 1;
    box-shadow: none;
    background: none;
    padding: 0;
    margin: 0;
}

/* Zone de saisie : préserver l’apparence et le confort */
.laura-chatbot-container .laura-input-wrapper {
    background: var(--laura-bg);
    border: 2px solid var(--laura-border);
    border-radius: var(--laura-radius);
    padding: 12px;
    transition: border-color 0.3s ease;
}
.laura-chatbot-container .laura-input-wrapper:focus-within {
    border-color: var(--laura-primary);
}

/* Champ de texte : rétablir les couleurs et contours */
.laura-chatbot-container .laura-text-input {
    border: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    line-height: 1.4;
    color: var(--laura-text);
    outline: none;
    flex: 1;
    min-height: 20px;
    max-height: 100px;
}
.laura-chatbot-container .laura-text-input::placeholder {
    color: var(--laura-text-light);
}

/* Conteneur de contrôle : aligner les boutons correctement */
.laura-chatbot-container .laura-input-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Boutons de commande (micro et envoi) : renforcer la spécificité */
.laura-chatbot-container .laura-voice-btn,
.laura-chatbot-container .laura-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    color: var(--laura-white);
}

/* Bouton micro : couleurs et animations */
.laura-chatbot-container .laura-voice-btn {
    background: var(--laura-secondary);
}
.laura-chatbot-container .laura-voice-btn:hover {
    background: #3db5ac;
    transform: scale(1.05);
}
.laura-chatbot-container .laura-voice-btn.recording {
    background: var(--laura-error);
    animation: pulse 1s infinite;
}

/* Bouton envoyer : couleurs et états */
.laura-chatbot-container .laura-send-btn {
    background: var(--laura-primary);
}
.laura-chatbot-container .laura-send-btn:hover {
    background: #e55a87;
    transform: scale(1.05);
}
.laura-chatbot-container .laura-send-btn:disabled {
    background: var(--laura-text-light);
    cursor: not-allowed;
    transform: none;
}

/* =========================================================
   Laura Chatbot – Amélioration UX : boutons + pastille icône
   (à coller tout en bas du fichier)
   ========================================================= */

/* Desktop : boutons un peu plus grands, pastille/halo sous l’icône */
.laura-chatbot-container .laura-voice-btn,
.laura-chatbot-container .laura-send-btn,
.laura-voice-btn,
.laura-send-btn {
  width: 48px;                 /* + taille (avant : 40px) */
  height: 48px;
  min-width: 44px;             /* cible tactile mini */
  min-height: 44px;
  border-radius: 50%;
  font-size: 18px;             /* icône légèrement plus grande */
  line-height: 1;
  position: relative;          /* nécessaire pour la pastille */
}

/* Pastille circulaire (halo subtil) – n’altère PAS la couleur du bouton */
.laura-chatbot-container .laura-voice-btn::before,
.laura-chatbot-container .laura-send-btn::before,
.laura-voice-btn::before,
.laura-send-btn::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 74%;
  height: 74%;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .18);  /* léger contraste neutre */
  pointer-events: none;
  z-index: 0;
}

/* S’assure que l’icône passe au-dessus de la pastille */
.laura-chatbot-container .laura-voice-btn > i,
.laura-chatbot-container .laura-voice-btn > svg,
.laura-chatbot-container .laura-voice-btn > span,
.laura-chatbot-container .laura-send-btn > i,
.laura-chatbot-container .laura-send-btn > svg,
.laura-chatbot-container .laura-send-btn > span,
.laura-voice-btn > i, .laura-voice-btn > svg, .laura-voice-btn > span,
.laura-send-btn > i, .laura-send-btn > svg, .laura-send-btn > span {
  position: relative;
  z-index: 1;
}

/* Focus clavier visible (accessibilité) – ne change pas la couleur du bouton */
.laura-chatbot-container .laura-voice-btn:focus-visible,
.laura-chatbot-container .laura-send-btn:focus-visible,
.laura-voice-btn:focus-visible,
.laura-send-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,.12), 0 0 0 6px rgba(255,255,255,.35);
}

/* Mobile / tablettes : cible tactile confortable */
@media (max-width: 768px) {
  .laura-chatbot-container .laura-voice-btn,
  .laura-chatbot-container .laura-send-btn,
  .laura-voice-btn,
  .laura-send-btn {
    width: 44px;               /* avant : 36px dans ton CSS */
    height: 44px;
    font-size: 17px;
  }
}
/* Amélioration visuelle du bouton haut-parleur (mute) */
.laura-chatbot-container .laura-mute-btn {
    position: relative;
    width: 50px;
    height: 50px;
    font-size: 20px;
    border-radius: 50%;
    background: var(--laura-secondary);
    border: 3px solid var(--laura-white);
    color: var(--laura-white);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5); /* pastille claire derrière */
    transition: all 0.3s ease;
}

.laura-chatbot-container .laura-mute-btn:hover {
    background: #3db5ac;
    transform: scale(1.1);
}

.laura-chatbot-container .laura-mute-btn.muted {
    background: var(--laura-error);
    border-color: var(--laura-error);
}
