@import url("/index.css");

.chatbox {
    position: absolute;

    display: flex;
    flex-direction: row;

    width: 45%;

    bottom: 16px;
    left: 50%;

    transform: translateX(-50%);

    background: var(--bg);

    border-radius: var(--br-large);

    padding: 8px;

    border: 1px solid var(--border);

    align-items: center;

    margin: 4px;

    #query {
        background: none;
        border: none;

        width: 100%;

        font-size: 0.9rem;

        &:focus {
            outline: none;
        }
    }

    .send {
        width: 36px;
        aspect-ratio: 1;
        margin: 4px;
        padding: 0px;

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

        img {
            width: 16px;
            height: 16px;
        }
    }
}

.messagesContainer {
    position: absolute;
    top: 0px;
    left: 50%;
    bottom: 48px;
    transform: translate(-50%);
    background: none;
    width: 55%;

    margin: 0px;
    padding: 0px;

    .fade {
        content: '';
        display: block;
        position: fixed;

        left: 0px;
        bottom: 0px;
        width: 100%;
        height: 64px;

        background: linear-gradient(to bottom, #00000000, var(--bg-dark));
    }

    .messages {
        top: 0px;
        left: 0px;
        right: 0px;
        bottom: 0px;

        position: absolute;

        display: flex;
        flex-direction: column;

        padding: 12px;
        padding-top: 64px;
        padding-bottom: 64px;

        overflow-y: scroll;
        overflow-x: hidden;

        .userMessage {
            display: flex;
            background: var(--user-color);
            border-radius: 16px;
            border-bottom-right-radius: 4px;
            padding: 8px;
            color: black;
            margin-bottom: 16px;

            transition: all 150ms ease-out;
            flex-direction: column;

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

            box-sizing: content-box;

            margin-left: auto;
        }

        .assistantMessage {
            display: flex;
            background: var(--assistant-color);
            border-radius: 16px;
            border-bottom-left-radius: 4px;
            padding: 8px;
            color: black;
            margin-bottom: 16px;

            transition: all 150ms ease-out;
            flex-direction: column;

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

            box-sizing: content-box;

            margin-right: auto;
        }
    }
}

.loading {
    display: block;
    position: relative;
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
    border-radius: 100%;
    background: var(--text-muted);

    animation-name: loading;
    animation-duration: 500ms;
    animation-timing-function: linear;
    animation-iteration-count: infinite;

    margin: 16px;
}

.settings {
    position: absolute;
    top: 12px;
    left: -12px;
    border-radius: 12px;
    border-top-left-radius: 0px;
    border-bottom-left-radius: 0px;

    display: flex;
    align-items: center;
    justify-content: end;
    padding-right: 8px;
    box-sizing: border-box;

    width: 48px;
    height: 32px;

    background: var(--bg);
    border: 1px solid var(--border);

    transition: all 150ms ease-out;

    &:hover {
        transform: translateX(8px);
    }

    img {
        display: flex;
        width: 16px;
        height: 16px;
    }
}

h1 {
    font-size: 24px;
    color: black;
    margin: 4px;
}

h2 {
    font-size: 16px;
    color: black;
    margin: 4px;
}

h3 {
    font-size: 14px;
    color: black;
    margin: 4px;
}

ul {
    margin: 4px;
}

p {
    margin: 4px;
}

code {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 4px;
    text-wrap: none;
    box-sizing: border-box;
    width: fit-content;
    color: var(--text-muted);
}

pre:has(code) {
    background: var(--bg) !important;
    border: none !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}

.toolbar {
    margin: 8px !important;
    transform: translateY(-4px) !important;

    .toolbar-item {
        margin-left: 8px !important;
    }
}

a {
    color: oklch(65% 0.2 285);
    text-decoration: none;
    margin: 4px;
}

table, th, td {
    border: 1px solid var(--border);
    margin: 0px;
    border-collapse: collapse; 
}

@keyframes loading {
    0% {
        transform: translateX(0px) scale(1);
    }

    25% {
        transform: translateX(24px) scale(1.3);
    }

    50% {
        transform: translateX(48px) scale(1);
    }

    75% {
        transform: translateX(24px) scale(1.3);
    }

    100% {
        transform: translateX(0px) scale(1);
    }
}

@media (max-width: 1080px) {
    .messagesContainer {
        width: 85%;
    }

    .chatbox {
        width: 75%;

        input {
            width: 75%;
        }
    }

    .send {
        width: 48px;
        height: 48px;
    }
}