/* ---------- Bul flotan chat la ---------- */

.jsr-chat-bubble {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b0121f, #e00000);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(176,18,31,0.35);
    z-index: 99998;
    transition: transform 0.15s ease;
}
.jsr-chat-bubble:hover { transform: scale(1.06); }
.jsr-chat-bubble svg { width: 24px; height: 24px; stroke: #fff; }

.jsr-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #14141f;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

/* ---------- Panèl chat la ---------- */

.jsr-chat-panel {
    position: fixed;
    bottom: 156px;
    right: 20px;
    width: 340px;
    max-width: calc(100vw - 24px);
    height: 480px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.22);
    z-index: 99998;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.jsr-chat-view { display: flex; flex-direction: column; height: 100%; }

.jsr-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #b0121f, #e00000);
    color: #fff;
    flex-shrink: 0;
}
.jsr-chat-header strong { flex: 1; font-size: 14px; }

.jsr-chat-close, .jsr-chat-back {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}
.jsr-chat-close:hover, .jsr-chat-back:hover { background: rgba(255,255,255,0.28); }

/* ---------- Lis konvèsasyon ---------- */

.jsr-chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.jsr-chat-empty { text-align: center; color: #999; font-size: 12.5px; padding: 30px 16px; }

.jsr-chat-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
}
.jsr-chat-list-item:hover { background: #f8f4f4; }
.jsr-chat-list-item.jsr-chat-unread { background: #fdeaec; }

.jsr-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #b0121f;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.jsr-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }

.jsr-chat-list-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.jsr-chat-list-body strong { font-size: 12.5px; color: #111; }
.jsr-chat-list-body span { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.jsr-chat-list-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.jsr-chat-time { font-size: 9.5px; color: #aaa; }
.jsr-chat-unread-dot {
    background: #b0121f;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ---------- Fenèt konvèsasyon ---------- */

.jsr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8fafc;
}

.jsr-chat-msg { display: flex; }
.jsr-chat-msg-mine { justify-content: flex-end; }
.jsr-chat-msg-theirs { justify-content: flex-start; }

.jsr-chat-msg-bubble {
    max-width: 78%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}
.jsr-chat-msg-mine .jsr-chat-msg-bubble {
    background: linear-gradient(135deg, #b0121f, #e00000);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.jsr-chat-msg-theirs .jsr-chat-msg-bubble {
    background: #fff;
    color: #222;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}

.jsr-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.jsr-chat-input-row input {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    box-sizing: border-box;
}
.jsr-chat-input-row input:focus { outline: none; border-color: #b0121f; }

.jsr-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #b0121f;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.jsr-chat-send-btn:hover { background: #8f0e19; }

@media (max-width: 480px) {
    .jsr-chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .jsr-chat-bubble { bottom: 76px; }
}
