/* AV-Pronos — Shortcode Chat */

.avp-chat-wrap {
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #efeae2;
}

/* ── Zone messages ────────────────────────────────────────────────────────── */

.avp-chat-messages {
    height: 440px;
    overflow-y: auto;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
}

.avp-chat-loading,
.avp-chat-empty {
    margin: auto;
    text-align: center;
    color: #8c8f94;
    font-size: 13px;
    font-style: italic;
}

/* ── Bulle ────────────────────────────────────────────────────────────────── */

.avp-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 72%;
}

.avp-chat-msg-mine  { align-self: flex-end;  align-items: flex-end;  }
.avp-chat-msg-other { align-self: flex-start; align-items: flex-start; }

.avp-chat-sender {
    font-size: 11px;
    font-weight: 700;
    color: #0f9147;
    margin-bottom: 2px;
    padding: 0 6px;
}

.avp-chat-bubble {
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.10);
}

.avp-chat-msg-mine .avp-chat-bubble {
    background: #d9fdd3;
    border-radius: 12px 12px 3px 12px;
    color: #1d2327;
}

.avp-chat-msg-other .avp-chat-bubble {
    background: #fff;
    border-radius: 12px 12px 12px 3px;
    color: #1d2327;
}

.avp-chat-time {
    font-size: 10px;
    color: #a0a5b0;
    margin-top: 2px;
    padding: 0 6px;
}

.avp-chat-msg + .avp-chat-msg                           { margin-top: 2px; }
.avp-chat-msg-mine  + .avp-chat-msg-other,
.avp-chat-msg-other + .avp-chat-msg-mine                { margin-top: 10px; }

/* ── Ligne bulle + bouton supprimer ───────────────────────────────────────── */

.avp-chat-bubble-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Bouton × à gauche de la bulle pour mes messages */
.avp-chat-msg-mine .avp-chat-bubble-row  { flex-direction: row; justify-content: flex-end; }
.avp-chat-msg-other .avp-chat-bubble-row { flex-direction: row; }

.avp-chat-del-btn {
    opacity: 0;
    background: none;
    border: none;
    color: #8c8f94;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.avp-chat-msg:hover .avp-chat-del-btn { opacity: 1; }
.avp-chat-del-btn:hover { color: #d63638; background: rgba(0,0,0,0.06); }

/* ── Message supprimé ─────────────────────────────────────────────────────── */

.avp-chat-msg-deleted .avp-chat-bubble {
    background: #f0f0f0 !important;
    box-shadow: none;
}

.avp-chat-deleted-text {
    font-style: italic;
    color: #8c8f94;
    font-size: 13px;
    font-weight: normal;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.avp-chat-footer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px;
    background: #f0f2f5;
    border-top: 1px solid #ddd;
}

/* ── Emoji wrap + picker ──────────────────────────────────────────────────── */

.avp-chat-emoji-wrap {
    position: relative;
    flex-shrink: 0;
}

.avp-chat-emoji-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
}

.avp-chat-emoji-btn:hover { background: rgba(0,0,0,0.07); }

.avp-chat-newline-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #646970;
    font-size: 15px;
    line-height: 1;
    padding: 4px 7px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.avp-chat-newline-btn:hover { background: rgba(0,0,0,0.06); color: #1d2327; }

.avp-chat-emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 288px;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    padding: 8px;
    z-index: 200;
}

.avp-chat-emoji-picker[hidden] { display: none; }

.avp-emoji-category-label {
    font-size: 10px;
    font-weight: 700;
    color: #8c8f94;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 2px 2px;
    margin-top: 4px;
    display: block;
}

.avp-emoji-category-label:first-child { margin-top: 0; }

.avp-emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
}

.avp-emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    line-height: 1;
}

.avp-emoji-btn:hover { background: #f0f2f5; }

/* ── Textarea ─────────────────────────────────────────────────────────────── */

.avp-chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #1d2327;
    transition: border-color 0.15s;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.45;
    font-family: inherit;
}

.avp-chat-input:focus { border-color: #0f9147; }

/* ── Bouton envoyer ───────────────────────────────────────────────────────── */

.avp-chat-send-btn {
    background: #0f9147;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.avp-chat-send-btn:hover    { background: #0a7038; }
.avp-chat-send-btn:disabled { background: #c3c4c7; cursor: not-allowed; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .avp-chat-messages { height: 340px; padding: 10px 8px; }
    .avp-chat-msg      { max-width: 84%; }
    .avp-chat-bubble   { font-size: 13px; padding: 7px 10px; }

    .avp-chat-emoji-picker {
        width: calc(100vw - 40px);
        left: 0;
    }
}
