/* =====================================================
   SalesBot Floating Chat Widget — Sales Asaan
   Place in wwwroot/css/salesbot.css and link from index.html
   ===================================================== */

.salesbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Floating Action Button */
.salesbot-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1565c0;
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.45);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.2s;
}
.salesbot-fab:hover  { background: #1976d2; transform: scale(1.08); }
.salesbot-fab.fab-open { background: #c62828; }

/* Chat panel */
.salesbot-panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 370px;
    max-height: 560px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    animation: slideUp 0.22s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.salesbot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #1565c0;
    color: #fff;
}
.salesbot-avatar { font-size: 24px; }
.salesbot-header strong { display: block; font-size: 15px; }
.salesbot-header small  { font-size: 11px; opacity: 0.75; }
.clear-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.7;
    padding: 4px;
}
.clear-btn:hover { opacity: 1; }

/* Message list */
.salesbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f7fa;
}

.empty-state {
    text-align: center;
    color: #888;
    font-size: 14px;
    padding: 24px 8px;
    line-height: 1.6;
}

/* Bubbles */
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-bot  { justify-content: flex-start; }

.bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}
.msg-user .bubble {
    background: #1565c0;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-bot .bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.bubble code {
    background: #eef2ff;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
}

/* Typing indicator */
.typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 12px 16px;
}
.typing span {
    width: 7px; height: 7px;
    background: #aab;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}

/* Input area */
.salesbot-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e8eaf0;
    background: #fff;
}
.salesbot-input textarea {
    flex: 1;
    resize: none;
    border: 1px solid #dde1f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border 0.2s;
    max-height: 100px;
    overflow-y: auto;
}
.salesbot-input textarea:focus { border-color: #1565c0; }
.salesbot-input button {
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: 10px;
    width: 38px; height: 38px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.salesbot-input button:hover:not(:disabled) { background: #1976d2; }
.salesbot-input button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Scrollbar styling */
.salesbot-messages::-webkit-scrollbar { width: 5px; }
.salesbot-messages::-webkit-scrollbar-track { background: transparent; }
.salesbot-messages::-webkit-scrollbar-thumb { background: #cdd; border-radius: 4px; }

/* Responsive: shrink on small screens */
@media (max-width: 420px) {
    .salesbot-panel { width: calc(100vw - 32px); right: -8px; }
}
