/* BizzSols Chat Widget — Intercom-style bubble + window */

.chat-btn-float {
    position: fixed;
    right: 20px;
    bottom: 124px;         /* middle of the stack: theme (60px) below, help (188px) above */
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    border: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    z-index: 1050;
    font-size: 24px;
}
html[dir="rtl"] .chat-btn-float { right: auto; left: 20px; }

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    padding: 4px 6px;
    min-width: 18px;
    text-align: center;
}
html[dir="rtl"] .chat-badge { right: auto; left: -4px; }

.chat-window {
    position: fixed;
    right: 16px;
    bottom: 152px;
    width: 360px;
    height: 520px;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #000);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    z-index: 1051;
    display: flex;
    flex-direction: column;
}
html[dir="rtl"] .chat-window { right: auto; left: 16px; }

@media (max-width: 575px) {
    .chat-window { right: 0; left: 0; bottom: 0; width: 100%; height: 100vh; border-radius: 0; }
}

.chat-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    font-weight: 600;
}

.chat-window-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.chat-window-body > div { flex: 1; overflow: auto; }

.chat-thread-header { padding: 6px 12px; border-bottom: 1px solid var(--bs-border-color, #dee2e6); display: flex; align-items: center; }
.chat-messages { flex: 1; padding: 8px 12px; overflow-y: auto; }
.chat-message { margin-bottom: 6px; }
.chat-message.mine { text-align: end; }
.chat-message .bubble {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--bs-secondary-bg, #f1f3f5);
    max-width: 80%;
    word-wrap: break-word;
}
.chat-message.mine .bubble { background: var(--bs-primary, #0d6efd); color: #fff; }

/* Attachment paperclip — readable on both bubble colors. */
.chat-attachment-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-inline-start: 4px;
    border-radius: 50%;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}
.chat-message.mine .bubble .chat-attachment-link {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.chat-attachment-link:hover {
    background: rgba(0, 0, 0, 0.18);
    text-decoration: none;
}
.chat-message.mine .bubble .chat-attachment-link:hover {
    background: rgba(255, 255, 255, 0.38);
}
.chat-message .meta { font-size: 10px; color: var(--bs-secondary-color, #6c757d); margin-top: 2px; }

.chat-typing { padding: 4px 12px; }

.chat-input {
    display: flex;
    gap: 4px;
    align-items: end;
    padding: 8px;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}
.chat-input textarea { resize: none; }

.chat-toast {
    position: fixed;
    bottom: 96px;
    right: 80px;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    padding: 8px 12px;
    z-index: 1052;
    max-width: 280px;
}
html[dir="rtl"] .chat-toast { right: auto; left: 80px; }

/* Inline spinner sits inside the chat window header, next to the title. */
.chat-spinner { display: inline-flex; align-items: center; }

.chat-presence-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-inline-end: 8px;
    flex-shrink: 0;
}
.chat-presence-dot.online  { background: #28a745; box-shadow: 0 0 0 2px rgba(40,167,69,0.18); }
.chat-presence-dot.offline { background: #adb5bd; }
.chat-presence-label { font-weight: 500; }

.chat-attachment-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin: 4px 8px 0;
    background: var(--bs-secondary-bg, #f1f3f5);
    border-radius: 12px;
    font-size: 12px;
    max-width: calc(100% - 16px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
