.ai-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 24px;
    transition: transform 0.3s ease;
}

.ai-launcher:hover {
    transform: scale(1.1);
}

span#ai-chat-close {
    cursor: pointer;
}


.ai-widget {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-height: 550px;
    height: 550px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.ai-header {
    background: #0073aa;
    color: #fff;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-messages {
    padding: 16px;
    flex-grow: 1;
    overflow-y: auto;
    background: #f9f9fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: 'Poppins', 'Lato', Helvetica, sans-serif;
}

/* Message containers */
.ai-messages .user,
.ai-messages .assistant {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.ai-messages .user {
    flex-direction: row-reverse;
    /* justify-content: flex-end; */
    text-align: right;
}

.ai-messages .assistant {
    flex-direction: row;
    justify-content: flex-start;
}

/* Avatar images */
.ai-messages .assistant img,
.ai-messages .user img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

/* Bubble styles */
.ai-messages .bubble {
    max-width: 75%;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.6;
    border-radius: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    font-weight: 500;
}

/* User bubble */
.ai-messages .user .bubble {
    background: linear-gradient(to right, #0078d4, #005fb8);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Assistant bubble */
.ai-messages .assistant .bubble {
    background: #e8f0fe;
    color: #202124;
    border-bottom-left-radius: 4px;
}

/* Bubble tails (optional for more visual polish) */
.ai-messages .assistant .bubble::after {
    content: "";
    position: absolute;
    left: -8px;
    top: 10px;
    border: 8px solid transparent;
    border-right-color: #e8f0fe;
}

/* .ai-messages .user .bubble::after {
    content: "";
    position: absolute;
    right: -15px;
    top: 45px;
    border: 8px solid transparent;
    border-left-color: #0078d4;
} */

/* Input section */
.ai-input-area {
    display: flex;
    border-top: 1px solid #ccc;
    padding: 10px;
    background: #fff;
}

#ai-chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-right: 8px;
    font-family: 'Poppins', 'Lato', Helvetica, sans-serif;
    font-size: 14px;
}

#ai-chat-send {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

#ai-chat-send:hover {
    background: #005f8d;
}

.typing-dots span {
    display: inline-block;
    font-size: 18px;
    animation: blink 1.4s infinite both;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
}


@media (max-width: 768px) {
    .ai-widget {
        touch-action: manipulation;
    }

    .ai-widget {
        right: 10px;
        left: 10px;
        bottom: 80px;
        width: auto;
        height: 80vh;
        max-height: 80vh;
        border-radius: 16px;
    }

    .ai-messages {
        padding: 12px;
        gap: 10px;
        font-size: 14px;
    }

    .ai-messages .bubble {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 14px;
    }

    .ai-launcher {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
        font-size: 20px;
    }

    #ai-chat-input {
        font-size: 13px;
        padding: 7px;
    }

    #ai-chat-send {
        padding: 7px 9px;
        font-size: 13px;
    }

    .ai-header {
        font-size: 15px;
        padding: 10px;
    }

    .ai-messages .assistant img,
    .ai-messages .user img {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .ai-header span {
        font-size: 14px;
    }

    .ai-input-area {
        padding: 8px;
    }
}
