/* Styles pour le chatbot Xpert-NET */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 580px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f172a 100%);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.chatbot-agent-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.chatbot-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-agent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.chatbot-agent-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-agent-function {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-chatbot {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.close-chatbot:hover {
    background: #da1c5c;
}

/* Messages */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #da1c5c;
}

.message-bot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}

.message-bot .avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1f3a, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.message-bot .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-bot .message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    color: #1e293b;
    font-size: 0.85rem;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.message-bot .message-content strong {
    font-weight: 700;
    color: #da1c5c;
}

.message-bot .message-content em {
    font-style: italic;
    color: #4a5568;
}

.message-user {
    display: flex;
    justify-content: flex-end;
    max-width: 85%;
    align-self: flex-end;
}

.message-user .message-content {
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    border-top-right-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Formulaire */
.chatbot-form {
    background: white;
    padding: 14px;
    border-radius: 16px;
    margin-top: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chatbot-form-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: #1a1f3a;
    text-align: center;
    font-size: 0.9rem;
}

.chatbot-form-group {
    margin-bottom: 10px;
}

.chatbot-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    box-sizing: border-box;
    font-family: inherit;
    transition: all 0.2s;
}

.chatbot-form-group input:focus {
    outline: none;
    border-color: #da1c5c;
    box-shadow: 0 0 0 3px rgba(218, 28, 92, 0.1);
}

.chatbot-form-submit {
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    border: none;
    padding: 10px;
    border-radius: 30px;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chatbot-form-submit:hover {
    opacity: 0.9;
}

/* Zone de saisie */
.chatbot-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chatbot-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.chatbot-input-area input:focus {
    border-color: #da1c5c;
    box-shadow: 0 0 0 3px rgba(218, 28, 92, 0.1);
}

.chatbot-input-area button {
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    border: none;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.chatbot-input-area button:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Actions rapides */
.quick-actions {
    padding: 8px 12px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}

.quick-btn {
    background: #f1f5f9;
    border: none;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #334155;
    font-weight: 500;
}

.quick-btn:hover {
    background: #da1c5c;
    color: white;
}

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 18px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Footer */
.chatbot-footer-note {
    text-align: center;
    padding: 6px;
    font-size: 0.55rem;
    color: #94a3b8;
    background: #f8f9fa;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* ========== BOUTON SPEAK CARD STYLE ========== */
.speak-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    padding: 6px 14px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: fit-content;
}

.speak-card:hover {
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(218, 28, 92, 0.25);
}

.speak-card:hover .speak-icon,
.speak-card:hover .speak-text {
    color: white;
}

.speak-icon {
    font-size: 0.9rem;
    color: #da1c5c;
    transition: color 0.3s ease;
}

.speak-text {
    font-size: 0.7rem;
    font-weight: 500;
    color: #334155;
    transition: color 0.3s ease;
}

.speak-card.speaking {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: transparent;
    animation: pulseGreen 1s infinite;
}

.speak-card.speaking .speak-icon,
.speak-card.speaking .speak-text {
    color: white;
}

@keyframes pulseGreen {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    }
    50% {
        box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
    }
}

/* ========== BOUTON MICROPHONE ========== */
.mic-btn {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: none;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1f3a;
    font-size: 1.1rem;
}

.mic-btn:hover {
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    color: white;
    transform: scale(1.05);
}

.mic-btn.listening {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    animation: pulseRed 1.2s infinite;
}

@keyframes pulseRed {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
        transform: scale(1.05);
    }
}

/* Indicateur vocal flottant */
voice-indicator {
    position: fixed;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    padding: 16px 24px;
    border-radius: 60px;
    color: white;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10001;
    animation: fadeInUp 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

voice-indicator .wave {
    display: flex;
    gap: 3px;
    align-items: center;
}

voice-indicator .wave span {
    width: 3px;
    height: 12px;
    background: #da1c5c;
    border-radius: 2px;
    animation: wave 0.8s infinite ease-in-out;
}

voice-indicator .wave span:nth-child(1) { animation-delay: 0s; height: 8px; }
voice-indicator .wave span:nth-child(2) { animation-delay: 0.1s; height: 16px; }
voice-indicator .wave span:nth-child(3) { animation-delay: 0.2s; height: 12px; }
voice-indicator .wave span:nth-child(4) { animation-delay: 0.3s; height: 20px; }
voice-indicator .wave span:nth-child(5) { animation-delay: 0.4s; height: 14px; }
voice-indicator .wave span:nth-child(6) { animation-delay: 0.5s; height: 8px; }

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.5); }
}

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

/* Responsive */
@media (max-width: 576px) {
    .chatbot-window {
        width: calc(100% - 30px);
        right: 15px;
        left: 15px;
        height: 550px;
        bottom: 80px;
    }
    
    .chatbot-agent-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .message-bot .avatar {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }
    
    .quick-btn {
        padding: 4px 10px;
        font-size: 0.65rem;
    }
    
    .speak-card {
        padding: 4px 12px;
    }
    
    .speak-icon {
        font-size: 0.75rem;
    }
    
    .speak-text {
        font-size: 0.6rem;
    }
    
    .mic-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 1rem;
    }
}

/* Badge Bêta */
.chatbot-agent-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.beta-badge {
    background: linear-gradient(135deg, #da1c5c, #e64d7e);
    color: white;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: pulseBeta 2s infinite;
}

@keyframes pulseBeta {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.02);
    }
}

/* Responsive pour le badge */
@media (max-width: 576px) {
    .beta-badge {
        font-size: 0.5rem;
        padding: 2px 6px;
    }
    
    .chatbot-agent-name {
        font-size: 0.85rem;
    }
}