/**
 * Styles du Chatbot DJ BENJ / DJ DAN
 * Design moderne et responsive
 */

/* ============================================
   BOUTON FLOTTANT DU CHATBOT
   ============================================ */

.chatbot-toggle {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    border-radius: 50%;
    display: none; /* Initialement caché, affiché par JS */
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.chatbot-toggle:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.6);
}

.chatbot-toggle.active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);
}

.chatbot-toggle i {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Badge de notification */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #1a1a2e;
    animation: pulse-badge 2s infinite;
}

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

/* Animation pulse pour attirer l'attention */
.chatbot-toggle.pulse-animation {
    animation: pulse-attention 1s infinite;
}

@keyframes pulse-attention {
    0% { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 8px 40px rgba(139, 92, 246, 0.8); }
    100% { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4); }
}

/* ============================================
   FENÊTRE DU CHATBOT
   ============================================ */

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #1a1a2e;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 998;
    border: 1px solid rgba(139, 92, 246, 0.3);
    overflow: hidden;
}

.chatbot-window.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ============================================
   HEADER DU CHATBOT
   ============================================ */

.chatbot-header {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #8B5CF6;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

/* ============================================
   ZONE DES MESSAGES
   ============================================ */

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #16213e;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Scrollbar personnalisée */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    border-radius: 10px;
}

/* ============================================
   MESSAGES
   ============================================ */

.chatbot-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    color: white;
}

.user-message .message-avatar {
    background: #F59E0B;
    color: white;
}

.message-content {
    background: #1a1a2e;
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    position: relative;
}

.bot-message .message-content {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px 16px 16px 4px;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
    color: white;
    border-radius: 16px 16px 4px 16px;
    text-align: right;
    margin-left: auto;
}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
    text-align: right;
}

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

/* Style pour les emojis */
.message-content .emoji {
    font-size: 18px;
    margin: 0 2px;
}

/* Style pour le texte en gras */
.message-content strong {
    color: #F59E0B;
    font-weight: 600;
}

.user-message .message-content strong {
    color: white;
}

/* ============================================
   INDICATEUR DE SAISIE
   ============================================ */

.typing-indicator .message-content {
    padding: 16px;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #8B5CF6;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ============================================
   RÉPONSES RAPIDES
   ============================================ */

.chatbot-quick-replies {
    padding: 12px 20px;
    background: #1a1a2e;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    max-height: 120px;
    overflow-y: auto;
}

.quick-reply {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-reply:hover {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* ============================================
   ZONE DE SAISIE
   ============================================ */

.chatbot-input-container {
    padding: 16px 20px;
    background: #1a1a2e;
    display: flex;
    gap: 12px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.chatbot-input {
    flex: 1;
    background: #16213e;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 25px;
    padding: 12px 20px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-send {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.5);
}

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

/* ============================================
   FOOTER
   ============================================ */

.chatbot-footer {
    padding: 10px 20px;
    background: #0f1419;
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .chatbot-toggle {
        bottom: 80px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 24px;
        /* Meilleur support tactile */
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        /* Empêcher le scroll en arrière-plan */
        position: fixed;
        z-index: 9999;
    }

    .chatbot-window.active {
        bottom: 0;
    }

    .chatbot-header {
        border-radius: 0;
        /* Position fixe pour éviter les problèmes de scroll */
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .message-content {
        max-width: 85%;
    }

    .chatbot-quick-replies {
        padding: 10px 16px;
        /* Meilleur support tactile */
        -webkit-overflow-scrolling: touch;
    }

    .quick-reply {
        font-size: 11px;
        padding: 6px 12px;
        /* Meilleur support tactile */
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .chatbot-input {
        /* Empêcher le zoom sur iOS */
        font-size: 16px !important;
        /* Meilleur support tactile */
        -webkit-tap-highlight-color: transparent;
    }
    
    .chatbot-send {
        /* Meilleur support tactile */
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .chatbot-close {
        /* Meilleur support tactile */
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Empêcher le double tap zoom */
    .chatbot-window * {
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    .chatbot-header-text h3 {
        font-size: 14px;
    }

    .chatbot-avatar {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .chatbot-input {
        padding: 10px 16px;
        font-size: 13px;
    }

    .chatbot-send {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
}

/* ============================================
   ANIMATIONS SUPPLÉMENTAIRES
   ============================================ */

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

/* Animation pour l'ouverture du chatbot */
.chatbot-window.active .chatbot-header {
    animation: slideDown 0.3s ease;
}

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