/*
|--------------------------------------------------------------------------
| CHAT WIDGET
|--------------------------------------------------------------------------
*/

#aiba-chat-widget {

    position: fixed;

    bottom: 90px;
    right: 20px;

    width: 380px;
    height: 600px;

    background: #ffffff;

    border-radius: 22px;

    box-shadow:
        0 20px 60px rgba(0,0,0,0.25);

    z-index: 999999;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    font-family: Arial, sans-serif;

    animation: aibaFadeIn 0.3s ease;
}

/*
|--------------------------------------------------------------------------
| HEADER
|--------------------------------------------------------------------------
*/

#aiba-chat-header {

    background:
        linear-gradient(135deg,#111827,#1e3a8a);

    color: #ffffff;

    padding: 18px 20px;

    display: flex;

    justify-content: space-between;

    align-items: center;
}

/*
|--------------------------------------------------------------------------
| HEADER INFO
|--------------------------------------------------------------------------
*/

.aiba-header-info {

    display: flex;

    align-items: center;

    gap: 12px;
}

/*
|--------------------------------------------------------------------------
| AVATAR
|--------------------------------------------------------------------------
*/

.aiba-avatar {

    width: 42px;
    height: 42px;

    border-radius: 50%;

    background: rgba(255,255,255,0.15);

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 22px;
}

/*
|--------------------------------------------------------------------------
| TITLE
|--------------------------------------------------------------------------
*/

.aiba-title {

    font-size: 20px;

    font-weight: 700;

    line-height: 1.1;
}

/*
|--------------------------------------------------------------------------
| STATUS
|--------------------------------------------------------------------------
*/

.aiba-status {

    font-size: 13px;

    opacity: 0.8;

    margin-top: 2px;
}

/*
|--------------------------------------------------------------------------
| CLOSE
|--------------------------------------------------------------------------
*/

#aiba-chat-close {

    background: transparent;

    border: none;

    color: white;

    font-size: 30px;

    cursor: pointer;

    transition: all 0.2s ease;
}

#aiba-chat-close:hover {

    transform: rotate(90deg);
}

/*
|--------------------------------------------------------------------------
| MESSAGES
|--------------------------------------------------------------------------
*/

#aiba-chat-messages {

    flex: 1;

    padding: 20px;

    overflow-y: auto;

    background: #f3f4f6;
}

/*
|--------------------------------------------------------------------------
| MESSAGE
|--------------------------------------------------------------------------
*/

.aiba-message {

    margin-bottom: 15px;

    padding: 14px 16px;

    border-radius: 18px;

    max-width: 85%;

    line-height: 1.6;

    font-size: 15px;

    word-wrap: break-word;

    animation: aibaMessageFade 0.25s ease;
}

/*
|--------------------------------------------------------------------------
| USER
|--------------------------------------------------------------------------
*/

.aiba-message.user {

    background: #2563eb;

    color: white;

    margin-left: auto;

    border-bottom-right-radius: 5px;
}

/*
|--------------------------------------------------------------------------
| AI
|--------------------------------------------------------------------------
*/

.aiba-message.ai {

    background: white;

    color: #111827;

    border-bottom-left-radius: 5px;

    box-shadow:
        0 2px 10px rgba(0,0,0,0.08);
}

/*
|--------------------------------------------------------------------------
| ERROR
|--------------------------------------------------------------------------
*/

.aiba-message.error {

    background: #dc2626;

    color: white;
}

/*
|--------------------------------------------------------------------------
| LOADING
|--------------------------------------------------------------------------
*/

.aiba-message.ai-loading {

    background: #dbeafe;

    color: #1e40af;
}

/*
|--------------------------------------------------------------------------
| INPUT AREA
|--------------------------------------------------------------------------
*/

#aiba-chat-input-area {

    display: flex;

    gap: 10px;

    padding: 16px;

    border-top: 1px solid #e5e7eb;

    background: white;
}

/*
|--------------------------------------------------------------------------
| INPUT
|--------------------------------------------------------------------------
*/

#aiba-user-message {

    flex: 1;

    background: #f9fafb;

    border: 1px solid #e5e7eb;

    border-radius: 14px;

    padding: 12px 14px;

    font-size: 15px;

    outline: none;

    transition: all 0.2s ease;
}

#aiba-user-message:focus {

    border-color: #2563eb;

    box-shadow:
        0 0 0 4px rgba(37,99,235,0.15);
}

/*
|--------------------------------------------------------------------------
| BUTTON
|--------------------------------------------------------------------------
*/

#aiba-send-btn {

    min-width: 90px;

    background:
        linear-gradient(135deg,#2563eb,#1d4ed8);

    color: white;

    border: none;

    border-radius: 14px;

    padding: 0 20px;

    cursor: pointer;

    font-weight: 600;

    box-shadow:
        0 5px 15px rgba(37,99,235,0.25);

    transition: all 0.2s ease;
}

#aiba-send-btn:hover {

    transform: translateY(-1px);
}

/*
|--------------------------------------------------------------------------
| TOGGLE BUTTON
|--------------------------------------------------------------------------
*/

#aiba-chat-toggle {

    position: fixed;

    bottom: 20px;
    right: 20px;

    width: 70px;
    height: 70px;

    background:
        linear-gradient(135deg,#2563eb,#1d4ed8);

    color: white;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 30px;

    cursor: pointer;

    box-shadow:
        0 10px 30px rgba(0,0,0,0.25);

    z-index: 999999;

    transition: all 0.3s ease;
}

#aiba-chat-toggle:hover {

    transform: scale(1.08);
}

/*
|--------------------------------------------------------------------------
| HIDDEN
|--------------------------------------------------------------------------
*/

.aiba-hidden {

    display: none !important;
}

/*
|--------------------------------------------------------------------------
| MOBILE
|--------------------------------------------------------------------------
*/

@media(max-width:768px) {

    #aiba-chat-widget {

        width: calc(100% - 20px);

        right: 10px;

        bottom: 90px;

        height: 75vh;
    }
}

/*
|--------------------------------------------------------------------------
| ANIMATION CHAT
|--------------------------------------------------------------------------
*/

@keyframes aibaFadeIn {

    from {

        opacity: 0;

        transform: translateY(20px);
    }

    to {

        opacity: 1;

        transform: translateY(0);
    }
}

/*
|--------------------------------------------------------------------------
| ANIMATION MESSAGE
|--------------------------------------------------------------------------
*/

@keyframes aibaMessageFade {

    from {

        opacity: 0;

        transform: translateY(8px);
    }

    to {

        opacity: 1;

        transform: translateY(0);
    }
}

/*
|--------------------------------------------------------------------------
| QUICK ACTIONS
|--------------------------------------------------------------------------
*/

#aiba-quick-actions {

    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    padding: 10px 15px;

    background: #f9fafb;

    border-top: 1px solid #e5e7eb;
}

.aiba-quick-btn {

    background: white;

    border: 1px solid #dbeafe;

    color: #2563eb;

    border-radius: 30px;

    padding: 8px 14px;

    font-size: 13px;

    cursor: pointer;

    transition: 0.3s;
}

.aiba-quick-btn:hover {

    background: #2563eb;

    color: white;
}

/*
|--------------------------------------------------------------------------
| TYPING ANIMATION
|--------------------------------------------------------------------------
*/

.aiba-typing {

    display: flex;

    align-items: center;

    gap: 5px;

    padding: 4px 0;
}

.aiba-typing span {

    width: 8px;
    height: 8px;

    background: #2563eb;

    border-radius: 50%;

    animation: aibaTyping 1.4s infinite ease-in-out;
}

.aiba-typing span:nth-child(2) {

    animation-delay: 0.2s;
}

.aiba-typing span:nth-child(3) {

    animation-delay: 0.4s;
}

@keyframes aibaTyping {

    0% {
        transform: translateY(0);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-5px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
}

/*
|--------------------------------------------------------------------------
| DYNAMIC ACTIONS
|--------------------------------------------------------------------------
*/

.aiba-dynamic-actions {

    display: flex;

    gap: 10px;

    flex-wrap: wrap;

    margin-bottom: 15px;
}

.aiba-action-btn {

    background: white;

    border: 1px solid #dbeafe;

    color: #2563eb;

    padding: 10px 14px;

    border-radius: 999px;

    text-decoration: none;

    font-size: 13px;

    cursor: pointer;

    transition: 0.3s;
}

.aiba-action-btn:hover {

    background: #2563eb;

    color: white;
}