/* --- BLOC CHAT INSTAGRAM (Front & Back) --- */

.qba-chat-card {
    background: #0c1014;
    border-radius: 10px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    /* border: 1px solid #f1f1f1; */
    padding: 0;
    max-width: 100%;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.qba-chat-header {
    border-bottom: 1px solid #424242;
    display: flex;
    align-items: center;
    column-gap: 10px;
    padding: 10px 18px 9px;
    margin: 0 0 0px 0;
}

.qba-chat-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px 18px;
}

/* Groupes de bulles */
.qba-chat-group-right {
    display: flex;
    align-items: flex-end; /* Avatar en bas */
    gap: 8px;
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 85%;
}

.qba-chat-group-left {
    display: flex;
    align-items: flex-end; /* Avatar en bas */
    gap: 8px;
    align-self: flex-start;
    max-width: 85%;
}

/* Avatar */
.qba-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    /*border: 2px solid #fff;*/
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qba-chat-avatar-little {
    width: 32px;
    height: 32px;
}

.qba-chat-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* name principal */
.qba-chat-meta-titre {
    font-size: 0.90rem;
    font-weight: 500;
    color: #d0d3d8;
    margin-bottom: 4px;
    display: block;
}

/* name secondaire */
.qba-chat-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 4px;
    display: block;
}

/* Liste de bulles */
.qba-bubble-list {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Espace de 2px entre bulles */
}

/* Style de base des bulles */
.qba-bubble-left, .qba-bubble-right {
    padding: 7px 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    max-width: fit-content;
    /* border: 2px solid red; */
}

.qba-bubble-left {
    background-color: #262626;
    color: #ffffff !important;
}

.qba-bubble-right {
    background-color: #3796ef;
    color: white !important;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
    margin: 0 0 0 auto; /* aligne a droite */
}

/* --- LOGIQUE CORNERS INSTAGRAM --- */

/* GAUCHE (Invité) */
.qba-bubble-left.qba-single { border-radius: 18px 18px 18px 4px; }
.qba-bubble-left.qba-first { 
    border-radius: 18px 18px 18px 7px;
    /*border: 2px solid green;*/
}
.qba-bubble-left.qba-middle { border-radius: 4px 18px 18px 4px; }
.qba-bubble-left.qba-last {
    border-radius: 4px 18px 18px 18px;
    /*border: 2px solid lawngreen;*/
}

/* DROITE (Moi) */
.qba-bubble-right.qba-single { border-radius: 18px 18px 4px 18px; }
.qba-bubble-right.qba-first {
    border-radius: 18px 18px 4px 18px;
    /*border: 2px solid orange;*/
}
.qba-bubble-right.qba-middle { border-radius: 18px 4px 4px 18px; }
.qba-bubble-right.qba-last {
    border-radius: 18px 4px 18px 18px;
    /*border: 2px solid orangered;*/
}

/* --- SPÉCIFIQUE ÉDITEUR (Back-office Only) --- */
.editor-styles-wrapper .qba-bubble-wrapper {
    position: relative;
    margin-bottom: 2px; /* Marge visuelle en édition */
}

.editor-styles-wrapper .qba-remove-bubble {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc2626;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.editor-styles-wrapper .qba-bubble-wrapper:hover .qba-remove-bubble {
    opacity: 1;
}

.editor-styles-wrapper .qba-add-btn {
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    border: none;
    transition: transform 0.1s;
}
.editor-styles-wrapper .qba-add-btn:active { transform: scale(0.98); }
.editor-styles-wrapper .qba-add-btn.left { background: #f3f4f6; color: #1f2937; border: 1px solid #d1d5db; }
.editor-styles-wrapper .qba-add-btn.right { background: #3b82f6; color: white; }
