/* CJ Sparkle Cleaners chatbot widget — scoped with #cjsc- prefix so it can't collide with the theme */
#cjsc-root {
    --cjsc-pink: #E91E8C;
    --cjsc-ink: #1A1A2E;
    --cjsc-grey: #6B6B75;
    --cjsc-bg: #FFFFFF;
    --cjsc-bg-soft: #F7F7FA;
    --cjsc-border: #EAEAEE;
    --cjsc-shadow: 0 10px 30px rgba(26, 26, 46, 0.15), 0 4px 10px rgba(26, 26, 46, 0.08);
    --cjsc-radius: 16px;

    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--cjsc-ink);
    font-size: 15px;
    line-height: 1.45;
}

#cjsc-root * { box-sizing: border-box; }

/* Floating launcher button */
#cjsc-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--cjsc-pink);
    color: #fff;
    border: 0;
    cursor: pointer;
    box-shadow: var(--cjsc-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483000;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#cjsc-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(233, 30, 140, 0.35); }
#cjsc-launcher:active { transform: translateY(0); }
#cjsc-launcher svg { width: 28px; height: 28px; }

#cjsc-launcher .cjsc-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

/* Chat panel */
#cjsc-panel {
    position: fixed;
    right: 20px;
    bottom: 94px;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--cjsc-bg);
    border-radius: var(--cjsc-radius);
    box-shadow: var(--cjsc-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483000;
    animation: cjsc-pop 0.22s ease-out;
}
#cjsc-panel.cjsc-open { display: flex; }
@keyframes cjsc-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#cjsc-header {
    background: var(--cjsc-ink);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
#cjsc-header .cjsc-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--cjsc-pink);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; color: #fff;
    flex: 0 0 auto;
}
#cjsc-header .cjsc-title { font-weight: 600; font-size: 15px; margin: 0; }
#cjsc-header .cjsc-status { font-size: 12px; opacity: 0.7; margin: 2px 0 0; display: flex; align-items: center; gap: 6px; }
#cjsc-header .cjsc-status::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
}
#cjsc-header .cjsc-meta { flex: 1; min-width: 0; }
#cjsc-close {
    background: transparent; border: 0; color: #fff; cursor: pointer; opacity: 0.6;
    padding: 4px; border-radius: 6px; line-height: 0;
}
#cjsc-close:hover { opacity: 1; background: rgba(255,255,255,0.08); }
#cjsc-close svg { width: 18px; height: 18px; }

/* Messages area */
#cjsc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
    background: var(--cjsc-bg-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cjsc-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    animation: cjsc-fadein 0.2s ease-out;
}
@keyframes cjsc-fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cjsc-msg.cjsc-from-bot {
    background: #fff;
    color: var(--cjsc-ink);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(26,26,46,0.04);
}
.cjsc-msg.cjsc-from-user {
    background: var(--cjsc-pink);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.cjsc-typing {
    align-self: flex-start;
    background: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: flex; gap: 4px;
    box-shadow: 0 1px 2px rgba(26,26,46,0.04);
}
.cjsc-typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--cjsc-grey);
    opacity: 0.5;
    animation: cjsc-bounce 1.2s infinite;
}
.cjsc-typing span:nth-child(2) { animation-delay: 0.15s; }
.cjsc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cjsc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick action buttons below messages */
#cjsc-actions {
    padding: 0 14px 10px;
    background: var(--cjsc-bg-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cjsc-quick {
    background: #fff;
    border: 1px solid var(--cjsc-border);
    color: var(--cjsc-ink);
    padding: 7px 12px;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.cjsc-quick:hover { border-color: var(--cjsc-pink); color: var(--cjsc-pink); }

/* Input */
#cjsc-input-wrap {
    padding: 12px;
    background: #fff;
    border-top: 1px solid var(--cjsc-border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
#cjsc-input {
    flex: 1;
    border: 1px solid var(--cjsc-border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14.5px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    background: var(--cjsc-bg-soft);
    color: var(--cjsc-ink);
    outline: none;
    transition: border-color 0.15s;
}
#cjsc-input:focus { border-color: var(--cjsc-pink); background: #fff; }
#cjsc-send {
    background: var(--cjsc-pink);
    border: 0;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
    transition: opacity 0.15s;
}
#cjsc-send:disabled { opacity: 0.4; cursor: not-allowed; }
#cjsc-send svg { width: 18px; height: 18px; }

#cjsc-footer {
    font-size: 11px;
    color: var(--cjsc-grey);
    text-align: center;
    padding: 6px 0 8px;
    background: #fff;
    border-top: 1px solid var(--cjsc-border);
}

/* Lead-capture form */
.cjsc-lead-form {
    background: #fff;
    border: 1px solid var(--cjsc-border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
    max-width: 92%;
}
.cjsc-lead-form h4 {
    margin: 0 0 2px; font-size: 14px; color: var(--cjsc-ink);
}
.cjsc-lead-form label { font-size: 12px; color: var(--cjsc-grey); margin-bottom: -4px; }
.cjsc-lead-form input, .cjsc-lead-form textarea {
    border: 1px solid var(--cjsc-border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.cjsc-lead-form input:focus, .cjsc-lead-form textarea:focus { border-color: var(--cjsc-pink); }
.cjsc-lead-form button {
    background: var(--cjsc-pink);
    color: #fff;
    border: 0;
    padding: 9px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    margin-top: 4px;
}
.cjsc-lead-form button:hover { filter: brightness(1.05); }

/* Mobile */
@media (max-width: 480px) {
    #cjsc-panel {
        right: 8px; left: 8px; bottom: 84px;
        width: auto;
        height: calc(100vh - 110px);
    }
    #cjsc-launcher { right: 14px; bottom: 14px; width: 56px; height: 56px; }
}
