:root {
    --wpeazyai_primary_color: #0066cc;
    --wpeazyai_chat_bg_color: #f3f4f6;
    --wpeazyai_white_color: #ffffff;
    --wpeazyai_dark_text: #212529;
    --wpeazyai_muted_text: #6c757d;
    --wpeazyai_separator_color: #dee2e6;
    --wpeazyai_light_color: #f8f9fa;
    --wpeazyai_input_border: #86B7FE;
    --wpeazyai_input_outline: #C2DBFE;
    --black_25: #f9f9f9;
    --black_50: #f2f2f2;
    --black_75: #eeeeee;
    --black_100: #d6d9dc;
    --black_150: #c8ccd0;
    --black_200: #bbc0c4;
    --black_300: #9fa6ad;
    --black_350: #9199a1;
    --black_400: #848d95;
    --black_500: #6a737c;
    --black_600: #535a60;
    --black_700: #3c4146;
    --black_750: #2f3337;
    --black_800: #242729;
    --black_900: #0c0d0e;
    --bs-white: #ffffff;
}

body.body_dark, body.dark, body.is-dark, body.dark-mode {
    --bs-white: #1d2027;
    --black_900: #f1f1f1;
    --black_800: #e9e9e9;
    --black_700: #e1e1e1;
    --black_600: #bebebe;
    --black_500: #b9b9b9;
    --black_400: #a2a2a2;
    --black_200: #757474;
    --black_150: rgba(255, 255, 255, 0.3);
    --black_75: #535353;
    --black_50: #3b3b3b;
    --black_25: #2e2d2d;

    /* color: var(--black_700); */
}

.eazybot-bg-primary,
.eazybot-bg-primary:hover,
.eazybot-bg-primary:focus,
.eazybot-bg-primary-foreground {
    background-color: var(--wpeazyai_primary_color) !important;
}

.eazybot-text-primary-foreground {
    color: var(--wpeazyai_white_color);
}

/* Reset and Base Styles */
img.wpeazyai_icons {
    width: 16px;
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"].active {
    margin: -100px -11px 0 -15px;
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"].active div#eazyai-chatbox #eazyai-chatbox-inner-wrapper {
    height: 93%;
    position: absolute;
    bottom: 0;
    top: 40px;
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"] #eazyai-chatbox-header-text strong {
    margin-left: 5px;
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"].active div#eazyai-chatbox #eazyai-chatbox-inner-wrapper #eazyai-chatbox-header {
    background-color: var(--ezd_brand_color);
    padding: 20px 12px 12px;
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"] #eazyai-chatbox {
    display: block !important;
    position: unset;
    margin: 0;
    height: 100%;
    width: 100%;
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"] #eazyai-chatbox i {
    font-family: 'Font Awesome 6 Free';
}

.assistant-content[tab-content="wpeazyai_merge_eazydocs"] div#eazyai-chatbox #eazyai-chatbox-inner-wrapper #eazyai-chatbox-header #eazyai-chatbox-header-text {
    text-align: left;
}

div#eazyai-chatbox {
    width: min(400px, calc(100vw - 32px));
    height: min(600px, calc(100vh - 108px));
    margin: 16px 16px 92px 16px;
    position: fixed;
    right: 0;
    bottom: 0;
    background-color: var(--wpeazyai_white_color);
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.175);
    overflow: hidden;
    z-index: 999;
    display: none;
    flex-direction: column;

    & #eazyai-chatbox-inner-wrapper {
        width: 100%;
        height: 100%;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        background-color: var(--wpeazyai_chat_bg_color);

        & #eazyai-chatbox-header {
            justify-self: start;
            background-color: var(--wpeazyai_primary_color);
            color: var(--wpeazyai_white_color);
            padding: 12px 16px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;

            & #eazyai-chatbox-header-text {
                text-align: center;
                color: var(--wpeazyai_white_color);

                & strong {
                    font-size: 18px;
                    font-weight: 500;
                }

                & p {
                    font-size: 14px;
                    margin: 0;
                }
            }

            & button#EazyBotReload {
                border: none;
                outline: none;
                background: transparent;
                color: var(--wpeazyai_white_color);
                padding: 0;
                cursor: pointer;

                & .wpeazyai-icon.ea-sync {
                    width: 14px;
                }
            }
        }

        & .eazybotchatbox {
            flex-grow: 1;
            padding: 16px;
            overflow-y: auto;

            &:first-child {
                display: none;
            }

            & .eazyai-msg {
                display: flex;
                align-items: start;
                margin-bottom: 16px;

                & > p {
                    padding: 6px 12px;
                    border-radius: 8px;
                    margin: 0;
                    font-size: 14px;
                    max-width: 70%;
                }
            }

            & .eazyai-msg.bot {
                justify-content: start;

                & img {
                    border-radius: 50%;
                    margin-right: 8px;
                    width: 32px;
                    height: 32px;
                }

                & .eazyai-response {
                    color: var(--black_700);
                    background-color: var(--bs-white);
                    padding: 6px 12px;
                    border-radius: 8px;
                    font-size: 14px;
                    max-width: 70%;

                    & p {
                        margin-bottom: 20px;

                        &:last-child {
                            margin-bottom: 0;
                        }
                    }

                    & > p {
                        margin: 0;
                    }

                    & h1 {
                        font-size: 1.3em;
                        margin: 4px 0 8px;
                    }

                    & h2 {
                        font-size: 1.2em;
                        margin: 4px 0 8px;
                    }

                    & h3 {
                        font-size: 1.1em;
                        margin: 4px 0 8px;
                    }

                    & h4, & h5, & h6 {
                        font-size: 1em;
                        margin: 2px 0 8px;
                    }

                    & > .sources-container {
                        font-size: 12px;
                        display: none;

                        & > .sources {
                            outline: none;
                            border: none;
                            background: none;
                            color: inherit;
                            padding: 5px 0;
                            margin: 0;
                            font-size: 13px;
                            font-weight: 600;
                            display: flex;
                            align-items: center;
                            gap: 5px;

                            .wpeazyai-icon.ea-arrow-down {
                                width: 13px;
                                transition: ease 0.3s transform;
                            }

                            &.expanded {
                                .wpeazyai-icon.ea-arrow-down {
                                    transform: rotate(180deg);
                                }
                            }
                        }

                        & > .references {
                            display: none;
                            flex-direction: column;

                            & > a {
                                display: inline-flex;
                                align-items: center;
                                gap: 4px;
                                width: 100%;
                                white-space: nowrap;
                                overflow: hidden;
                                text-overflow: ellipsis;
                                text-decoration: none;
                                text-underline-offset: 4px;
                                color: var(--black_500);

                                &:hover {
                                    text-decoration: underline;
                                }

                                &.placeholder {
                                    display: none;
                                }
                            }
                        }
                    }

                }

            }

            & .eazyai-msg.user {
                justify-content: end;

                & > p {
                    color: var(--wpeazyai_white_color);
                    background-color: var(--wpeazyai_primary_color);
                }
            }

            & .eazyai-msg {

                &.user,
                &.bot {
                    &.placeholder {
                        display: none;
                    }
                }
            }
        }

        & #eazyai-chatbox-footer {
            justify-self: end;

            & #suggested-questions {
                padding: 8px 16px;
                border-top: 1px solid var(--wpeazyai_separator_color);

                & > p {
                    color: var(--wpeazyai_muted_text);
                    font-size: 14px;
                    margin-bottom: 8px;
                }

                & > button {
                    padding: 8px 16px;
                    font-size: 14px;
                    font-weight: 400;
                    text-align: left;
                    background-color: var(--black_75);
                    border: 1px solid var(--black_50);
                    border-radius: 4px;
                    width: 100%;
                    margin-bottom: 4px;
                    color: var(--black_700);
                    cursor: pointer;

                    &:hover {
                        background-color: var(--black_50);
                    }
                }
            }

            & #eazyai-input-container {
                display: flex;
                align-items: stretch;
                gap: 8px;
                padding: 8px;
                border-top: 1px solid var(--black_100);

                & #eazybotinput {
                    width: 100%;
                    padding: 8px 12px;
                    font-size: 16px;
                    color: var(--black_700);
                    background-color: var(--black_50);
                    border: 2px solid var(--black_100);
                    border-radius: 4px;
                    outline: none;

                    &:focus {
                        border-color: var(--wpeazyai_primary_color);
                    }
                }

                & #eazybotsend {
                    padding: 8px 12px;
                    font-size: 16px;
                    font-weight: 400;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    background-color: var(--wpeazyai_muted_text);
                    border: 1px solid var(--wpeazyai_muted_text);
                    border-radius: 4px;
                    color: var(--wpeazyai_white_color);
                    cursor: pointer;

                    &:hover {
                        opacity: 90%;
                    }

                    &:active {
                        scale: 90%;
                        transition-duration: 300ms;
                    }
                }
            }
        }
    }

}

button#eazyai-help-button {
    position: fixed;
    right: 25px;
    bottom: 25px;
    background-color: var(--wpeazyai_primary_color);
    color: var(--wpeazyai_white_color);
    padding: 16px;
    border-radius: 200px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.175);
    z-index: 9999;
    border: 0;
    cursor: pointer;
    transition-duration: 300ms;

    & div {
        height: 20px;
        min-width: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;

        & #help-icon {
            & .wpeazyai-icon {
                width: 20px;
            }
        }

        & #close-icon {
            display: none;

            & .wpeazyai-icon {
                width: 14px;
            }
        }
    }

    &:hover {
        scale: 110%;
    }

    &:active {
        scale: 100%;
    }
}

.eazyai-loading-dots {
    display: inline-block;
    margin: 0;
}

.eazyai-dot {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    width: 12px;
    height: 12px;
    background-color: gray;
    border-radius: 50%;
    opacity: 0;
    animation: eazyai-dot-blink 1s infinite ease-in-out;
}

.eazyai-dot:nth-child(1) {
    animation-delay: 0s;
}

.eazyai-dot:nth-child(2) {
    animation-delay: 0.33s;
}

.eazyai-dot:nth-child(3) {
    animation-delay: 0.66s;
}

@keyframes eazyai-dot-blink {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

button#eazyai-help-button-sm {
    display: flex;
    background: #405261;
    position: fixed;
    top: -30px;
    right: 4px;
    border: none;
    outline: none;
    border-radius: 50px;
    padding: 4px 8px;
    color: #ccc;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    transition: top 0.3s ease;

    .eazyai_arrow_down_icon {
        width: 12px;
    }
}

@media screen and (max-width: 480px) {
    div#eazyai-chatbox {
        width: 100%;
        height: calc(100% - 30px);
        margin: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    body.wpeazyai_chatbox_expanded {
        button#eazyai-help-button {
            display: none;
        }

        button#eazyai-help-button-sm {
            top: 4px;
        }
    }
}