/* Reset et base - FORCE les styles */
#nova-chat-panel,
#nova-chat-panel *,
#nova-chat-bubble,
#nova-chat-bubble * {
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Bulle de chat en bas à droite */
#nova-chat-bubble {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px 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;
}

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

.nova-bubble-icon {
    font-size: 28px !important;
    line-height: 1 !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;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

/* État caché - panneau sort de l'écran à droite */
#nova-chat-panel.nova-hidden {
    transform: translateX(100%) !important;
}

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

/* En-tête - Design plus clair et moderne */
#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;
}

.nova-avatar {
    font-size: 44px !important;
    width: 55px !important;
    height: 55px !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;
}

.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;
}

/* Bouton fermer - plus visible */
.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 - plus d'espace et plus claire */
#nova-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 25px !important;
    background: #ffffff !important;
    min-height: 0 !important;
}

/* Style des messages */
.nova-message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

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

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

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

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

/* Message utilisateur */
.nova-user .nova-message-content {
    background: #007cff;
    color: white;
    margin-left: 40px;
}

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

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

/* Message agent */
.nova-agent .nova-message-content {
    margin-right: 40px;
}

/* Liens dans les messages */
.nova-message-content a {
    color: #007cff;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.nova-message-content a:hover {
    opacity: 0.8;
}

.nova-user .nova-message-content a {
    color: white;
}

/* Indicateur de saisie */
.nova-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: white;
    border-radius: 12px;
    margin-right: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

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

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

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

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

/* Zone de saisie - Style moderne comme screenshots */
#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 - circulaire moderne */
#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;
    transform: scale(1) !important;
    box-shadow: none !important;
    opacity: 0.6 !important;
}

.nova-send-icon {
    font-size: 20px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Responsive - Adaptation mobile complète */
@media (max-width: 768px) {
    /* Panneau en plein écran sur mobile */
    #nova-chat-panel {
        width: 100% !important;
        right: 0 !important;
        left: 0 !important;
    }
    
    /* Bulle légèrement plus petite */
    #nova-chat-bubble {
        bottom: 15px !important;
        right: 15px !important;
        width: 55px !important;
        height: 55px !important;
    }
    
    .nova-bubble-icon {
        font-size: 26px !important;
    }
    
    /* En-tête plus compact */
    #nova-header {
        padding: 18px 20px !important;
        min-height: 85px !important;
    }
    
    .nova-avatar {
        font-size: 38px !important;
        width: 48px !important;
        height: 48px !important;
    }
    
    .nova-title h3 {
        font-size: 18px !important;
    }
    
    .nova-status {
        font-size: 13px !important;
    }
    
    .nova-close-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 28px !important;
    }
    
    /* Messages plus compacts */
    #nova-messages {
        padding: 15px !important;
    }
    
    .nova-message {
        margin-bottom: 15px !important;
    }
    
    .nova-message-content {
        padding: 12px 16px !important;
        max-width: 90% !important;
        border-radius: 16px !important;
    }
    
    .nova-message-content strong {
        font-size: 11px !important;
        margin-bottom: 5px !important;
    }
    
    .nova-message-content p {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }
    
    /* Zone de saisie adaptée */
    #nova-input-area {
        padding: 15px 15px 20px 15px !important;
        min-height: 75px !important;
        gap: 10px !important;
    }
    
    #nova-input {
        padding: 12px 16px !important;
        font-size: 14px !important;
        border-radius: 22px !important;
    }
    
    #nova-send {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }
    
    .nova-send-icon {
        font-size: 18px !important;
    }
    
    /* Indicateur de saisie */
    .nova-typing {
        padding: 12px 16px !important;
        max-width: 90% !important;
    }
}

/* Très petits écrans (< 375px) */
@media (max-width: 374px) {
    .nova-message-content {
        max-width: 95% !important;
    }
    
    #nova-input-area {
        padding: 12px 12px 18px 12px !important;
    }
    
    .nova-title h3 {
        font-size: 16px !important;
    }
}

/* Scrollbar personnalisée */
#nova-messages::-webkit-scrollbar {
    width: 8px;
}

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

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

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

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

/* Overlay plein écran cliquable */
#nova-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.35) !important;
  backdrop-filter: blur(1px);
  z-index: 999997 !important; /* juste sous le panel */
  transition: opacity .25s ease !important;
  opacity: 1 !important;
}
#nova-overlay.nova-hidden { opacity: 0 !important; pointer-events: none !important; }

/* Micro-polish */
#nova-chat-panel { border-left: 1px solid #e9ecef !important; }
#nova-messages { scroll-behavior: smooth; }
