/* ============================================================
   SILENT SIGNAL — CHATBOT WIDGET
   ============================================================ */


/* Floating Action Button */
.ss-chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 10000;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a148c, #7b1fa2);
    box-shadow: 0 6px 24px rgba(123,31,162,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}


.ss-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(123,31,162,0.55);
}


.ss-chat-fab-icon,
.ss-chat-fab-close {
    font-size: 26px;
    color: #fff;
}


.ss-chat-fab-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(123,31,162,0.4);
    animation: fabPulse 2.2s ease-out infinite;
    pointer-events: none;
}


@keyframes fabPulse {
    0%   { transform: scale(1);    opacity: 1; }
    100% { transform: scale(1.55); opacity: 0; }
}


/* Chat Window */
.ss-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9999;
    width: 360px;
    max-height: 560px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 60px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #ede0f5;
}


/* Header */
.ss-chat-header {
    background: linear-gradient(135deg, #4a148c, #7b1fa2);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}


.ss-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}


.ss-chat-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;
}


.ss-chat-title   { font-size: 14px; font-weight: 700; color: #fff; }
.ss-chat-subtitle { font-size: 11px; color: rgba(255,255,255,0.75); }


.ss-chat-header-actions { display: flex; gap: 4px; }


.ss-chat-clear-btn,
.ss-chat-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}


.ss-chat-clear-btn:hover,
.ss-chat-close-btn:hover {
    background: rgba(255,255,255,0.28);
}


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


/* Welcome card */
.ss-chat-welcome {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #f9f3ff;
    border-radius: 14px;
    padding: 12px;
    border: 1px solid #ede0f5;
}


.ss-chat-welcome-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b1fa2, #9c27b0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}


.ss-chat-welcome-text strong {
    font-size: 13px;
    color: #4a148c;
    display: block;
    margin-bottom: 3px;
}


.ss-chat-welcome-text p {
    font-size: 12px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}


/* Suggestion chips */
.ss-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}


.ss-chat-chip {
    padding: 5px 11px;
    border-radius: 20px;
    border: 1.5px solid #ce93d8;
    background: #fdf4ff;
    color: #6a1b9a;
    font-size: 11.5px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}


.ss-chat-chip:hover {
    background: #7b1fa2;
    color: #fff;
    border-color: #7b1fa2;
}


/* Message bubbles */
.ss-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: msgFadeIn 0.2s ease;
}


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


.ss-msg.user { flex-direction: row-reverse; }


.ss-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b1fa2, #9c27b0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
}


.ss-msg.user .ss-msg-avatar {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
}


.ss-msg-bubble {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #222;
    background: #f3f4f6;
    border-bottom-left-radius: 4px;
}


.ss-msg-bubble ul { margin: 4px 0 0 14px; padding: 0; }
.ss-msg-bubble li { margin-bottom: 2px; }


.ss-msg.user .ss-msg-bubble {
    background: linear-gradient(135deg, #7b1fa2, #9c27b0);
    color: #fff;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
}


/* Typing indicator */
.ss-typing .ss-msg-bubble {
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    align-items: center;
}


.ss-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    animation: typingBounce 1.2s infinite;
}


.ss-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ss-typing-dot:nth-child(3) { animation-delay: 0.4s; }


@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}


/* Error bubble */
.ss-msg-error .ss-msg-bubble {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}


/* Input row */
.ss-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 10px 12px;
    border-top: 1px solid #f0e6f8;
    flex-shrink: 0;
    background: #fff;
}


.ss-chat-input {
    flex: 1;
    resize: none;
    border: 1.5px solid #e0d0ee;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: #333;
    outline: none;
    max-height: 100px;
    line-height: 1.4;
    transition: border-color 0.2s;
    background: #fdf9ff;
}


.ss-chat-input:focus {
    border-color: #7b1fa2;
    background: #fff;
}


.ss-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #7b1fa2, #9c27b0);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, transform 0.15s;
    flex-shrink: 0;
}


.ss-chat-send-btn:hover { opacity: 0.88; transform: scale(1.05); }
.ss-chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }


/* Footer note */
.ss-chat-footer-note {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    padding: 4px 12px 8px;
    background: #fff;
    flex-shrink: 0;
}


/* ============================================================
   DARK MODE
   ============================================================ */


[data-theme="dark"] .ss-chat-window      { background: #1a1025; border-color: #3a1f5c; }
[data-theme="dark"] .ss-chat-input-row   { background: #1a1025; border-color: #3a1f5c; }
[data-theme="dark"] .ss-chat-footer-note { background: #1a1025; color: #555; }
[data-theme="dark"] .ss-chat-welcome     { background: #250e35; border-color: #3a1f5c; }
[data-theme="dark"] .ss-chat-welcome-text strong { color: #ce93d8; }
[data-theme="dark"] .ss-chat-welcome-text p      { color: #aaa; }
[data-theme="dark"] .ss-chat-chip        { background: #2a0e40; border-color: #6a1b9a; color: #ce93d8; }
[data-theme="dark"] .ss-chat-chip:hover  { background: #7b1fa2; color: #fff; }
[data-theme="dark"] .ss-msg-bubble       { background: #2a2a3a; color: #e0e0e0; }
[data-theme="dark"] .ss-chat-input       { background: #120820; border-color: #3a1f5c; color: #e0e0e0; }
[data-theme="dark"] .ss-chat-input:focus { border-color: #9c27b0; background: #1e1030; }


/* ============================================================
   RESPONSIVE
   ============================================================ */


@media (max-width: 480px) {
    .ss-chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 90px;
        max-height: 70vh;
    }
    .ss-chat-fab {
        bottom: 20px;
        right: 16px;
    }
}

