/* Neo Brutalism Design for Chatbot */

#spandiv-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

#spandiv-chatbot-widget.sc-open {
    z-index: 999;
}

#spandiv-chatbot-widget .sc-toggle-btn {
    width: auto !important;
    min-width: 60px;
    height: 60px;
    background: var(--sc-accent-color);
    border: 3px solid #000;
    box-shadow: 4px 4px 0 #000;
    border-radius: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: #000;
    animation: sc-float-subtle 3s infinite ease-in-out;
}

#spandiv-chatbot-widget .sc-toggle-label {
    margin-right: 12px;
    font-weight: 900;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    display: inline-block;
}

#spandiv-chatbot-widget .sc-toggle-btn svg {
    flex-shrink: 0;
}

@keyframes sc-float-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

#spandiv-chatbot-widget.sc-open .sc-toggle-label {
    display: none;
}

#spandiv-chatbot-widget.sc-open .sc-toggle-btn {
    width: 60px;
    padding: 0;
}

#spandiv-chatbot-widget .sc-toggle-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
}

#spandiv-chatbot-widget .sc-toggle-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 #000;
}

#spandiv-chatbot-widget .sc-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 3px solid #000;
    box-shadow: 6px 6px 0 #000;
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s, transform 0.2s;
    transform-origin: bottom right;
}

#spandiv-chatbot-widget .sc-window.sc-hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

#spandiv-chatbot-widget .sc-header {
    background: var(--sc-accent-color);
    border-bottom: 3px solid #000;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#spandiv-chatbot-widget .sc-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#spandiv-chatbot-widget .sc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #000;
    background: #fff;
    object-fit: cover;
}

#spandiv-chatbot-widget .sc-title {
    font-weight: 800;
    font-size: 14px;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#spandiv-chatbot-widget .sc-close-btn {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 900;
    color: #000;
    cursor: pointer;
    padding: 0;
}

#spandiv-chatbot-widget .sc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f0e8;
}

#spandiv-chatbot-widget .sc-msg {
    max-width: 85%;
    padding: 10px 14px;
    border: 2px solid #000;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

#spandiv-chatbot-widget .sc-msg.sc-bot {
    background: #fff;
    align-self: flex-start;
    border-radius: 12px 12px 12px 0;
    box-shadow: 3px 3px 0 #000;
}

#spandiv-chatbot-widget .sc-msg.sc-user {
    background: var(--sc-accent-color);
    align-self: flex-end;
    border-radius: 12px 12px 0 12px;
    box-shadow: -3px 3px 0 #000;
}

#spandiv-chatbot-widget .sc-inline-link {
    color: #0066cc;
    text-decoration: underline;
    font-weight: 700;
    word-break: break-all;
}

#spandiv-chatbot-widget .sc-inline-link:hover {
    color: #004499;
}

#spandiv-chatbot-widget .sc-input-area {
    padding: 15px;
    border-top: 3px solid #000;
    display: flex;
    gap: 10px;
    background: #fff;
}

#spandiv-chatbot-widget .sc-input-area input {
    flex: 1;
    border: 2px solid #000;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

#spandiv-chatbot-widget .sc-input-area input:focus {
    box-shadow: inset 3px 3px 0 #eee;
}

#spandiv-chatbot-widget .sc-send-btn {
    background: var(--sc-accent-color);
    border: 2px solid #000;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
    transition: transform 0.1s, box-shadow 0.1s;
    color: #000;
}

#spandiv-chatbot-widget .sc-send-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0 #000;
}

#spandiv-chatbot-widget .sc-footer {
    padding: 10px;
    text-align: center;
    background: #000;
}

#spandiv-chatbot-widget .sc-wa-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.2s;
}

#spandiv-chatbot-widget .sc-wa-link:hover {
    color: var(--sc-accent-color);
}

/* Inline WhatsApp Button inside Chat */
#spandiv-chatbot-widget .sc-wa-btn-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px 0;
    padding: 12px 20px;
    background: #25D366;
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
    border: 3px solid #000;
    box-shadow: 4px 4px 0 #000;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.05em;
    transition: all 0.1s;
    border-radius: 8px;
    width: fit-content;
    cursor: pointer;
}

#spandiv-chatbot-widget .sc-wa-btn-inline:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
    background: #20ba5a;
}

#spandiv-chatbot-widget .sc-wa-btn-inline:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 #000;
}

/* Typing indicator */
.sc-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px !important;
}

.sc-typing span {
    width: 6px;
    height: 6px;
    background: #000;
    border-radius: 50%;
    animation: sc-bounce 1.4s infinite ease-in-out both;
}

.sc-typing span:nth-child(1) { animation-delay: -0.32s; }
.sc-typing span:nth-child(2) { animation-delay: -0.16s; }

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

/* Mobile responsive */
@media (max-width: 480px) {
    #spandiv-chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    #spandiv-chatbot-widget .sc-window {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border: none;
        box-shadow: none;
        transform-origin: bottom center;
    }

    #spandiv-chatbot-widget .sc-header {
        padding-top: calc(15px + env(safe-area-inset-top));
    }
}