/* Reset et base */
#nova-chat-panel,
#nova-chat-panel *,
#nova-chat-bubble,
#nova-chat-bubble * {
    box-sizing: border-box !important;
}

/* Bulle de chat en bas à droite - PLUS GRANDE */
#nova-chat-bubble {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.3s ease !important;
    border: none !important;
    overflow: hidden !important;
    padding: 0 !important;
}

#nova-chat-bubble:hover {
    transform: scale(1.08) !important;
}

.nova-bubble-icon {
    font-size: 36px !important;
    line-height: 1 !important;
}

/* Image personnalisée dans la bulle - CIRCULAIRE */
.nova-bubble-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 50% !important;
}

/* Panneau de chat - PLEIN ÉCRAN À DROITE */
#nova-chat-panel {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    width: 500px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    background: #f8f9fa !important;
    box-shadow: -2px 0 25px rgba(0, 0, 0, 0.1) !important;
    z-index: 999998 !important;
    display: flex !important;
    flex-direction: column !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
    transition: transform 0.3s ease !important;
    border-radius: 0 !important;
    border-left: 1px solid #e9ecef !important;
}

/* État caché */
#nova-chat-panel.nova-hidden {
    transform: translateX(100%) !important;
}

/* État visible */
#nova-chat-panel.nova-visible {
    transform: translateX(0) !important;
}

/* En-tête */
#nova-header {
    background: linear-gradient(135deg, #8b9dc3 0%, #9fa8c3 100%) !important;
    padding: 25px 30px !important;
    color: white !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    min-height: 100px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.nova-header-content {
    display: flex !important;
    align-items: center !important;
    gap: 18px !important;
}

/* Conteneur d'avatar pour changements dynamiques */
#nova-avatar-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* Avatar - Support emoji ET image - PLUS GRAND */
.nova-avatar {
    font-size: 50px !important;
    width: 70px !important;
    height: 70px !important;
    min-width: 70px !important;
    min-height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
}

/* Image d'avatar personnalisée - CIRCULAIRE */
.nova-avatar-image {
    width: 70px !important;
    height: 70px !important;
    min-width: 70px !important;
    min-height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 50% !important;
}

.nova-title h3 {
    font-size: 20px !important;
    font-weight: 600 !important;
    margin-bottom: 6px !important;
    color: white !important;
}

.nova-status {
    font-size: 14px !important;
    opacity: 0.95 !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Indicateur de statut (point coloré) */
.nova-status::before {
    content: '' !important;
    display: inline-block !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #4ade80 !important;
    animation: pulse 2s infinite !important;
}

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

/* Bouton fermer */
.nova-close-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    color: white !important;
    font-size: 32px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.nova-close-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05) !important;
}

/* Zone des messages */
#nova-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 25px !important;
    background: #ffffff !important;
    min-height: 0 !important;
    scroll-behavior: smooth !important;
}

/* Messages */
.nova-message {
    margin-bottom: 20px !important;
    animation: fadeIn 0.3s ease !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 10px !important;
}

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

/* Avatar dans les messages */
.nova-message-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

/* Avatar emoji pour messages agent */
.nova-message-avatar-emoji {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

/* Avatar emoji pour messages utilisateur */
.nova-user-avatar-emoji {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #007cff 0%, #0056b3 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.nova-message-content {
    background: white !important;
    padding: 12px 15px !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    flex: 1 !important;
}

.nova-message-content strong {
    display: block !important;
    font-size: 13px !important;
    color: #667eea !important;
    margin-bottom: 5px !important;
}

.nova-message-content p {
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    margin: 0 !important;
}

/* Message utilisateur */
.nova-user {
    flex-direction: row-reverse !important;
}

.nova-user .nova-message-content {
    background: #007cff !important;
    color: white !important;
}

.nova-user .nova-message-content strong {
    color: rgba(255, 255, 255, 0.9) !important;
}

.nova-user .nova-message-content p {
    color: white !important;
}

/* Message agent - avatar à gauche */
.nova-agent {
    flex-direction: row !important;
}

/* Indicateur de saisie */
.nova-typing {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
}

.nova-typing-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.nova-typing-avatar-emoji {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.nova-typing-content {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 15px !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.nova-typing strong {
    font-size: 13px !important;
    color: #667eea !important;
}

.nova-typing-dots {
    display: flex !important;
    gap: 4px !important;
}

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

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

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

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

/* Zone de saisie */
#nova-input-area {
    padding: 20px 25px 25px 25px !important;
    background: white !important;
    border-top: 1px solid #e9ecef !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
    min-height: 85px !important;
}

#nova-input {
    flex: 1 !important;
    padding: 14px 20px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 24px !important;
    font-size: 15px !important;
    outline: none !important;
    transition: all 0.2s ease !important;
    color: #2d3748 !important;
    background: #f8f9fa !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}

#nova-input:focus {
    border-color: #8b9dc3 !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(139, 157, 195, 0.1) !important;
}

#nova-input::placeholder {
    color: #adb5bd !important;
}

/* Bouton envoyer */
#nova-send {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 50% !important;
    background: #8b9dc3 !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(139, 157, 195, 0.3) !important;
}

#nova-send:hover:not(:disabled) {
    background: #7a8bb5 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(139, 157, 195, 0.4) !important;
}

#nova-send:active:not(:disabled) {
    transform: scale(0.95) !important;
}

#nova-send:disabled {
    background: #cbd5e0 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.nova-send-icon {
    font-size: 20px !important;
    line-height: 1 !important;
}

/* Overlay */
#nova-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.35) !important;
    backdrop-filter: blur(1px) !important;
    z-index: 999997 !important;
    transition: opacity .25s ease !important;
    opacity: 1 !important;
}

#nova-overlay.nova-hidden { 
    opacity: 0 !important; 
    pointer-events: none !important; 
}

/* Cache la bulle quand le panel est ouvert */
body.nova-open #nova-chat-bubble { 
    display: none !important; 
}

/* Scrollbar */
#nova-messages::-webkit-scrollbar {
    width: 8px !important;
}

#nova-messages::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

#nova-messages::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 4px !important;
}

#nova-messages::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    #nova-chat-panel {
        width: 100% !important;
    }
    
    #nova-chat-bubble {
        bottom: 15px !important;
        right: 15px !important;
        width: 55px !important;
        height: 55px !important;
    }
    
    #nova-header {
        padding: 18px 20px !important;
        min-height: 85px !important;
    }
    
    #nova-messages {
        padding: 15px !important;
    }
    
    #nova-input-area {
        padding: 15px 15px 20px 15px !important;
    }
}
