/* ─────── Sugandh Ink Chatbot Widget ─────── */

#si-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Toggle Button ── */

#si-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #2b231c;
    color: #f5f0e8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(43, 35, 28, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

#si-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(43, 35, 28, 0.35);
    background: #3d3228;
}

#si-chat-toggle .chat-icon-close { display: none; }
#si-chat-toggle.si-active .chat-icon-open { display: none; }
#si-chat-toggle.si-active .chat-icon-close { display: block; }

/* ── Chat Panel ── */

#si-chat-panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 360px;
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 60px rgba(43, 35, 28, 0.18);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid rgba(43, 35, 28, 0.08);
}

#si-chat-panel.si-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Header ── */

#si-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: #2b231c;
    color: #f5f0e8;
    flex-shrink: 0;
}

.si-chat-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.si-chat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: si-pulse 2s infinite;
}

@keyframes si-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#si-chat-close {
    background: none;
    border: none;
    color: rgba(245, 240, 232, 0.6);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

#si-chat-close:hover {
    color: #f5f0e8;
    background: rgba(255,255,255,0.1);
}

/* ── Body (messages area) ── */

#si-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fcfaf7;
    scroll-behavior: smooth;
}

#si-chat-body::-webkit-scrollbar { width: 4px; }
#si-chat-body::-webkit-scrollbar-track { background: transparent; }
#si-chat-body::-webkit-scrollbar-thumb { background: rgba(43,35,28,0.15); border-radius: 4px; }

/* ── Messages ── */

.si-msg {
    display: flex;
    max-width: 88%;
    animation: si-fade-in 0.25s ease-out;
}

@keyframes si-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.si-msg-bot {
    align-self: flex-start;
}

.si-msg-user {
    align-self: flex-end;
}

.si-msg-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
}

.si-msg-bot .si-msg-content {
    background: #f0ece6;
    color: #2b231c;
    border-bottom-left-radius: 4px;
}

.si-msg-user .si-msg-content {
    background: #2b231c;
    color: #f5f0e8;
    border-bottom-right-radius: 4px;
}

.si-msg-content strong {
    font-weight: 600;
}

/* ── Suggestions ── */

.si-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.si-suggestion-chip {
    background: #fff;
    border: 1px solid rgba(43,35,28,0.15);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: #2b231c;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.si-suggestion-chip:hover {
    background: #2b231c;
    color: #f5f0e8;
    border-color: #2b231c;
}

/* ── Typing Indicator ── */

.si-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.si-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(43,35,28,0.3);
    animation: si-bounce 1.4s infinite ease-in-out both;
}

.si-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.si-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.si-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes si-bounce {
    0%, 80%, 100% { transform: scale(0.6); }
    40% { transform: scale(1); }
}

/* ── Footer ── */

#si-chat-footer {
    padding: 10px 14px 14px;
    background: #fff;
    border-top: 1px solid rgba(43,35,28,0.06);
    flex-shrink: 0;
}

#si-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

#si-chat-input {
    flex: 1;
    border: 1px solid rgba(43,35,28,0.12);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    background: #f8f6f3;
    color: #2b231c;
    transition: border-color 0.2s, background 0.2s;
}

#si-chat-input:focus {
    border-color: #2b231c;
    background: #fff;
}

#si-chat-input::placeholder { color: rgba(43,35,28,0.35); }

#si-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #2b231c;
    color: #f5f0e8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}

#si-chat-send:hover {
    background: #3d3228;
    transform: scale(1.05);
}

#si-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Mobile ── */

@media (max-width: 480px) {
    #si-chatbot {
        bottom: 16px;
        right: 16px;
    }

    #si-chat-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 60px;
        border-radius: 14px;
    }

    #si-chat-toggle {
        width: 50px;
        height: 50px;
    }
}
