/* ── SurbhivDesigner Chatbot Widget ──────────────────────────── */

#sd-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Toggle Button */
#sd-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #6A47ED;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(106, 71, 237, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
    position: relative;
}
#sd-chat-toggle:hover {
    background: #17012C;
    transform: scale(1.08);
}
#sd-chat-toggle .sd-close-icon { display: none; }
#sd-chatbot.sd-open #sd-chat-toggle .sd-chat-icon { display: none; }
#sd-chatbot.sd-open #sd-chat-toggle .sd-close-icon { display: block; }

/* Pulse ring */
#sd-chat-toggle::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(106, 71, 237, 0.35);
    animation: sd-pulse 2s ease-out infinite;
}
@keyframes sd-pulse {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}
#sd-chatbot.sd-open #sd-chat-toggle::before { animation: none; }

/* Chat Window */
.sd-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 480px;
    animation: sd-slideUp 0.25s ease;
}
@keyframes sd-slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.sd-chat-header {
    background: linear-gradient(135deg, #6A47ED 0%, #3a1a6e 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sd-chat-header .sd-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: 18px;
    color: #fff;
    flex-shrink: 0;
}
.sd-chat-header .sd-header-info h5 {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin: 0;
}
.sd-chat-header .sd-header-info p {
    color: rgba(255,255,255,0.75);
    font-size: 11px;
    margin: 0;
}
.sd-online-dot {
    width: 8px;
    height: 8px;
    background: #C6F806;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: sd-blink 1.5s infinite;
}
@keyframes sd-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Messages */
.sd-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #e0d8ff transparent;
}
.sd-messages::-webkit-scrollbar { width: 4px; }
.sd-messages::-webkit-scrollbar-thumb { background: #e0d8ff; border-radius: 4px; }

/* Individual messages */
.sd-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}
.sd-msg.sd-bot { align-self: flex-start; }
.sd-msg.sd-user { align-self: flex-end; }

.sd-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.55;
    word-break: break-word;
}
.sd-bot .sd-bubble {
    background: #F6F3FE;
    color: #17012C;
    border-bottom-left-radius: 4px;
}
.sd-user .sd-bubble {
    background: #6A47ED;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.sd-typing .sd-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}
.sd-typing .sd-dot {
    width: 6px;
    height: 6px;
    background: #6A47ED;
    border-radius: 50%;
    animation: sd-bounce 1.2s infinite;
}
.sd-typing .sd-dot:nth-child(2) { animation-delay: 0.2s; }
.sd-typing .sd-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes sd-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Quick replies */
.sd-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 10px;
}
.sd-qr-btn {
    background: #fff;
    border: 1.5px solid #6A47ED;
    color: #6A47ED;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.sd-qr-btn:hover {
    background: #6A47ED;
    color: #fff;
}

/* WhatsApp button */
.sd-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 12px 12px;
    padding: 10px;
    background: #25D366;
    color: #fff;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease;
    border: none;
    cursor: pointer;
    width: calc(100% - 24px);
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.sd-whatsapp-btn:hover {
    background: #1ebe5c;
    color: #fff;
}
.sd-whatsapp-btn i {
    font-size: 15px;
}

/* Mobile */
@media (max-width: 480px) {
    #sd-chatbot {
        bottom: 16px;
        right: 16px;
    }
    .sd-chat-window {
        width: calc(100vw - 32px);
        right: 0;
    }
}
