/* ── Sales Chatbot Widget ─────────────────────────────────────────── */

/* Floating action button */
.sales-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4);
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1.6rem;
}
.sales-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.5);
}
.sales-chat-fab .sc-fab-close { display: none; }
.sales-chat-fab.open .sc-fab-icon { display: none; }
.sales-chat-fab.open .sc-fab-close { display: inline; font-size: 1.5rem; }

/* Notification pulse */
.sales-chat-fab::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: sc-pulse 2s infinite;
}
.sales-chat-fab.open::after { display: none; }

@keyframes sc-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Chat panel */
.sales-chat-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
}
.sales-chat-panel.open {
    display: flex;
    animation: sc-slideUp 0.25s ease-out;
}

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

/* Header */
.sc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    flex-shrink: 0;
}
.sc-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.sc-header-info h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}
.sc-header-info span {
    font-size: 0.75rem;
    opacity: 0.85;
}
.sc-header-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.sc-header-close:hover { color: #fff; }

/* Messages area */
.sc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* Welcome message */
.sc-welcome {
    text-align: center;
    padding: 20px 12px 8px;
}
.sc-welcome p {
    margin: 0 0 6px;
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}
.sc-welcome .sc-hint {
    font-size: 0.78rem;
    color: #9ca3af;
}

/* Quick action buttons */
.sc-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 0 12px 8px;
}
.sc-quick-btn {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    color: #ea580c;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.sc-quick-btn:hover {
    background: #ffedd5;
    border-color: #f97316;
}

/* Message rows */
.sc-msg {
    display: flex;
    max-width: 85%;
}
.sc-msg-user {
    align-self: flex-end;
}
.sc-msg-assistant {
    align-self: flex-start;
}
.sc-msg-error {
    align-self: center;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    max-width: 90%;
}

/* Bubbles */
.sc-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
}
.sc-msg-user .sc-bubble {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.sc-msg-assistant .sc-bubble {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* Loading dots */
.sc-loading {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
}
.sc-loading .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f97316;
    animation: sc-bounce 1.2s infinite;
}
.sc-loading .dot:nth-child(2) { animation-delay: 0.2s; }
.sc-loading .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes sc-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Input area */
.sc-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.sc-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.sc-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}
.sc-input:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}
.sc-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
    font-size: 1rem;
}
.sc-send:hover { opacity: 0.85; }

/* Powered-by footer */
.sc-footer {
    text-align: center;
    padding: 6px;
    font-size: 0.65rem;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
}

/* Responsive */
@media (max-width: 480px) {
    .sales-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        right: 12px;
        bottom: 88px;
        border-radius: 12px;
    }
    .sales-chat-fab {
        bottom: 16px;
        right: 12px;
    }
}
