#stj-chat-btn {
    position: fixed;
    bottom: 170px;
    right: 25px;
    z-index: 9998;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1C2E7C 0%, #061948 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(6, 25, 72, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#stj-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 32px rgba(6, 25, 72, 0.55);
}

.stj-chat-btn-image,
.stj-chat-avatar-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.stj-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #C9A84C;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

#stj-chat-panel {
    position: fixed;
    top: 16px;
    bottom: 16px;
    right: -420px;
    width: 400px;
    max-width: calc(95vw - 16px);
    height: auto;
    z-index: 9999;
    background: #fff;
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid #C9A84C;
    border-radius: 16px 0 0 16px;
    overflow: hidden;
}

#stj-chat-panel.stj-open {
    right: 16px;
    border-radius: 16px;
}

.stj-chat-header {
    background: linear-gradient(135deg, #1C2E7C 0%, #061948 100%);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.stj-chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.25);
    border: 2px solid #C9A84C;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stj-chat-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.stj-chat-subtitle {
    margin: 0;
    font-size: 11px;
    opacity: 0.75;
}

#stj-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.8;
}

#stj-chat-close:hover {
    opacity: 1;
}

#stj-chat-messages {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f6fa;
}

.stj-msg {
    display: flex;
}

.stj-msg-bot {
    justify-content: flex-start;
}

.stj-msg-user {
    justify-content: flex-end;
}

.stj-msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.stj-msg-bot .stj-msg-bubble {
    background: #fff;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    word-break: break-word;
    overflow-wrap: break-word;
}

.stj-msg-user .stj-msg-bubble {
    background: linear-gradient(135deg, #1C2E7C, #061948);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.stj-msg-thinking .stj-msg-bubble {
    background: #fff;
    color: #888;
    font-style: italic;
}

.stj-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
}

.stj-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #1C2E7C;
    display: inline-block;
    animation: stj-bounce 1.2s infinite ease-in-out;
}

.stj-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.stj-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.stj-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes stj-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.stj-chat-footer {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

#stj-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13.5px;
    resize: none;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
    transition: border-color 0.2s;
}

#stj-chat-input:focus {
    border-color: #1C2E7C;
}

#stj-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1C2E7C, #061948);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}

#stj-chat-send:hover {
    transform: scale(1.08);
}

#stj-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.stj-chat-disclaimer {
    text-align: center;
    font-size: 10px;
    color: #aaa;
    margin: 4px 0 8px;
    padding: 0 14px;
}

#stj-chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9997;
}

#stj-chat-overlay.stj-open {
    display: block;
}

@media (max-width: 480px) {
    #stj-chat-panel {
        top: 8px;
        bottom: 8px;
        right: -100vw;
        width: calc(100vw - 16px);
        border-radius: 12px;
    }

    #stj-chat-panel.stj-open {
        right: 8px;
    }

    #stj-chat-btn {
        bottom: 90px;
        right: 18px;
        width: 52px;
        height: 52px;
    }
}
