.sales-chat-fab-wrap {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 10050;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
}

.sales-chat-fab {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1e88e5, #1565c0);
    color: #fff;
    box-shadow: 0 4px 20px rgba(21, 101, 192, 0.5);
    font-size: 24px;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sales-chat-fab:hover {
    transform: scale(1.08);
    color: #fff;
    box-shadow: 0 6px 28px rgba(21, 101, 192, 0.65);
}

.sales-chat-fab--attention {
    animation: sales-chat-fab-breathe 2.5s ease-in-out infinite;
}

.sales-chat-fab-icon {
    position: relative;
    z-index: 2;
    animation: sales-chat-icon-bob 3s ease-in-out infinite;
}

.sales-chat-fab-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(30, 136, 229, 0.55);
    animation: sales-chat-ring-expand 2.5s ease-out infinite;
    pointer-events: none;
    z-index: 1;
}

.sales-chat-fab-ring--delay {
    animation-delay: 1.25s;
}

.sales-chat-fab.has-unread {
    animation: sales-chat-fab-breathe 1.4s ease-in-out infinite, sales-chat-fab-shake 0.5s ease-in-out 0s 3;
    box-shadow: 0 4px 24px rgba(229, 57, 53, 0.55);
}

.sales-chat-fab-callout {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    background: #fff;
    color: #1565c0;
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(30, 136, 229, 0.25);
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    transition: max-width 0.4s ease, opacity 0.35s ease, padding 0.35s ease;
}

.sales-chat-fab-callout.is-visible {
    max-width: 320px;
    opacity: 1;
    padding: 10px 14px;
    pointer-events: auto;
    animation: sales-chat-callout-nudge 2s ease-in-out 0.6s infinite;
}

.sales-chat-fab-callout-text {
    line-height: 1.4;
}

.sales-chat-fab-callout-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.sales-chat-fab-callout-close:hover {
    background: #bbdefb;
}

@keyframes sales-chat-fab-breathe {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(21, 101, 192, 0.5); }
    50% { transform: scale(1.06); box-shadow: 0 6px 28px rgba(30, 136, 229, 0.65); }
}

@keyframes sales-chat-icon-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes sales-chat-ring-expand {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.75); opacity: 0; }
}

@keyframes sales-chat-fab-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-8deg) scale(1.06); }
    40% { transform: rotate(8deg) scale(1.06); }
    60% { transform: rotate(-5deg) scale(1.04); }
    80% { transform: rotate(5deg) scale(1.04); }
}

@keyframes sales-chat-callout-nudge {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

@keyframes sales-chat-pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(21, 101, 192, 0.45); }
    50% { box-shadow: 0 4px 24px rgba(229, 57, 53, 0.65); }
}

.sales-chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    border: 2px solid #fff;
}

/* بالاتر از FAB و overlayهای صفحه‌ای (مثل TransactionReport) تا زیر backdrop نرود */
#salesChatModal.modal {
    z-index: 10060;
}

.sales-chat-modal .modal-dialog {
    max-width: 420px;
    margin: 0 0 0 24px;
    position: fixed;
    bottom: 90px;
    left: 0;
}

.sales-chat-modal .modal-content {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    height: 560px;
    display: flex;
    flex-direction: column;
}

.sales-chat-header {
    position: relative;
    background: #34495e;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sales-chat-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: #ed1c24;
}

.sales-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #ece5dd;
}

.sales-chat-inbox {
    width: 140px;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    background: #f8f9fa;
    flex-shrink: 0;
}

.sales-chat-inbox-item {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 12px;
}

.sales-chat-inbox-item.active,
.sales-chat-inbox-item:hover {
    background: #e3f2fd;
}

.sales-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sales-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #ece5dd;
}

.sales-chat-bubble {
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.5;
}

.sales-chat-bubble.mine {
    margin-right: auto;
    margin-left: 0;
    background: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.sales-chat-bubble.theirs {
    margin-left: auto;
    margin-right: 0;
    background: #fff;
    border-bottom-left-radius: 4px;
}

.sales-chat-bubble .meta {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
}

.sales-chat-footer {
    padding: 10px 12px 8px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.sales-chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 8px 8px 8px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sales-chat-composer:focus-within {
    border-color: #90caf9;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
    background: #fff;
}

.sales-chat-input-wrap {
    flex: 1;
    min-width: 0;
}

.sales-chat-textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    padding: 4px 0;
    font-family: inherit;
    color: #1f2937;
}

.sales-chat-textarea::placeholder {
    color: #9ca3af;
}

.sales-chat-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sales-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    margin: 0;
}

.sales-chat-btn:hover {
    transform: scale(1.06);
}

.sales-chat-btn--attach {
    background: #fff;
    color: #546e7a;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sales-chat-btn--attach:hover {
    background: #eceff1;
    color: #37474f;
}

.sales-chat-btn--attach input[type="file"] {
    display: none;
}

.sales-chat-btn--send {
    background: #34495e;
    color: #fff;
    box-shadow: 0 2px 8px rgba(52, 73, 94, 0.35);
}

.sales-chat-btn--send:hover {
    background: #2c3e50;
    color: #fff;
    box-shadow: 0 4px 12px rgba(52, 73, 94, 0.45);
}

.sales-chat-btn--send .fa {
    margin-right: 1px;
    font-size: 15px;
}

.sales-chat-hint {
    margin-top: 6px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
}

.sales-chat-bubble-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.sales-chat-layout-row {
    display: flex;
    flex: 1;
    min-height: 0;
}

.sales-chat-unread {
    background: #e53935;
    color: #fff;
    border-radius: 10px;
    padding: 0 6px;
    font-size: 10px;
    margin-right: 4px;
}

@media (max-width: 480px) {
    .sales-chat-fab-wrap {
        left: 16px;
        bottom: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .sales-chat-fab-callout.is-visible {
        max-width: calc(100vw - 32px);
        white-space: normal;
    }

    .sales-chat-modal .modal-dialog {
        margin: 0 8px;
        left: 0;
        bottom: 84px;
        max-width: calc(100vw - 16px);
    }
}
