/* ****** Partie 1 Variables de couleurs Furzo ******** */
:root {
    --furzo-primary: #8e62e1;
    --furzo-primary-hover: #7b52c6;
    --furzo-primary-light: #cba8f0;
    --furzo-bg-active: #f8f6fb;
    --furzo-border: #f4f4f4;
    --furzo-text-dark: #333333;
    --furzo-text-muted: #888888;
    --furzo-white: #ffffff;
}

/* ****** Partie 2 Structure globale du Chat ******** */
.furzo-chat-wrapper {
    display: flex;
    gap: 0;
    background: var(--furzo-white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    overflow: hidden;
    height: 75vh;
    font-family: inherit;
}

/* ****** Partie 3 Panneau latéral gauche (Conversations) ******** */
.furzo-chat-sidebar {
    width: 28%;
    border-right: 1px solid var(--furzo-border);
    display: flex;
    flex-direction: column;
}

.furzo-chat-search {
    padding: 20px;
    border-bottom: 1px solid var(--furzo-border);
}

.furzo-chat-search input {
    width: 100%;
    border-radius: 30px;
    padding: 10px 18px;
    border: 1px solid #eaeaea;
    background: #fafafa;
    font-size: 13px;
    outline: none;
}

.furzo-conversations {
    overflow-y: auto;
    flex: 1;
}

.furzo-conversation-item {
    padding: 18px 20px;
    border-bottom: 1px solid #fcfcfc;
    cursor: pointer;
    transition: background 0.2s, border-left 0.2s;
    border-left: 4px solid transparent;
}

.furzo-conversation-item:hover {
    background: #fafafa;
}

.furzo-conversation-item.active {
    background: var(--furzo-bg-active);
    border-left: 4px solid var(--furzo-primary);
}

.furzo-conv-unread {
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 0 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.3);
    line-height: 1;
}

.furzo-conversation-item strong {
    color: var(--furzo-text-dark);
    font-size: 14px;
}

.furzo-conversation-item span {
    font-size: 12px;
    color: var(--furzo-text-muted);
}

/* ****** Partie 4 Panneau central (Discussion) ******** */
.furzo-chat-main {
    width: 47%;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
}

.furzo-chat-header {
    padding: 20px;
    background: var(--furzo-white);
    border-bottom: 1px solid var(--furzo-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.furzo-chat-history {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ****** Partie 5 Bulles de messages ******** */
.furzo-message {
    max-width: 75%;
    padding: 14px 20px;
    font-size: 14px;
    line-height: 1.5;
}

.furzo-message-client {
    align-self: flex-start;
    background: var(--furzo-white);
    color: #444;
    border-radius: 20px 20px 20px 4px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.furzo-message-vendor {
    align-self: flex-end;
    background: var(--furzo-primary);
    color: var(--furzo-white);
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 12px rgba(142, 98, 225, 0.2);
}

.furzo-message-system {
    align-self: center;
    background: #f4f4f4;
    color: var(--furzo-text-muted);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 11px;
    margin: 10px 0;
}

/* ****** Partie 6 Zone de saisie ******** */
.furzo-chat-input-area {
    padding: 18px 25px;
    background: var(--furzo-white);
    border-top: 1px solid var(--furzo-border);
    display: flex;
    gap: 12px;
    align-items: center;
}

.furzo-btn-attachment {
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.furzo-btn-attachment:hover {
    color: var(--furzo-primary);
}

.furzo-chat-input-area input[type="text"] {
    flex: 1;
    border-radius: 30px;
    border: 1px solid #eaeaea;
    background: #f9f9f9;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
}

.furzo-btn-send {
    background: var(--furzo-primary);
    color: var(--furzo-white);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(142, 98, 225, 0.3);
    transition: background 0.2s;
}

.furzo-btn-send:hover {
    background: var(--furzo-primary-hover);
}

/* ****** Partie 7 Panneau de droite (Outils et WIP) ******** */
.furzo-chat-tools {
    width: 25%;
    background: var(--furzo-white);
    border-left: 1px solid var(--furzo-border);
    padding: 25px;
    overflow-y: auto;
}

.furzo-tools-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #999;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

.furzo-ref-sheet-box {
    width: 100%;
    height: 160px;
    background: #fbfbfb;
    border-radius: 12px;
    border: 2px dashed #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 30px;
}

.furzo-ref-sheet-box:hover {
    background: #f0f0f0;
}

.furzo-wip-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.furzo-wip-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
}

.furzo-wip-item input[type="checkbox"] {
    accent-color: var(--furzo-primary);
}

.furzo-btn-add-wip {
    width: 100%;
    padding: 10px;
    background: #fdfdfd;
    border: 1px dashed var(--furzo-primary-light);
    color: var(--furzo-primary);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.furzo-btn-add-wip:hover {
    background: var(--furzo-bg-active);
}

/* ****** Partie 8 Pièces jointes et Prévisualisation ******** */
.furzo-chat-input-area {
    position: relative; /* Nécessaire pour placer la prévisualisation juste au-dessus */
}

/* La petite boîte d'aperçu de l'image */
.furzo-attachment-preview {
    display: none; /* Caché par défaut */
    position: absolute;
    bottom: 100%;
    left: 25px;
    background: #ffffff;
    border: 1px solid #eaeaea;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    z-index: 10;
}

.furzo-attachment-preview img {
    max-height: 40px;
    max-width: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.furzo-attachment-preview span {
    font-size: 12px;
    color: #555;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Le petit bouton rouge pour annuler l'image */
.furzo-btn-remove-attachment {
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.furzo-btn-remove-attachment:hover {
    background: #cc0000;
}

/* Correction de l'apparence du bouton image (anti-moche) */
.furzo-btn-attachment {
    background: transparent !important;
    border: none !important;
    color: #a0a0a0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.furzo-btn-attachment:hover, .furzo-btn-attachment:focus {
    color: var(--furzo-primary) !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* ****** Partie 9 Taille maximale des images envoyées ******** */
.furzo-message img {
    max-width: 100%;
    max-height: 250px; /* Brider la hauteur pour ne pas envahir l'écran */
    object-fit: contain; /* Garder les proportions sans déformer */
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
    background: #fdfdfd; /* Fond clair au cas où l'image est transparente */
}

/* ****** Partie 10 - Version Mobile (Panneaux coulissants) ******** */
.furzo-mobile-btn, .furzo-mobile-close {
    display: none; /* Caché sur PC */
}

@media (max-width: 992px) {
    .furzo-chat-wrapper {
        position: relative;
        overflow: hidden; 
    }
    
    .furzo-chat-main {
        width: 100%;
    }

    /* De vrais boutons bien visibles pour ouvrir les panneaux */
    .furzo-mobile-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
        background: var(--furzo-primary);
        color: white !important;
        border: none;
        padding: 8px 15px;
        border-radius: 20px;
        font-size: 13px;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        text-decoration: none;
    }

    .furzo-chat-header {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        gap: 15px;
    }

    .furzo-chat-header-title {
        width: 100%;
        text-align: center;
        order: -1; /* Force le titre à se mettre au-dessus des boutons */
    }

    /* Bouton pour fermer les panneaux à l'intérieur */
    .furzo-mobile-close {
        display: block;
        text-align: center;
        padding: 15px;
        background: #f4f4f4;
        color: #333;
        border-bottom: 1px solid var(--furzo-border);
        cursor: pointer;
        font-weight: bold;
    }

    /* Panneau de Gauche (Liste des discussions) */
    .furzo-chat-sidebar {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        background: white; z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    .furzo-chat-sidebar.show-sidebar { transform: translateX(0); }

    /* Panneau de Droite (Outils) */
    .furzo-chat-tools {
        position: absolute;
        top: 0; right: 0; width: 100%; height: 100%;
        background: white; z-index: 100;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }
    .furzo-chat-tools.show-tools { transform: translateX(0); }

}

/* ****** Partie 11 - Temps réel & Améliorations visuelles ******** */
.furzo-typing-indicator {
    display: none;
    align-self: flex-start;
    background: #f0f0f0;
    padding: 12px 18px;
    border-radius: 20px;
    margin-bottom: 10px;
    width: fit-content;
}

.furzo-typing-indicator span {
    display: inline-flex; vertical-align: middle;
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    margin: 0 2px;
    animation: furzo-bounce 1.4s infinite ease-in-out both;
}

.furzo-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.furzo-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes furzo-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.furzo-message { position: relative; }
.furzo-message-status { display: block; font-size: 10px; text-align: right; margin-top: 5px; opacity: 0.8; }
.furzo-status-seen { color: #4facfe; font-weight: bold; }
.furzo-message-client .furzo-status-seen { color: #cce0ff; }

.furzo-new-wip-input {
    flex: 1; border: 1px solid #eaeaea !important; border-radius: 8px !important;
    padding: 12px 15px !important; font-size: 14px !important; outline: none;
    background: #fdfdfd; height: 45px !important; box-sizing: border-box;
}

.furzo-btn-add-wip {
    background: #8e62e1 !important; color: white !important; border: none !important;
    border-radius: 8px !important; width: 45px !important; height: 45px !important;
    cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px;
}

/* ****** Partie 12 - Heure, Date, Modifié et Anti-doublon ******** */
.furzo-message-footer {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin-top: 6px;
    font-size: 10px;
    color: inherit;
    opacity: 0.75;
    gap: 8px;
}

.furzo-message-edited { font-style: italic; opacity: 0.8; margin-right: auto; } /* Se pousse à gauche */
.furzo-message-time { white-space: nowrap; margin-left: auto; }
.furzo-temp-message { opacity: 0.6; }

/* ****** Partie 13 - Actions (Modifier / Épingler) ******** */
.furzo-msg-content-text { white-space: pre-wrap; }

.furzo-message-actions {
    display: none; position: absolute; top: -12px; right: 10px;
    background: white; border: 1px solid #eaeaea; border-radius: 15px;
    padding: 4px 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 10; gap: 8px;
}
.furzo-message-client .furzo-message-actions { right: auto; left: 10px; }
.furzo-message:hover .furzo-message-actions { display: flex; }

.furzo-action-btn { cursor: pointer; color: #888; font-size: 12px; background: none; border: none; padding: 0; outline: none; }
.furzo-action-btn:hover { color: #8e62e1; }

.furzo-pinned-item {
    background: #fdfdfd; padding: 10px; font-size: 12px; margin-bottom: 10px;
    border-radius: 0 6px 6px 0; position: relative; border: 1px solid #eaeaea; border-left: 3px solid #8e62e1;
}
.furzo-pinned-text { color: #444; word-wrap: break-word; margin-top: 4px; }
.furzo-pinned-author { font-weight: bold; color: #8e62e1; }
.furzo-unpin-btn { position: absolute; top: 8px; right: 8px; cursor: pointer; color: #ff4d4d; font-size: 11px; background: none; border: none; }

.furzo-edit-input { width: 100%; border: 1px solid #ccc; border-radius: 4px; padding: 6px; font-size: 13px; margin-bottom: 5px; font-family: inherit; resize: vertical; }
.furzo-edit-actions { display: flex; gap: 5px; justify-content: flex-end; }
.furzo-edit-actions button { padding: 4px 8px; font-size: 11px; border-radius: 4px; border: none; cursor: pointer; }
.furzo-edit-save { background: #28a745; color: white; }
.furzo-edit-cancel { background: #e0e0e0; color: #333; }

/* ****** CORRECTIFS INTERFACE ******** */

/* Centrage parfait de l'icône du bouton d'envoi et anti-écrasement */
.furzo-btn-send {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    flex-shrink: 0 !important; /* Empêche l'effet œuf ! */
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
}

/* On protège aussi le bouton Fursona/Pièce jointe pour qu'il ne s'écrase pas */
.furzo-btn-attachment {
    flex-shrink: 0 !important;
}
.furzo-btn-send i {
    margin: 0 !important;
}

/* Suppression de l'affreux contour orange sur les boutons d'action (Epingle, Edit) */
.furzo-action-btn:hover, 
.furzo-action-btn:focus, 
.furzo-action-btn:active,
.furzo-btn-attachment:focus {
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent;
}
.furzo-btn-send:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Petit effet visuel propre au survol des actions */
.furzo-action-btn:hover {
    opacity: 0.7;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* ****** REFECTION INTERFACE : EDITION, EPINGLES ET PIECES JOINTES ******** */

/* 1. Interface de Modification (Edit) */
.furzo-edit-input {
    width: 100%;
    min-width: 250px;
    border: 1px solid #dcdde1;
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 8px;
    background: #ffffff;
    color: #333;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.furzo-edit-input:focus {
    outline: none !important;
    border-color: #8e62e1;
}
.furzo-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.furzo-edit-cancel, .furzo-edit-save {
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    line-height: 1 !important;
}
.furzo-edit-cancel {
    background: #f1f2f6 !important;
    color: #576574 !important;
}
.furzo-edit-cancel:hover { background: #dfe4ea !important; }
.furzo-edit-save {
    background: #8e62e1 !important;
    color: white !important;
}
.furzo-edit-save:hover { background: #7a52c3 !important; }

/* 2. Bouton Supprimer l'image (Croix rouge arrondie) */
.furzo-btn-remove-attachment {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    background: #ff4757 !important;
    color: white !important;
    border: 2px solid white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: -8px !important;
    right: -8px !important;
    cursor: pointer !important;
    padding: 0 !important;
    font-size: 10px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    transition: transform 0.2s ease !important;
}
.furzo-btn-remove-attachment:hover { transform: scale(1.15) !important; }

/* 3. Bouton Désépingler */
.furzo-unpin-btn {
    background: transparent !important;
    border: none !important;
    color: #ff4757 !important;
    cursor: pointer !important;
    padding: 5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.5;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}
.furzo-unpin-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* ****** MODAL IMAGE PLEIN ECRAN (LIGHTBOX) ******** */
.furzo-image-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    flex-direction: column;
}
.furzo-image-modal.active {
    display: flex;
    animation: furzoFadeIn 0.2s ease-in-out;
}
@keyframes furzoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.furzo-image-modal img {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    object-fit: contain;
}
.furzo-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    background: none;
    border: none;
    outline: none;
}
.furzo-modal-close:hover { color: #ff4757; }
.furzo-modal-download {
    margin-top: 20px;
    background: #8e62e1;
    color: white !important;
    padding: 10px 25px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
}
.furzo-modal-download:hover {
    background: #7a52c3;
    transform: translateY(-2px);
}

/* ****** PASTILLES DE NOTIFICATION (CORRECTIF DASHBOARD) ******** */

/* Style universel de la pastille rouge dans les menus */
.furzo-dokan-menu-badge {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    background-color: #ff4757 !important;
    color: white !important;
    font-size: 10px !important;
    font-weight: bold !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    z-index: 9999 !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

/* ****** PASTILLES DE NOTIFICATION (CORRECTIF DASHBOARD) ******** */

@keyframes furzoPopIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ****** ANTI DOUBLE-LOGO ET PASTILLES (NOUVEAU MENU DOKAN TAILWIND) ******** */


/* 3. La pastille rouge (Le "1") sur le menu du Dashboard Dokan et WooCommerce */
a[href*="dashboard/message"][data-furzo-badge]::after,
.woocommerce-MyAccount-navigation-link--message a[data-furzo-badge]::after {
    content: attr(data-furzo-badge);
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    background-color: #ff4757 !important;
    color: white !important;
    font-size: 10px !important;
    font-weight: bold !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    z-index: 99999 !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

/* 4. On s'assure que le lien du menu ne "coupe" pas la pastille qui dépasse */
a[href*="dashboard/message"] {
    position: relative !important;
    overflow: visible !important;
}

/* ****** SYSTEME FURSONA ET EPINGLE REF SHEET ******** */

/* 1. Bouton "Pin to Ref" sur les images */
.furzo-image-wrapper {
    position: relative;
    display: inline-flex; vertical-align: middle;
}
.furzo-pin-to-ref {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(142, 98, 225, 0.9);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 5;
}
.furzo-image-wrapper:hover .furzo-pin-to-ref {
    opacity: 1;
}
.furzo-pin-to-ref:hover {
    transform: scale(1.1);
    background: #8e62e1;
}

/* 2. Popup Sélecteur de Fursona */
.furzo-fursona-selector-popup {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: white;
    width: 320px;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 99999;
    padding: 15px;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    overflow-y: auto;
}
.furzo-fursona-selector-popup.active {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.furzo-fursona-selector-popup h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #333;
    text-align: center;
}
.furzo-fursona-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.furzo-fursona-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.furzo-fursona-item:hover { transform: scale(1.05); }
.furzo-fursona-item img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #eee;
}
.furzo-fursona-item small {
    display: block;
    font-size: 10px;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
}

/* ****** BOUTON PROFIL FURSONA ******** */
.furzo-btn-fursona-link {
    display: inline-flex; vertical-align: middle;
    margin-top: 8px;
    background: #8e62e1;
    color: white !important;
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 11px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(142, 98, 225, 0.2);
}
.furzo-btn-fursona-link i {
    margin-right: 5px;
}
.furzo-btn-fursona-link:hover {
    background: #7a52c3;
    transform: translateY(-2px);
}
/* On adapte la couleur si c'est l'autre qui l'envoie (fond blanc) */
.furzo-message-vendor .furzo-btn-fursona-link {
    background: #f1f2f6;
    color: #8e62e1 !important;
    box-shadow: none;
}
.furzo-message-vendor .furzo-btn-fursona-link:hover {
    background: #dfe4ea;
}

/* ****** REPARATION DE LA COLONNE OUTILS (PROJET) ******** */

/* 1. Le conteneur principal devient une colonne aérée */
.furzo-chat-tools {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    padding: 20px !important;
    gap: 20px !important; /* Espacement magique entre chaque section ! */
    background: #ffffff;
}

/* 2. Les titres de sections (Lignes séparatrices en dessous) */
.furzo-tools-title {
    margin: 0 !important;
    padding: 0 0 8px 0 !important;
    border-top: none !important;
    border-bottom: 2px solid #eaeaea !important; 
    font-size: 11px !important;
    color: #888 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    width: 100% !important;
    display: block !important;
    position: relative !important;
}

/* 3. Conteneur Ref Sheet : S'adapte à la hauteur de son contenu */
.furzo-ref-sheet-box {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
}

/* 4. La Carte Ref Sheet (Design Application) */
.furzo-ref-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    background: #fff !important;
    border: 1px solid #eaeaea !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
}

.furzo-ref-image-container {
    width: 100% !important;
    max-height: 250px !important;
    background: #1e272e !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.furzo-ref-main-image {
    max-width: 100% !important;
    max-height: 250px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    cursor: pointer !important;
    transition: opacity 0.2s !important;
}
.furzo-ref-main-image:hover { opacity: 0.8 !important; }

/* 5. La zone des boutons de la carte */
.furzo-ref-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px !important;
    background: #f8f9fa !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 6. Les boutons d'action de la Ref Sheet */
.furzo-ref-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 10px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: bold !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border: none !important;
    box-sizing: border-box !important;
    line-height: 1.2 !important;
}
.furzo-ref-btn i { margin-right: 8px !important; font-size: 14px !important; }

/* Couleurs des boutons */
.furzo-ref-btn-primary { background-color: #8e62e1 !important; color: white !important; }
.furzo-ref-btn-primary:hover { background-color: #7a52c3 !important; }

.furzo-ref-btn-secondary { background-color: #1e272e !important; color: white !important; }
.furzo-ref-btn-secondary:hover { background-color: #2f3640 !important; }

.furzo-ref-btn-outline { background-color: #e4e5e9 !important; color: #444 !important; }
.furzo-ref-btn-outline:hover { background-color: #d1d8e0 !important; }

.furzo-ref-btn-danger { background-color: #fff0f0 !important; color: #ff4757 !important; border: 1px solid #ffcccc !important; }
.furzo-ref-btn-danger:hover { background-color: #ff4757 !important; color: white !important; border-color: #ff4757 !important; }

/* 7. Design quand la Ref Sheet est vide */
.furzo-empty-ref {
    text-align: center !important;
    padding: 25px 15px !important;
    border: 2px dashed #dcdde1 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    background: transparent !important;
}
.furzo-empty-ref:hover { background: #f8f9fa !important; }
.furzo-empty-ref i { color: #8e62e1 !important; font-size: 28px !important; margin-bottom: 10px !important; }
.furzo-empty-ref span { font-size: 13px !important; color: #555 !important; font-weight: bold !important; }

.furzo-ref-loader {
    text-align: center !important;
    padding: 20px !important;
    font-size: 13px !important;
    color: #8e62e1 !important;
    border: 1px solid #eaeaea !important;
    border-radius: 8px !important;
}

/* ****** DESIGN DU PANNEAU PROJET (SEPARATEURS) ******** */

/* Séparation visuelle entre les sections (Epingles, Ref, Checklist) */
.furzo-tools-title {
    margin: 25px 0 15px 0 !important;
    padding-top: 20px;
    border-top: 2px solid #f1f2f6; /* La ligne grise de séparation */
    display: flex;
    align-items: center;
}

/* On enlève la ligne au-dessus du tout premier titre */
.furzo-tools-title:first-of-type {
    margin-top: 0 !important;
    padding-top: 0;
    border-top: none;
}

/* Style du bouton "Supprimer" de la Ref Sheet */
.furzo-ref-btn-danger {
    background-color: #fff0f0;
    color: #ff4757 !important;
    border: 1px solid #ffcccc;
}
.furzo-ref-btn-danger:hover {
    background-color: #ff4757;
    color: white !important;
    border-color: #ff4757;
}

/* ****** FORCER LE SCROLL DE L'HISTORIQUE ******** */
.furzo-chat-history {
    flex-grow: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    scroll-behavior: smooth !important;
    padding: 20px !important;
}

/* ****** MODE APPLICATION PLEIN ECRAN (NETTOYAGE ET MOBILE) ******** */

/* On masque le Footer de ton thème UNIQUEMENT sur la page chat pour faire de la place ! */
body.furzo-is-chat-page footer,
body.furzo-is-chat-page #colophon,
body.furzo-is-chat-page .site-footer {
    display: none !important;
}

/* Le wrapper s'adapte maintenant grâce aux mathématiques du JavaScript ! */
.furzo-chat-wrapper {
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
    border: 1px solid #eaeaea !important;
    margin-bottom: 0 !important;
}

/* Protection spécifique sur Mobile/Tablette (Boutons Flottants) */
@media (max-width: 992px) {
    .furzo-chat-wrapper {
        border-radius: 0 !important; 
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
    }
    
    /* Le fameux "coussin" invisible qui remonte la barre de saisie au-dessus du drapeau et de la cloche */
    .furzo-chat-input-area {
        padding-bottom: 95px !important; 
    }

    /* On protège aussi le bas des autres tiroirs */
    .furzo-chat-sidebar,
    .furzo-chat-tools {
        padding-bottom: 100px !important;
    }
}

/* ****** SUPPRESSION DU VIDE EN BAS DE PAGE (THEME/DOKAN/WOO) ******** */

/* On écrase impitoyablement les marges et hauteurs minimum de tous les conteneurs du site */
body.furzo-is-chat-page .site-content,
body.furzo-is-chat-page .site-main,
body.furzo-is-chat-page #main,
body.furzo-is-chat-page #content,
body.furzo-is-chat-page #primary,
body.furzo-is-chat-page #page,
body.furzo-is-chat-page .dokan-dashboard-wrap,
body.furzo-is-chat-page .dokan-dashboard-content,
body.furzo-is-chat-page .woocommerce-MyAccount-content,
body.furzo-is-chat-page .elementor-section-wrap,
body.furzo-is-chat-page .elementor-widget-wrap {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
}

/* On force la boîte du chat à ne pas créer de marge non plus */
.furzo-chat-wrapper {
    margin-bottom: 0 !important;
    border-bottom: none !important;
}

/* ****** NETTOYAGE DES BANNIERES DOKAN (SUR LA PAGE CHAT) ******** */

/* On cache la bannière "Compléter votre boutique" et les alertes par défaut */
body.furzo-is-chat-page .dokan-profile-completeness,
body.furzo-is-chat-page .dokan-seller-profile-progress,
body.furzo-is-chat-page .dokan-alert-warning,
body.furzo-is-chat-page .dokan-alert-info {
    display: none !important;
}

/* Si la bannière est dans un panel par défaut sans classe précise */
body.furzo-is-chat-page .dokan-dashboard-content > .dokan-panel.dokan-panel-default:first-child {
    display: none !important;
}

/* ****** ELARGISSEMENT DE LA PAGE MON COMPTE (WOOCOMMERCE) ******** */

/* On force tous les grands conteneurs de ton thème à s'élargir sur la page chat */
body.furzo-is-chat-page .site-content > .container,
body.furzo-is-chat-page .site-content > .ast-container,
body.furzo-is-chat-page .site-content > .wrap,
body.furzo-is-chat-page #content .col-full,
body.furzo-is-chat-page .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 1400px !important; /* Très large ! */
    width: 98% !important;
}

@media (min-width: 769px) {
    body.furzo-is-chat-page .woocommerce-MyAccount-navigation {
        width: 25% !important; /* Le menu respire à nouveau */
        min-width: 220px !important; /* Il ne pourra jamais être trop écrasé */
    }
    body.furzo-is-chat-page .woocommerce-MyAccount-content {
        width: calc(75% - 30px) !important; /* Le reste de la place pour le chat, avec une marge de sécurité */
        float: right !important;
    }
}

/* ****** CORRECTION DU BOUTON "+" (CHECKLIST) ******** */
.furzo-add-wip-container {
    display: flex !important;
    gap: 5px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
.furzo-new-wip-input {
    flex-grow: 1 !important;
    width: 100% !important;
    min-width: 0 !important; /* Empêche l'input de s'étendre indéfiniment */
    box-sizing: border-box !important;
}
.furzo-btn-add-wip {
    flex-shrink: 0 !important; /* C'est ce qui empêche le bouton de se faire écraser ! */
    width: 40px !important;
    box-sizing: border-box !important;
}

/* ****** DESIGN DES FILTRES DE CONVERSATIONS (AMÉLIORÉ) ******** */
.furzo-chat-filters {
    display: flex;
    border-bottom: 1px solid #eaeaea;
    background: #f8f9fa;
    padding: 6px 8px 0 8px; /* Ajoute un peu d'espace autour des onglets */
    gap: 4px; /* Un petit espace entre les deux boutons */
}

.furzo-filter-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 5px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-bottom: 3px solid transparent; /* Bordure un peu plus épaisse */
    border-radius: 6px 6px 0 0; /* Coins arrondis uniquement en haut */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); /* Transition ultra-fluide */
}

/* 1. État : Survol (Hover) de la souris */
.furzo-filter-btn:hover {
    color: #8e62e1; /* Le texte prend ta couleur violette Furzo */
    background-color: rgba(142, 98, 225, 0.06); /* Un fond violet très léger apparaît */
}

/* 2. État : Clic (Active) quand on enfonce le bouton gauche */
.furzo-filter-btn:active {
    transform: translateY(2px); /* Le bouton s'enfonce physiquement vers le bas */
    background-color: rgba(142, 98, 225, 0.12); /* Le fond se fonce un peu plus */
}

/* 3. État : Onglet Sélectionné (.active) */
.furzo-filter-btn.active {
    color: #8e62e1;
    border-bottom-color: #8e62e1;
    background-color: #ffffff; /* Le fond devient blanc pour se lier à la liste en dessous */
    box-shadow: 0 -3px 6px rgba(0,0,0,0.02); /* Une micro-ombre pour donner un effet de relief */
}

/* Les titres de catégories "En cours" et "Terminées" */
.furzo-conv-category {
    padding: 10px 15px 6px 15px;
    font-size: 11px;
    font-weight: 800;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #ffffff;
    border-bottom: 1px solid #f9f9f9;
}

/* ****** MODE EMBARQUÉ (SUR LES PAGES COMMANDES) ******** */
.furzo-embedded-mode {
    height: 600px !important; /* Hauteur fixe parfaite pour gérer une commande */
    min-height: 600px !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 8px !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05) !important;
}

/* On cache la liste des conversations (inutile sur une commande précise) */
.furzo-embedded-mode .furzo-chat-sidebar {
    display: none !important;
}

/* Le bouton d'ouverture dans la commande */
.furzo-toggle-embedded-btn {
    transition: background-color 0.3s ease, transform 0.1s ease;
}
.furzo-toggle-embedded-btn:active {
    transform: scale(0.98);
}

/* ****** FORCER LE MODE MOBILE POUR LE TCHAT EMBARQUÉ ******** */
.furzo-embedded-mode {
    position: relative !important;
    overflow: hidden !important;
}

.furzo-embedded-mode .furzo-chat-main {
    width: 100% !important;
    flex: none !important;
}

/* On cache la barre latérale des outils par défaut et on la fait flotter comme sur mobile */
.furzo-embedded-mode .furzo-chat-tools {
    position: absolute !important;
    top: 0 !important;
    right: -100% !important;
    width: 320px !important;
    max-width: 90% !important;
    height: 100% !important;
    background: white !important;
    z-index: 100 !important;
    transition: right 0.3s ease !important;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1) !important;
}

.furzo-embedded-mode .furzo-chat-tools.show-tools {
    right: 0 !important;
}

/* On force l'affichage des boutons mobiles dans le header du chat */
.furzo-embedded-mode #furzo-toggle-tools {
    display: inline-block !important; 
}
.furzo-embedded-mode #furzo-toggle-sidebar {
    display: none !important; /* La sidebar de gauche est complètement désactivée ici */
}
.furzo-embedded-mode .furzo-mobile-close {
    display: block !important; 
}

/* ****** CORRECTION DU BOUTON PROJET (MODE EMBARQUÉ SUR PC) ******** */

/* 1. On transforme l'en-tête en flexbox pour bien séparer le Titre et le Bouton */
.furzo-embedded-mode .furzo-chat-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-right: 15px !important; /* Un peu d'espace pour que le bouton ne colle pas au bord */
}

/* 2. On donne un vrai design au bouton "Projet" (qui n'avait plus de CSS sur PC) */
.furzo-embedded-mode #furzo-toggle-tools {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background-color: #f8f9fa !important;
    color: #444 !important;
    border: 1px solid #dcdcdc !important;
    padding: 8px 15px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin-left: auto !important; /* Pousse le bouton complètement à droite */
}

/* 3. L'effet de survol (Il devient violet Furzo quand on passe la souris) */
.furzo-embedded-mode #furzo-toggle-tools:hover {
    background-color: #8e62e1 !important;
    color: white !important;
    border-color: #8e62e1 !important;
}

/* ****** DESIGN DU BOUTON "CALL TO ACTION" (PAGE COMMANDE) ******** */
.furzo-hero-chat-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    background: linear-gradient(135deg, #8e62e1 0%, #7648c9 100%) !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    padding: 16px 30px !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 20px rgba(142, 98, 225, 0.3) !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    width: 100% !important;
    max-width: 400px !important;
    text-transform: none !important;
    letter-spacing: 0.5px !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
    margin-bottom: 20px !important;
}

/* L'icône de message */
.furzo-hero-chat-btn i {
    font-size: 20px !important;
    transition: transform 0.3s ease !important;
}

/* Au survol de la souris */
.furzo-hero-chat-btn:hover {
    background: linear-gradient(135deg, #7a50c7 0%, #5a32a3 100%) !important;
    box-shadow: 0 8px 25px rgba(142, 98, 225, 0.45) !important;
    transform: translateY(-3px) !important; /* Le bouton se soulève un peu */
    color: white !important;
}

/* L'icône fait une petite animation de balancement au survol */
.furzo-hero-chat-btn:hover i {
    transform: scale(1.15) rotate(-5deg) !important; 
}

/* Au moment du clic (Sensation d'enfoncement physique) */
.furzo-hero-chat-btn:active {
    transform: translateY(1px) !important; 
    box-shadow: 0 3px 10px rgba(142, 98, 225, 0.3) !important;
}

/* === QUAND LE TCHAT EST OUVERT (Le bouton devient Rouge pour signaler "Fermer") === */
.furzo-hero-chat-btn.chat-is-open {
    background: linear-gradient(135deg, #ff4757 0%, #e84118 100%) !important;
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.3) !important;
}

.furzo-hero-chat-btn.chat-is-open:hover {
    background: linear-gradient(135deg, #ff6b81 0%, #ff4757 100%) !important;
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.45) !important;
}

/* ****** Partie 10 Style du système de réponse (Aperçu) ******** */

/* On s'assure que la zone d'input sert de point de repère */
.furzo-chat-input-area {
    position: relative;
}

/* La petite barre d'aperçu qui s'affiche au-dessus de la saisie de texte */
#furzo-reply-preview {
    display: none;
    position: absolute; /* Sort l'élément de la ligne horizontale */
    bottom: 100%; /* Le pousse exactement au-dessus de la barre de saisie */
    left: 0;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 8px 15px;
    border-left: 4px solid #8e62e1;
    font-size: 12px;
    color: #555;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #eaeaea;
    box-sizing: border-box;
    z-index: 10;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.03); /* Petite ombre légère vers le haut */
}

/* Le rendu de la citation à l'intérieur d'une bulle de message (ne change pas) */
.furzo-quote-block {
    padding: 6px 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    line-height: 1.4;
}

.furzo-message[style*="background: rgb(142, 98, 225)"] .furzo-quote-block,
.furzo-message[style*="background: #8e62e1"] .furzo-quote-block {
    background: rgba(255, 255, 255, 0.15);
    border-left: 3px solid rgba(255, 255, 255, 0.6);
    color: #ffffff;
}

.furzo-message[style*="background: rgb(255, 255, 255)"] .furzo-quote-block,
.furzo-message[style*="background: #ffffff"] .furzo-quote-block {
    background: rgba(0, 0, 0, 0.04);
    border-left: 3px solid #8e62e1;
    color: #555;
}

/* ****** ZONE DE TEXTE ÉLASTIQUE (AUTO-RESIZE) ******** */

/* On aligne les boutons (Pièce jointe et Envoi) en bas pour qu'ils restent jolis quand la zone grandit */
.furzo-chat-input-area {
    align-items: flex-end !important;
}

.furzo-btn-attachment, .furzo-btn-send {
    margin-bottom: 5px !important; /* Maintient les boutons alignés avec le bas du texte */
}

/* Le design de la nouvelle zone de texte */
#furzo-chat-text-input {
    flex-grow: 1;
    border: none;
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 20px;
    resize: none; /* Empêche l'utilisateur d'agrandir manuellement */
    outline: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 100px; /* Limite la croissance à environ 4 lignes */
    overflow-y: auto; /* Ajoute un scroll si le texte dépasse 4 lignes */
    box-sizing: border-box;
    transition: background 0.2s ease;
}

#furzo-chat-text-input:focus {
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #8e62e1; /* Petit liseré violet au focus */
}

/* On personnalise la barre de scroll interne pour qu'elle soit très discrète */
#furzo-chat-text-input::-webkit-scrollbar {
    width: 6px;
}
#furzo-chat-text-input::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}


/* ****** INTERFACE MOBILE ET MODE EMBARQUÉ (TIROIRS) ******** */

/* 1. On cache les boutons "Discussions" et "Projet" sur la version PC classique */
.furzo-chat-header-buttons {
    display: none; 
    gap: 8px;
    margin-left: auto;
}

/* 2. === RÈGLES UNIQUEMENT POUR LE MODE EMBARQUÉ (COMMANDES) === */
.furzo-embedded-mode {
    display: flex !important;
    position: relative !important;
    overflow: hidden !important;
    width: 100% !important;
}

.furzo-embedded-mode .furzo-chat-main {
    width: 100% !important;
    flex: 1 1 100% !important;
}

.furzo-embedded-mode .furzo-chat-sidebar {
    display: none !important; /* Inutile dans les commandes */
}

/* Le panneau Projet devient un tiroir caché dans les commandes */
.furzo-embedded-mode .furzo-chat-tools {
    position: absolute !important;
    top: 0 !important;
    right: -100% !important;
    width: 320px !important;
    max-width: 90% !important;
    height: 100% !important;
    background: #ffffff !important;
    z-index: 100 !important;
    transition: right 0.3s ease !important;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15) !important;
}

.furzo-embedded-mode .furzo-chat-tools.show-tools {
    right: 0 !important; /* Glisse dans l'écran */
}

.furzo-embedded-mode .furzo-mobile-close {
    display: block !important;
    padding: 15px !important;
    text-align: center !important;
    background: #fdfdfd !important;
    color: #ff4757 !important;
    font-weight: bold !important;
    cursor: pointer !important;
    border-bottom: 1px solid #eaeaea !important;
}

/* On affiche UNIQUEMENT le bouton Projet dans l'en-tête de la commande */
.furzo-embedded-mode .furzo-chat-header-buttons {
    display: flex !important; 
}
.furzo-embedded-mode #furzo-toggle-sidebar {
    display: none !important; 
}

/* 3. Le design des boutons mobiles/embarqués (Couleurs forcées) */
.furzo-mobile-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background-color: #f8f9fa !important; /* Fond gris très clair */
    color: #444444 !important; /* Texte gris foncé / noir */
    border: 1px solid #dcdcdc !important;
    padding: 8px 15px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

/* On met les icônes en violet par défaut pour que ce soit joli */
.furzo-mobile-btn i {
    color: #8e62e1 !important;
}

/* Au survol : Tout devient violet et le texte devient blanc */
.furzo-mobile-btn:hover {
    background-color: #8e62e1 !important;
    color: #ffffff !important;
    border-color: #8e62e1 !important;
}

.furzo-mobile-btn:hover i {
    color: #ffffff !important;
}

/* ****** CORRECTION: RESPONSIVE MOBILE ET TABLETTE (PAGE PRINCIPALE) ******** */
@media (max-width: 992px) {
    /* 1. On réaffiche les boutons "Discussions" et "Projet" dans l'en-tête */
    .furzo-chat-header-buttons {
        display: flex !important;
    }

    /* 2. On transforme le conteneur principal pour éviter que ça déborde de l'écran */
    .furzo-chat-wrapper {
        display: flex !important;
        position: relative !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    /* 3. La zone centrale des messages prend 100% de la place disponible */
    .furzo-chat-main {
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* 4. La colonne de gauche (Discussions) devient un tiroir caché */
    .furzo-chat-sidebar {
        position: absolute !important;
        top: 0 !important;
        left: -100% !important; /* Hors écran à gauche */
        width: 320px !important;
        max-width: 90% !important;
        height: 100% !important;
        background: #ffffff !important;
        z-index: 100 !important;
        transition: left 0.3s ease !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.15) !important;
        display: flex !important;
    }
    .furzo-chat-sidebar.show-sidebar {
        left: 0 !important; /* Apparaît quand on clique sur le bouton */
    }

    /* 5. La colonne de droite (Projet) devient un tiroir caché */
    .furzo-chat-tools {
        position: absolute !important;
        top: 0 !important;
        right: -100% !important; /* Hors écran à droite */
        width: 320px !important;
        max-width: 90% !important;
        height: 100% !important;
        background: #ffffff !important;
        z-index: 100 !important;
        transition: right 0.3s ease !important;
        box-shadow: -5px 0 25px rgba(0,0,0,0.15) !important;
    }
    .furzo-chat-tools.show-tools {
        right: 0 !important; /* Apparaît quand on clique sur le bouton */
    }

    /* 6. On affiche les boutons rouges "Fermer" à l'intérieur des tiroirs */
    .furzo-mobile-close {
        display: block !important;
        padding: 15px !important;
        text-align: center !important;
        background: #fdfdfd !important;
        color: #ff4757 !important;
        font-weight: bold !important;
        cursor: pointer !important;
        border-bottom: 1px solid #eaeaea !important;
    }
}

/* ****** ESPACEMENT ET SÉPARATEUR DE L'EN-TÊTE ******** */

.furzo-chat-header-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Permet de passer à la ligne si manque de place */
    justify-content: center;
}

.furzo-chat-header-title strong {
    font-size: 16px;
    color: #333;
}

/* Le texte de la commande avec sa barre séparatrice */
.furzo-chat-header-title span {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid #eaeaea; /* La petite barre de séparation */
    color: #888;
    font-size: 14px;
    font-weight: 500;
}

/* Si l'écran est un tout petit téléphone, on met la commande en dessous du pseudo */
@media (max-width: 500px) {
    .furzo-chat-header-title {
        flex-direction: column;
        line-height: 1.3;
    }
    .furzo-chat-header-title span {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        font-size: 12px;
        margin-top: 2px;
    }
}

/* ****** DESIGN DU BLOC DE TRADUCTION ******** */
.furzo-translation-block {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

/* Si la traduction est dans TA bulle (fond violet) */
.furzo-message[style*="background: rgb(142, 98, 225)"] .furzo-translation-block,
.furzo-message[style*="background: #8e62e1"] .furzo-translation-block {
    background: rgba(255, 255, 255, 0.15);
    border-left: 3px solid rgba(255, 255, 255, 0.6);
    color: #ffffff;
}

/* Si la traduction est dans la bulle de l'autre (fond blanc/gris) */
.furzo-message[style*="background: rgb(255, 255, 255)"] .furzo-translation-block,
.furzo-message[style*="background: #ffffff"] .furzo-translation-block {
    background: rgba(0, 0, 0, 0.04);
    border-left: 3px solid #8e62e1;
    color: #555;
}

.furzo-translation-header {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    opacity: 0.7;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ****** PASTILLE DE MESSAGES NON LUS (LISTE DISCUSSIONS) ******** */
.furzo-conv-unread {
    background-color: #ff4757;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 12px;
    line-height: 1.4;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
}

/* ****** ANTI DOUBLE-LOGO : NETTOYAGE EXTRÊME DU MENU DOKAN ******** */





/* 3. La pastille rouge (Le "1") sur le menu du Dashboard Dokan et WooCommerce */
a[href*="dashboard/message"][data-furzo-badge]::after,
.woocommerce-MyAccount-navigation-link--message a[data-furzo-badge]::after {
    content: attr(data-furzo-badge);
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    background-color: #ff4757 !important;
    color: white !important;
    font-size: 10px !important;
    font-weight: bold !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    z-index: 99999 !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

/* 4. On s'assure que le lien du menu ne "coupe" pas la pastille qui dépasse */
a[href*="dashboard/message"] {
    position: relative !important;
    overflow: visible !important;
}

/* ****** Partie 14 - Dropdown et Déclencheur stylé ******** */

/* Le déclencheur au format Cercle Glassmorphism */
.furzo-header-chat-wrapper {
    position: relative;
    display: inline-flex; vertical-align: middle;
}

.furzo-header-chat-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    position: relative;
    color: inherit;
}

.furzo-header-chat-trigger:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: #8e62e1;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}


/* Conteneur de l'icône */
.furzo-chat-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* L'icône en couleur Furzo */
.furzo-chat-icon {
    font-size: 20px;
    line-height: 1;
    color: #8e62e1 !important;
}

/* La pastille rouge (Ajustée pour la pilule) */
.furzo-header-badge-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border: 1.5px solid rgba(255,255,255,0.9);
}

/* Menu Déroulant (Dropdown) */
.furzo-chat-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 20px);
    right: -5px;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #eaeaea;
    z-index: 99999;
    flex-direction: column;
    overflow: hidden;
}

.furzo-chat-dropdown.active {
    display: flex;
    animation: furzoDropIn 0.2s ease-out;
}

@keyframes furzoDropIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Styles internes du dropdown */
.furzo-chat-dropdown-header {
    padding: 12px 15px;
    background: #fbfbfb;
    border-bottom: 1px solid #eaeaea;
    font-size: 13px;
    color: #333;
}

.furzo-chat-dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f9f9f9;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.furzo-chat-dropdown-item:hover {
    background: #fdfdfd;
}

.furzo-chat-dp-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #8e62e1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.furzo-chat-dp-content {
    flex-grow: 1;
    min-width: 0;
}

.furzo-chat-dp-name {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    display: flex;
    justify-content: space-between;
}

.furzo-chat-dp-time {
    font-size: 10px;
    font-weight: normal;
    color: #aaa;
}

.furzo-chat-dp-text {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.furzo-chat-dp-mark-read {
    background: none;
    border: none;
    color: #8e62e1;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: all 0.2s;
}

.furzo-chat-dp-mark-read:hover {
    opacity: 1;
    transform: scale(1.1);
}

.furzo-chat-dropdown-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #eaeaea;
}

.furzo-chat-btn-all {
    font-size: 12px;
    font-weight: 700;
    color: #8e62e1;
    text-decoration: none;
    padding: 5px 10px;
}

.furzo-chat-btn-all:hover {
    text-decoration: underline;
}
/* ****** Partie 14 - Correctifs Icnes Sidebar (Projet) ******** */
.furzo-chat-tools i {
    font-size: 1.1rem !important;
    width: auto;
    text-align: center;
}

.furzo-tools-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 25px !important;
}

.furzo-tools-title i {
    font-size: 14px !important;
    color: var(--furzo-primary);
}

.furzo-pinned-item i {
    font-size: 12px !important;
    margin-right: 5px;
}

.furzo-wip-item span {
    font-size: 13px;
    line-height: 1.4;
}

/* On force la taille des icnes dans les boutons d'action du projet */
.furzo-btn-add-wip i {
    font-size: 14px !important;
}


/* crasement des illustrations gantes injectes par WP ou plugins */
.furzo-chat-tools img, 
.furzo-chat-tools svg {
    max-width: 40px !important;
    height: auto !important;
    display: inline-block !important;
}

.furzo-chat-tools .emoji {
    width: 20px !important;
    height: 20px !important;
}

/* On rduit spcifiquement les titres qui ont des emojis */
.furzo-tools-title {
    font-size: 12px !important;
}


/* Correction des icnes gantes dans l'historique des messages */
.furzo-chat-history img.emoji, 
.furzo-chat-history .emoji {
    width: 20px !important;
    height: 20px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 4px !important;
}

/* On s'assure que rien ne dpasse dans les bulles de messages */
.furzo-message img {
    max-width: 100%;
    height: auto;
}

/* Spinner pour les outils (WIP, etc) */
.furzo-tool-loading {
    opacity: 0.5;
    pointer-events: none;
}



/* ****** Partie 20 Styles pour le mode Incrust? (Embedded) ******** */
.furzo-chat-wrapper.furzo-embedded-mode .furzo-chat-sidebar {
    display: none !important;
}

.furzo-chat-wrapper.furzo-embedded-mode .furzo-chat-main {
    width: 70% !important;
    border-left: none !important;
}

.furzo-chat-wrapper.furzo-embedded-mode .furzo-chat-tools {
    width: 30% !important;
}

@media (max-width: 992px) {
    .furzo-chat-wrapper.furzo-embedded-mode {
        flex-direction: column;
        height: auto;
    }
    .furzo-chat-wrapper.furzo-embedded-mode .furzo-chat-main,
    .furzo-chat-wrapper.furzo-embedded-mode .furzo-chat-tools {
        width: 100% !important;
        height: 500px;
    }
}

/* Am?lioration visuelle du bouton principal dans les commandes */
.furzo-hero-chat-btn {
    background: linear-gradient(135deg, var(--furzo-primary) 0%, #6c47b5 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(142, 98, 225, 0.25) !important;
}

.furzo-hero-chat-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(142, 98, 225, 0.35) !important;
    filter: brightness(1.1);
}

.furzo-hero-chat-btn.chat-is-open {
    background: #f8f9fa !important;
    color: #444 !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
}

/* ****** Partie 15 - Correction Mobile Header Dropdown (Ancrage sous bouton) ******** */
@media (max-width: 1024px) {
    .furzo-header-chat-wrapper {
        position: relative !important; /* Assure l'ancrage du dropdown */
    }
    .furzo-chat-dropdown {
        position: absolute !important;
        top: calc(100% + 12px) !important; /* Se place juste sous l'icône */
        right: -5px !important; /* Aligné au bord droit du bouton */
        left: auto !important;
        width: 290px !important;
        max-width: 85vw !important;
        z-index: 999999 !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
        background: #fff !important;
        display: none;
    }
    .furzo-chat-dropdown.active {
        display: flex !important;
        animation: furzoDropIn 0.2s ease-out;
    }
    /* Petite flèche d'indication pour le design premium */
    .furzo-chat-dropdown::before {
        content: "";
        position: absolute;
        top: -6px;
        right: 15px;
        width: 12px;
        height: 12px;
        background: #fbfbfb; /* Match avec le header du dropdown */
        border-left: 1px solid #eaeaea;
        border-top: 1px solid #eaeaea;
        transform: rotate(45deg);
    }
}

/* ****** Partie 21 Styles pour le mode Chat Global en Iframe (Kanban) ******** */
@media (min-width: 768px) {
    .furzo-chat-global-iframe {
        display: flex !important;
        flex-direction: row !important;
    }
    .furzo-chat-global-iframe .furzo-chat-sidebar {
        position: static !important;
        transform: none !important;
        width: 280px !important;
        min-width: 250px !important;
        max-width: 35% !important;
        display: flex !important;
        box-shadow: none !important;
        border-right: 1px solid var(--furzo-border) !important;
    }
    .furzo-chat-global-iframe .furzo-chat-main {
        flex: 1 !important;
        width: auto !important;
    }
    .furzo-chat-global-iframe #furzo-toggle-sidebar {
        display: none !important;
    }
    .furzo-chat-global-iframe #furzo-close-sidebar {
        display: none !important;
    }
}

