/* ============================================================
   Spurthi Strategies LLP � Customer Support Chatbot Widget
   ============================================================ */

/* --- Launcher Button --- */
#ss-chat-launcher {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #FF0000;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid #FF0000;
    box-shadow: 0 8px 32px rgba(255, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    color: #ffffff;
    opacity: 1 !important;
    visibility: visible !important;
}

#ss-chat-launcher:hover {
    transform: scale(1.1) translateY(-2px);
    border-color: #ff3333;
    box-shadow: 0 16px 48px rgba(255, 0, 0, 0.55), 0 0 24px rgba(255, 255, 255, 0.08);
}

#ss-chat-launcher .ss-chat-icon { transition: all 0.3s ease; }
#ss-chat-launcher.open .ss-chat-icon { transform: rotate(90deg); }

/* Notification badge */
#ss-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    animation: ss-pulse 2s infinite;
}

@keyframes ss-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Notification dot pulse */
@keyframes ss-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

/* Launcher wave/bounce */
@keyframes ss-wave {
    0%   { transform: scale(1) translateY(0); }
    30%  { transform: scale(1.18) translateY(-6px); }
    60%  { transform: scale(0.95) translateY(2px); }
    100% { transform: scale(1) translateY(0); }
}

/* Tooltip bubble slide-in */
@keyframes ss-bubble-in {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Chat Window --- */
#ss-chat-window {
    position: fixed;
    bottom: 6.5rem;
    right: 2rem;
    z-index: 9998;
    width: 380px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    background: #0f0f11;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04);
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ss-chat-window.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
#ss-chat-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.125rem 1.25rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.ss-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.ss-header-info { flex: 1; }

.ss-header-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.ss-header-status {
    font-size: 0.7rem;
    color: #a0a0a5;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 2px;
}

.ss-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #30d158;
    display: inline-block;
    animation: ss-blink 2s infinite;
}

@keyframes ss-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#ss-chat-close {
    background: none;
    border: none;
    color: #a0a0a5;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 20px;
}

#ss-chat-close:hover { color: #ffffff; background: rgba(255,255,255,0.08); }

/* Messages container */
#ss-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    scroll-behavior: smooth;
}

#ss-chat-messages::-webkit-scrollbar { width: 4px; }
#ss-chat-messages::-webkit-scrollbar-track { background: transparent; }
#ss-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Message bubbles */
.ss-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: ss-msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ss-msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ss-msg.bot { align-self: flex-start; }
.ss-msg.user { align-self: flex-end; }

.ss-bubble {
    padding: 0.7rem 1rem;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.55;
}

.ss-msg.bot .ss-bubble {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.07);
    border-bottom-left-radius: 4px;
    color: #e8e8ea;
}

.ss-msg.user .ss-bubble {
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.08));
    border: 1px solid rgba(255,255,255,0.15);
    border-bottom-right-radius: 4px;
    color: #ffffff;
}

.ss-timestamp {
    font-size: 0.65rem;
    color: #606068;
    margin-top: 4px;
    letter-spacing: 0.03em;
}

.ss-msg.user .ss-timestamp { text-align: right; }

/* Typing indicator */
#ss-typing {
    display: none;
    align-self: flex-start;
    padding: 0.6rem 0.9rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    gap: 4px;
    align-items: center;
}

#ss-typing.visible { display: flex; }

.ss-dot {
    width: 6px;
    height: 6px;
    background: #a0a0a5;
    border-radius: 50%;
    animation: ss-bounce 1.2s infinite ease-in-out;
}

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

@keyframes ss-bounce {
    0%, 80%, 100% { transform: scale(1); opacity: 0.5; }
    40%           { transform: scale(1.3); opacity: 1; }
}

/* Quick reply chips */
#ss-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.25rem 0.75rem;
    flex-shrink: 0;
}

.ss-chip {
    padding: 0.4rem 0.875rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: #c0c0c5;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.ss-chip:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Input area */
#ss-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.02);
    flex-shrink: 0;
}

#ss-chat-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 0.625rem 0.875rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.875rem;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color 0.2s ease;
    outline: none;
    line-height: 1.4;
}

#ss-chat-input::placeholder { color: #505058; }
#ss-chat-input:focus { border-color: rgba(255,255,255,0.22); }

#ss-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.15);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#ss-chat-send:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.32), rgba(255,255,255,0.12));
    transform: scale(1.05);
}

#ss-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Lead capture form inside chat */
.ss-lead-form {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 85%;
}

.ss-lead-form input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: #ffffff;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.ss-lead-form input::placeholder { color: #505058; }
.ss-lead-form input:focus { border-color: rgba(255,255,255,0.25); }

.ss-lead-form button {
    background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ss-lead-form button:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.32), rgba(255,255,255,0.12));
}

/* Powered by footer strip */
#ss-powered {
    text-align: center;
    font-size: 0.6rem;
    color: #3a3a42;
    padding: 0.4rem 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #ss-chat-window {
        width: calc(100vw - 2rem);
        right: 1rem;
        bottom: 5.5rem;
        max-height: 75vh;
    }

    #ss-chat-launcher {
        right: 1rem;
        bottom: 1rem;
    }
}
