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

#jaseir-ai-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}


/* =========================================================
   FLOATING BUTTON
   ========================================================= */

#jaseir-ai-toggle {
    width: 64px;
    height: 64px;

    border: none;
    border-radius: 50%;

    background: #111827;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.25);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

#jaseir-ai-toggle:hover {
    transform: translateY(-2px);

    box-shadow:
        0 14px 35px rgba(0, 0, 0, 0.30);
}


/* =========================================================
   CHAT WINDOW
   ========================================================= */

#jaseir-ai-chat {
    position: fixed;

    right: 24px;
    bottom: 24px;

    width: 380px;
    height: 650px;

    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);

    background: #ffffff;

    border-radius: 24px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.25);

    border: 1px solid #e5e7eb;
}

#jaseir-ai-chat.jaseir-ai-hidden {
    display: none;
}


/* =========================================================
   HEADER
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-header {
    flex: 0 0 auto;

    min-height: 84px;

    padding: 18px 20px;

    background: #111827;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: space-between;

    box-sizing: border-box;
}

#jaseir-ai-chat .jaseir-ai-header > div {
    display: flex;
    flex-direction: column;

    gap: 4px;

    min-width: 0;
}

#jaseir-ai-chat .jaseir-ai-header strong {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

#jaseir-ai-chat .jaseir-ai-header span {
    font-size: 13px;
    color: #d1d5db;
}

#jaseir-ai-chat .jaseir-ai-online-dot {
    display: inline-block;

    width: 8px;
    height: 8px;

    margin-right: 5px;

    border-radius: 50%;

    background: #22c55e;
}


/* Close button */

#jaseir-ai-chat #jaseir-ai-close {
    flex: 0 0 auto;

    width: 44px;
    height: 44px;

    padding: 0;

    border: 1px solid #9ca3af;
    border-radius: 6px;

    background: #ffffff;
    color: #111827;

    font-size: 28px;
    line-height: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
}

#jaseir-ai-chat #jaseir-ai-close:hover {
    background: #f3f4f6;
}


/* =========================================================
   MESSAGE AREA
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-messages {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 24px 18px;

    background: #f8fafc;

    box-sizing: border-box;

    scroll-behavior: smooth;
}


/* =========================================================
   INDIVIDUAL MESSAGE
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-message {
    width: 100%;

    box-sizing: border-box;

    margin: 0 0 20px 0;

    display: flex;

    align-items: flex-start;

    gap: 12px;

    clear: both;
}


/* =========================================================
   ASSISTANT MESSAGE
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-message.assistant {
    justify-content: flex-start;
}


/* Avatar */

#jaseir-ai-chat .jaseir-ai-message.assistant
.jaseir-ai-avatar {
    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    border-radius: 50%;

    background: #ffffff;

    color: #111827;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
    font-weight: 700;

    line-height: 1;

    box-sizing: border-box;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.06);
}


/* Assistant content */

#jaseir-ai-chat .jaseir-ai-message.assistant
.jaseir-ai-message-content,

#jaseir-ai-chat .jaseir-ai-message.assistant > div:not(.jaseir-ai-avatar) {
    flex: 1 1 auto;

    min-width: 0;

    max-width: calc(100% - 54px);

    box-sizing: border-box;

    color: #4b5563;

    font-size: 16px;

    line-height: 1.65;

    overflow-wrap: anywhere;
    word-break: normal;
}


/* =========================================================
   USER MESSAGE
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-message.user {
    justify-content: flex-end;

    padding-left: 50px;

    box-sizing: border-box;
}


/* User message content */

#jaseir-ai-chat .jaseir-ai-message.user
.jaseir-ai-message-content {
    flex: 0 1 auto;

    max-width: 85%;

    box-sizing: border-box;

    padding: 12px 16px;

    border-radius: 18px 18px 4px 18px;

    background: #111827;

    color: #ffffff;

    font-size: 15px;

    line-height: 1.55;

    overflow-wrap: anywhere;
    word-break: normal;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   FIRST WELCOME MESSAGE
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-message.assistant:first-child {
    margin-bottom: 26px;
}


/* =========================================================
   TYPING INDICATOR
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-typing {
    flex: 0 0 auto;

    padding: 8px 18px 10px;

    background: #f8fafc;

    color: #6b7280;

    font-size: 13px;

    box-sizing: border-box;
}


/* =========================================================
   INPUT AREA
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-form {
    flex: 0 0 auto;

    width: 100%;

    min-height: 78px;

    padding: 12px 14px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;

    display: flex;

    align-items: center;

    gap: 8px;

    box-sizing: border-box;

    margin: 0;
}


/* Input */

#jaseir-ai-chat #jaseir-ai-input {
    flex: 1 1 auto;

    min-width: 0;

    height: 54px;

    padding: 0 14px;

    border: 1px solid #cbd5e1;

    border-radius: 14px;

    outline: none;

    background: #ffffff;

    color: #111827;

    font-family: inherit;

    font-size: 16px;

    line-height: 1.4;

    box-sizing: border-box;

    margin: 0;
}

#jaseir-ai-chat #jaseir-ai-input:focus {
    border-color: #111827;

    box-shadow:
        0 0 0 2px rgba(17, 24, 39, 0.08);
}

#jaseir-ai-chat #jaseir-ai-input::placeholder {
    color: #9ca3af;
}


/* Send button */

#jaseir-ai-chat #jaseir-ai-send {
    flex: 0 0 56px;

    width: 56px;
    height: 56px;

    padding: 0;

    border: none;

    border-radius: 14px;

    background: #111827;

    color: #ffffff;

    font-size: 25px;

    line-height: 1;

    display: flex;

    align-items: center;
    justify-content: center;

    cursor: pointer;

    box-sizing: border-box;

    margin: 0;
}

#jaseir-ai-chat #jaseir-ai-send:hover {
    background: #1f2937;
}

#jaseir-ai-chat #jaseir-ai-send:disabled {
    opacity: 0.5;

    cursor: not-allowed;
}


/* =========================================================
   FOOTER
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-footer {
    flex: 0 0 auto;

    min-height: 44px;

    padding: 10px;

    background: #ffffff;

    color: #9ca3af;

    text-align: center;

    font-size: 13px;

    line-height: 1.4;

    border-top: 1px solid #f1f5f9;

    box-sizing: border-box;
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

#jaseir-ai-chat .jaseir-ai-messages::-webkit-scrollbar {
    width: 6px;
}

#jaseir-ai-chat .jaseir-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

#jaseir-ai-chat .jaseir-ai-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    #jaseir-ai-widget {
        right: 12px;
        bottom: 12px;
    }

    #jaseir-ai-toggle {
        width: 58px;
        height: 58px;

        font-size: 25px;
    }

    #jaseir-ai-chat {
        right: 8px;
        bottom: 8px;

        width: calc(100vw - 16px);

        height: calc(100vh - 16px);

        max-width: none;
        max-height: none;

        border-radius: 18px;
    }

    #jaseir-ai-chat .jaseir-ai-header {
        min-height: 72px;

        padding: 14px 16px;
    }

    #jaseir-ai-chat .jaseir-ai-header strong {
        font-size: 19px;
    }

    #jaseir-ai-chat .jaseir-ai-messages {
        padding: 18px 14px;
    }

    #jaseir-ai-chat .jaseir-ai-message {
        gap: 9px;

        margin-bottom: 18px;
    }

    #jaseir-ai-chat .jaseir-ai-message.assistant
    .jaseir-ai-avatar {
        flex-basis: 36px;

        width: 36px;
        height: 36px;

        font-size: 17px;
    }

    #jaseir-ai-chat .jaseir-ai-message.assistant
    .jaseir-ai-message-content,

    #jaseir-ai-chat .jaseir-ai-message.assistant
    > div:not(.jaseir-ai-avatar) {
        max-width: calc(100% - 45px);

        font-size: 15px;

        line-height: 1.55;
    }

    #jaseir-ai-chat .jaseir-ai-message.user {
        padding-left: 30px;
    }

    #jaseir-ai-chat .jaseir-ai-message.user
    .jaseir-ai-message-content {
        max-width: 90%;

        font-size: 15px;
    }

    #jaseir-ai-chat .jaseir-ai-form {
        min-height: 72px;

        padding: 9px 10px;
    }

    #jaseir-ai-chat #jaseir-ai-input {
        height: 52px;

        font-size: 16px;
    }

    #jaseir-ai-chat #jaseir-ai-send {
        flex-basis: 52px;

        width: 52px;
        height: 52px;
    }

    #jaseir-ai-chat .jaseir-ai-footer {
        min-height: 38px;

        padding: 8px;

        font-size: 12px;
    }
}