/* Widget Axia flottant */
#axia-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: auto !important;
}

/* SUPPRIMÉ : Plus de bouton "Démarrer l'analyse" - chat simple uniquement */
.axia-start-analysis-container {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

.axia-start-analysis-btn,
.axia-start-analysis-text {
    display: none !important;
    visibility: hidden !important;
}

/* Masquer le bouton pour Kira et Nexo */
#axia-widget.kira-mode .axia-start-analysis-container,
#axia-widget.nexo-mode .axia-start-analysis-container {
    display: none !important;
}

/* Mode Analyse - Indicateur visuel */
#axia-widget.analysis-mode .axia-widget-header {
    border-bottom: 3px solid #0284c7;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

#axia-widget.analysis-mode .axia-widget-header-content h3::after {
    content: ' 🔍';
    font-size: 0.9em;
}

#axia-widget.analysis-mode .axia-widget-input-area {
    border-top: 2px solid #0284c7;
    background: #f0f9ff;
}

#axia-widget.analysis-mode #axia-widget-input:disabled {
    background: #e0f2fe;
    color: #0369a1;
    cursor: not-allowed;
}

#axia-widget.analysis-mode .axia-widget-message.axia-message {
    border-left: 3px solid #0284c7;
}

#axia-widget.analysis-mode .user-message {
    border-right: 3px solid #0284c7;
}

/* Mode Kira (rose) */
#axia-widget.kira-mode .axia-widget-button {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

#axia-widget.kira-mode .axia-widget-button:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

#axia-widget.kira-mode .axia-widget-promo-text {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

#axia-widget.kira-mode .axia-widget-promo-text:hover {
    box-shadow: 0 6px 16px rgba(236, 72, 153, 0.5);
}

#axia-widget.kira-mode .axia-widget-promo-text::after {
    border-top-color: #be185d;
}

#axia-widget.kira-mode .axia-widget-header {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}

#axia-widget.kira-mode .user-message .user-message-content {
    background: #ec4899;
}

#axia-widget.kira-mode #axia-widget-send {
    background: #ec4899;
}

#axia-widget.kira-mode #axia-widget-send:hover {
    background: #be185d;
}

#axia-widget.kira-mode #axia-widget-input:focus {
    border-color: #ec4899;
}

#axia-widget.kira-mode .axia-choice-btn:hover {
    border-color: #ec4899;
    background: #fdf2f8;
}

#axia-widget.kira-mode .axia-message-avatar {
    border-color: rgba(236, 72, 153, 0.2);
}

/* Mode Nexo (vert) */
#axia-widget.nexo-mode .axia-widget-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#axia-widget.nexo-mode .axia-widget-button:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

#axia-widget.nexo-mode .axia-widget-promo-text {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#axia-widget.nexo-mode .axia-widget-promo-text:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

#axia-widget.nexo-mode .axia-widget-promo-text::after {
    border-top-color: #059669;
}

#axia-widget.nexo-mode .axia-widget-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

#axia-widget.nexo-mode .user-message .user-message-content {
    background: #10b981;
}

#axia-widget.nexo-mode #axia-widget-send {
    background: #10b981;
}

#axia-widget.nexo-mode #axia-widget-send:hover {
    background: #059669;
}

#axia-widget.nexo-mode #axia-widget-input:focus {
    border-color: #10b981;
}

#axia-widget.nexo-mode .axia-choice-btn:hover {
    border-color: #10b981;
    background: #ecfdf5;
}

#axia-widget.nexo-mode .axia-message-avatar {
    border-color: rgba(16, 185, 129, 0.2);
}

/* Texte promotionnel au-dessus de la bulle */
.axia-widget-promo-text {
    position: absolute;
    bottom: 75px;
    right: 0;
    background: linear-gradient(135deg, #0284c7 0%, #0c4a6e 100%);
    color: white;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
    animation: fadeInUp 0.5s ease;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100000 !important;
    max-width: 180px;
    text-align: center;
    line-height: 1.3;
    pointer-events: auto !important;
}

.axia-widget-promo-text:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.5);
}

.axia-widget-promo-text::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #0c4a6e;
}

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

/* Masquer le texte promotionnel quand le widget est ouvert */
#axia-widget-container.active ~ .axia-widget-button ~ .axia-widget-promo-text,
#axia-widget-container.active ~ .axia-widget-promo-text {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Bouton flottant */
.axia-widget-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0284c7 0%, #0c4a6e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
    transition: all 0.3s ease;
    color: white;
    position: relative;
    pointer-events: auto !important;
    z-index: 99999 !important;
}

.axia-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}

.axia-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Container du widget */
.axia-widget-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
    pointer-events: auto !important;
    z-index: 99999 !important;
}

.axia-widget-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header du widget */
.axia-widget-header {
    background: linear-gradient(135deg, #0284c7 0%, #0c4a6e 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.axia-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.axia-widget-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    pointer-events: auto !important;
    z-index: 100001 !important;
}

.axia-widget-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.axia-widget-switch-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    margin-right: 0.5rem;
    pointer-events: auto !important;
    z-index: 100001 !important;
}

.axia-widget-switch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.axia-widget-switch-btn.active {
    background: rgba(255, 255, 255, 0.3);
}

/* Menu contextuel pour le switch */
.axia-assistant-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    z-index: 100002 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
    pointer-events: auto !important;
}

.axia-assistant-menu.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0);
    max-height: 500px;
    overflow: visible;
    pointer-events: auto !important;
    display: block !important;
}

.axia-assistant-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.axia-assistant-menu-item:last-child {
    border-bottom: none;
}

.axia-assistant-menu-item:hover {
    background: #f8fafc;
}

.axia-assistant-menu-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.axia-assistant-menu-item-icon.axia-icon {
    background: linear-gradient(135deg, #0284c7 0%, #0c4a6e 100%);
}

.axia-assistant-menu-item-icon.kira-icon {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}

.axia-assistant-menu-item-icon.nexo-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.axia-assistant-menu-item-text {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
}

.axia-assistant-menu-item-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.axia-widget-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.axia-widget-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.axia-widget-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.axia-widget-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.axia-widget-info p {
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    opacity: 0.9;
}

.axia-widget-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    pointer-events: auto !important;
    z-index: 100001 !important;
}

.axia-widget-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Zone de messages */
.axia-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.axia-widget-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

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

.axia-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(2, 132, 199, 0.2);
}

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

.axia-message-content {
    flex: 1;
    min-width: 0;
}

.axia-message-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1e293b;
}

.axia-message .axia-message-content {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 12px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.user-message .user-message-content {
    background: #0284c7;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 4px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 80%;
}

.user-message .user-message-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: white;
}

/* Choix rapides */
.axia-quick-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.axia-choice-btn {
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.875rem;
    color: #1e293b;
    transition: all 0.2s;
    font-family: inherit;
}

.axia-choice-btn:hover {
    border-color: #0284c7;
    background: #f0f9ff;
    transform: translateX(4px);
}

.axia-choice-btn:active {
    transform: translateX(2px);
}

/* Indicateur de frappe */
.typing-indicator {
    display: none;
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    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;
    }
}

/* Zone de saisie */
.axia-widget-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

#axia-widget-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    pointer-events: auto !important;
}

#axia-widget-input:focus {
    border-color: #0284c7;
}

#axia-widget-input:disabled {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.7;
}

#axia-widget-send {
    width: 40px;
    height: 40px;
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    pointer-events: auto !important;
    z-index: 100001 !important;
}

#axia-widget-send:hover {
    background: #0c4a6e;
}

/* Responsive */
@media (max-width: 480px) {
    .axia-widget-container {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: calc(100vh - 100px);
    }
    
    #axia-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .axia-widget-promo-text {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        max-width: 200px;
        white-space: normal;
        bottom: 70px;
    }
}
