/* =========================================
   AI CHATBOT
========================================= */

.sp-ai-chatbot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: inherit;
}

/* Floating Button */
.sp-ai-chatbot-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--sp-navy, #0c1434);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    transition: .25s ease;
    position: relative;
}

.sp-ai-chatbot-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .22);
}

.sp-ai-chatbot-toggle i {
    font-size: 24px;
}

/* Notification Dot */
.sp-ai-chatbot-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

/* Chat Window */
.sp-ai-chatbot-window {
    width: 380px;
    height: 590px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(12, 20, 52, .20);
    overflow: hidden;
    position: absolute;
    right: 0;
    bottom: 74px;

    display: flex;
    flex-direction: column;

    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(.97);
    transform-origin: bottom right;
    transition: .25s ease;
}

.sp-ai-chatbot.active .sp-ai-chatbot-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.sp-ai-chatbot-header {
    background: var(--sp-navy, #0c1434);
    color: #fff;
    padding: 17px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sp-ai-chatbot-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.sp-ai-chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    color: var(--sp-navy, #0c1434);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sp-ai-chatbot-avatar i {
    font-size: 19px;
}

.sp-ai-chatbot-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.sp-ai-chatbot-status {
    font-size: 11px;
    margin-top: 3px;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sp-ai-chatbot-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

.sp-ai-chatbot-close {
    width: 34px;
    height: 34px;
    border: 0;
    background: rgba(255,255,255,.10);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-ai-chatbot-close:hover {
    background: rgba(255,255,255,.18);
}

/* Chat Body */
.sp-ai-chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f7f8fa;
    scroll-behavior: smooth;
}

/* Welcome */
.sp-ai-welcome {
    text-align: center;
    padding: 8px 0 15px;
}

.sp-ai-welcome-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: #fff;
    color: var(--sp-blue, #114675);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 18px rgba(0,0,0,.08);
}

.sp-ai-welcome-icon i {
    font-size: 25px;
}

.sp-ai-welcome h3 {
    margin: 0 0 6px;
    font-size: 17px;
    color: var(--sp-ink, #172033);
}

.sp-ai-welcome p {
    margin: 0;
    font-size: 13px;
    color: #667085;
    line-height: 1.5;
}

/* Messages */
.sp-ai-message {
    display: flex;
    margin-bottom: 12px;
}

.sp-ai-message.bot {
    justify-content: flex-start;
}

.sp-ai-message.user {
    justify-content: flex-end;
}

.sp-ai-bubble {
    max-width: 82%;
    padding: 11px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.sp-ai-message.bot .sp-ai-bubble {
    background: #fff;
    color: #172033;
    border: 1px solid #e7eaf0;
    border-bottom-left-radius: 5px;
}

.sp-ai-message.user .sp-ai-bubble {
    background: var(--sp-blue, #114675);
    color: #fff;
    border-bottom-right-radius: 5px;
}

/* Quick Actions */
.sp-ai-quick-title {
    font-size: 11px;
    font-weight: 600;
    color: #8a94a6;
    margin: 3px 0 9px;
}

.sp-ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.sp-ai-quick-btn {
    border: 1px solid #dfe4eb;
    background: #fff;
    color: #344054;
    border-radius: 20px;
    padding: 8px 11px;
    font-size: 12px;
    cursor: pointer;
    transition: .2s ease;
}

.sp-ai-quick-btn:hover {
    border-color: var(--sp-blue, #114675);
    color: var(--sp-blue, #114675);
    background: #f5f9fc;
}

/* Input Area */
.sp-ai-chatbot-footer {
    background: #fff;
    border-top: 1px solid #e7eaf0;
    padding: 11px;
}

.sp-ai-input-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f6f8fa;
    border: 1px solid #e0e4ea;
    border-radius: 14px;
    padding: 5px 6px 5px 13px;
}

.sp-ai-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13px;
    min-width: 0;
    color: #172033;
}

.sp-ai-input::placeholder {
    color: #98a2b3;
}

.sp-ai-send {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 11px;
    background: var(--sp-navy, #0c1434);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sp-ai-send:hover {
    opacity: .9;
}

.sp-ai-powered {
    text-align: center;
    font-size: 10px;
    color: #98a2b3;
    margin-top: 7px;
}

/* Typing */
.sp-ai-typing {
    display: flex;
    gap: 4px;
    align-items: center;
}

.sp-ai-typing span {
    width: 5px;
    height: 5px;
    background: #98a2b3;
    border-radius: 50%;
    animation: spAiTyping 1.2s infinite;
}

.sp-ai-typing span:nth-child(2) {
    animation-delay: .15s;
}

.sp-ai-typing span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes spAiTyping {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* Mobile */
@media (max-width: 576px) {

    .sp-ai-chatbot {
        right: 14px;
        bottom: 14px;
    }

    .sp-ai-chatbot-window {
        position: fixed;
        width: calc(100vw - 20px);
        height: min(620px, calc(100vh - 90px));
        right: 10px;
        bottom: 82px;
        border-radius: 18px;
    }

    .sp-ai-chatbot-toggle {
        width: 54px;
        height: 54px;
    }
}