#jupibot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #eb4f28;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(235,79,40,0.45);
    z-index: 9998;
    transition: transform 0.2s;
}
#jupibot-btn:hover { transform: scale(1.08); }
#jupibot-btn svg { pointer-events: none; }

#jupibot-bubble {
    position: fixed;
    bottom: 90px;
    right: 24px;
    background: #fff;
    border-radius: 12px 12px 0 12px;
    padding: 10px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    font-size: 13px;
    color: #333;
    max-width: 200px;
    line-height: 1.4;
    z-index: 9997;
    display: none;
    animation: jupiFadeIn 0.3s ease;
}

#jupibot-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: jupiFadeIn 0.25s ease;
}
#jupibot-window.open { display: flex; }

.jupibot-header {
    background: #eb4f28;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.jupibot-header-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.jupibot-header-info { flex: 1; }
.jupibot-header-name { color: #fff; font-weight: 600; font-size: 14px; }
.jupibot-header-status { color: rgba(255,255,255,0.8); font-size: 11px; display: flex; align-items: center; gap: 4px; }
.jupibot-dot { display: inline-block; width: 7px; height: 7px; background: #22c55e; border-radius: 50%; flex-shrink: 0; }
.jupibot-header-close {
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
}
.jupibot-header-close:hover { color: #fff; }

.jupibot-messages {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jupibot-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.jupibot-msg.user { flex-direction: row-reverse; }

.jupibot-msg-avatar {
    width: 28px;
    height: 28px;
    background: #eb4f28;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.jupibot-msg-bubble {
    max-width: 75%;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 0 12px 12px 12px;
    background: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    white-space: pre-wrap;
    word-break: break-word;
}
.jupibot-msg.user .jupibot-msg-bubble {
    background: #eb4f28;
    color: #fff;
    border-radius: 12px 0 12px 12px;
}

.jupibot-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #eb4f28;
    border-radius: 2px;
    vertical-align: middle;
    margin-left: 2px;
    animation: jupiBlink 1s infinite;
}

.jupibot-input-row {
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.jupibot-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    color: #333;
    font-family: inherit;
}
.jupibot-input:focus { border-color: #eb4f28; }
.jupibot-send {
    width: 36px;
    height: 36px;
    background: #eb4f28;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.jupibot-send:hover { background: #d43d1a; }
.jupibot-send.loading { background: #aaa; cursor: not-allowed; }

@keyframes jupiFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes jupiBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@media (max-width: 400px) {
    #jupibot-window { width: calc(100vw - 16px); right: 8px; bottom: 80px; }
    #jupibot-btn    { right: 16px; bottom: 16px; }
    #jupibot-bubble { right: 16px; }
}

@media (max-width: 767.98px) {
    #jupibot-window {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        /* above .cookies-card's z-index: 999999 (custom.css) — otherwise the
           cookie consent banner overlaps the full-screen chat's input row */
        z-index: 1000000;
    }
    .jupibot-header-close {
        padding: 12px;
        margin: -12px;
        font-size: 20px;
    }
    /* iOS Safari auto-zooms on focus of any input/textarea with
       font-size < 16px, which pushes the send button off-screen in the
       full-screen mobile chat window */
    .jupibot-input {
        font-size: 16px;
    }
}
