:root {
    /* Colors */
    --chat-container-bg: #FFFFFF;
    --chat-textarea-bg: #F7F7F8;
    --console: #1EFF00;
    --lighter-gray: #D9D9E3;

    /* WordPress colors */
    --wp-blue: #0073aa;
    --wp-menu-blue: #2271b1;
    --wp-medium-blue: #00a0d2;
    --wp-ultra-dark-gray: #191e23;
    --wp-dark-gray: #23282d;
    --wp-base-gray: #32373c;
    --wp-dark-silver-gray: #82878c;
    --wp-silver-gray: #a0a5aa;
    --wp-light-silver-gray: #b4b9be;
    --wp-accent-red: #dc3232;
    --wp-accent-orange: #f56e28;
    --wp-accent-yellow: #ffb900;
    --wp-accent-green: #46B450;
    --wp-accent-purple: #826eb4;

    /* Size */
    --max-container-width: 800px;
}

/* Basic animation */
.fadeIn {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.33s ease-in-out;
}

.fadeOut {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 2.6s, opacity 2.6s ease-in-out;
}

.keyframesFadeOut {
    animation: fadeOut 2.6s;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* https://stackoverflow.com/a/17260048/1007492 */
.clipOut {
    clip: rect(auto, auto, 0, auto);
    transition-property: clip;
    transition-duration: 0.46s;
    transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.maxHeightOut {
    max-height: 0;
    transition: max-height 0.26s ease-out;
    overflow: hidden;
}

/* https://jsfiddle.net/dotnetCarpenter/PhyQc/9/ */
.scaleY {
    -webkit-transform: scaleY(0);
    -o-transform: scaleY(0);
    -ms-transform: scaleY(0);
    transform: scaleY(0);

    -webkit-transform-origin: top;
    -o-transform-origin: top;
    -ms-transform-origin: top;
    transform-origin: top;

    -webkit-transition: -webkit-transform 0.26s ease-out;
    -o-transition: -o-transform 0.26s ease;
    -ms-transition: -ms-transform 0.26s ease;
    transition: transform 0.26s ease;
}

/* https://stackoverflow.com/a/30531678/1007492 */
.shrinkOut {
    margin: 0;
    opacity: 0;
    padding: 0;
    /* fade out, then shrink */
    transition: opacity .25s,
        font-size .5s .25s,
        margin .5s .25s,
        visibility 0s 2s,
        padding .5s .25s;
}

/* Custom admin menu icons */
#toplevel_page_alpaca-bot .wp-menu-image>img {
    width: 20px;
    height: 20px;
    filter: invert(100%);
}

/* Primary wrap */
#ab-chat-container {
    min-height: 61vh;
}

/* Welcome message */
#ab-hello p {
    color: #646970;
    font-size: 1.5rem;
    font-style: normal;
    margin: 0;
    text-align: center;
}

#ab-hello img {
    padding: 2em;
    display: block;
    margin: 0 auto;
    width: 128px;
    height: 128px;
    border-radius: 50%;
}

/* Loading indicator */
#indicator {
    padding: 2em;
    display: block;
    margin: 1em auto;
    width: 28px;
    height: 28px;
}

/* Toolbar (model select, chat history select) */
.ab-toolbar {
    min-height: 40px;
    margin: 20px 0 30px 0;
}

.ab-toolbar select {
    font-size: 1.1em;
    width: 240px;
    height: 35px;
    border: 1px solid var(--wp-light-silver-gray);
    border-radius: 5px;
    vertical-align: top;
}

.ab-toolbar p {
    display: block;
    margin: 0.75em 0 0 0.5em;
    font-size: .95em;
    color: var(--wp-base-gray);
}

.ab-toolbar #set_default_model:hover {
    color: var(--wp-blue);
    cursor: pointer;
}

.ab-toolbar .ab-tags {
    float: left;
}

.ab-toolbar .ab-chat-logs,
#set_default_model {
    float: right;
}

.ab-toolbar p,
.ab-toolbar select {
    display: inline-block;
}

.ab-toolbar p {
    margin-right: .5em;
}

#ab-response {
    max-width: var(--max-container-width);
    margin: 0 auto;
}

.toplevel_page_alpaca-bot #wpfooter #footer-left {
    color: var(--wp-silver-gray);
    font-size: .75rem;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline;
}

.ab-chat-message {
    margin: .6em 0;
}

.ab-chat-message-response,
.ab-chat-message-response div,
.ab-chat-message-response p {
    line-height: 1.31rem;
}

.ab-chat-message-response p {
    margin: .7rem 0;
}

.ab-chat-message .notice {
    margin: 1em 0;
}

.ab-chat-message-response img {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    width: 200px;
}

/* gravatar column should stretch to the bottom, forcing all elements to line up against */
.ab-chat-message-gravatar {
    float: left;
    height: 100%;
    margin-right: 1em;
}

.ab-chat-message-gravatar img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.ab-chat-message-parts {
    margin-left: 38px;
    display: flex;
    flex-direction: column;
}

/* .ab-chat-message-tools needs to make space for gravatar on left 38px */
.ab-chat-message-tools {
    color: var(--wp-light-silver-gray);
    margin: 1em 0;
    justify-content: space-between;
    transition: opacity 0.3s ease-in;
    transition: opacity 0.1s ease-out;
}

/* increase opacity on tools when hovering over parent message */
.ab-chat-message:hover .ab-chat-message-tools {
    color: var(--wp-dark-gray);
}

/* transition tool span changes */
.ab-chat-message-tools span.tools {
    font-size: 1.25rem;
    color: var(--wp-dark-silver-gray);
    cursor: pointer;
    transition: color 0.3s ease-in-out;
    margin-right: .3em;
}

.ab-chat-message-tools span:hover {
    color: var(--wp-dark-gray);
}

.ab-chat-message-tools span.rotate-push-pin {
    transform: rotate(33deg);
}

.ab-chat-message-username {
    font-size: 1.1em;
    font-weight: bold;
    line-height: 1.3em;
    text-transform: capitalize;
}

.ab-chat-message-username .model {
    color: var(--wp-silver-gray);
    font-family: monospace;
    font-size: .82em;
    font-weight: normal;
    text-transform: none;
    margin-left: .33em;
}

.alpaca-bot-options p.description {
    margin: .6em .3em;
}

.alpaca-bot-options p.description.inline {
    display: inline;
}

.alpaca-bot-options p.description span {
    vertical-align: middle;
    margin-right: .1em;
    position: relative;
    display: inline-block;
}

.alpaca-bot-options p.description span.label-success {
    color: #46B450;
}

.alpaca-bot-options p.description span.label-error {
    color: #dc3232;
}

.alpaca-bot-options pre.console,
.toplevel_page_alpaca-bot .console {
    background-color: var(--wp-ultra-dark-gray);
    padding: 1em;
    border-radius: 5px;
    font-family: monospace;
    font-weight: bold;
    color: limegreen;
    text-shadow: 0px 0px .8em var(--console);
    cursor: pointer;
}

/*
    Typing container styling
    https://emma-delaney.medium.com/how-to-create-your-own-chatgpt-in-html-css-and-javascript-78e32b70b4be 
*/
.typing-container {
    position: -webkit-sticky;
    position: sticky;
    bottom: 1em;
    width: calc(100% - 20px);
    display: flex;
    justify-content: center;
    z-index: 10;
    margin-top: 1em;
}

.typing-container .typing-content {
    display: flex;
    max-width: var(--max-container-width);
    width: 100%;
    align-items: flex-end;
}

.typing-container .typing-textarea {
    width: 100%;
    display: flex;
    position: relative;
}

.typing-textarea textarea {
    resize: none;
    height: 42px;
    width: 100%;
    border: none;
    padding: 10px 35px 5px 40px;
    color: var(--wp-base-gray);
    font-size: 1rem;
    border-radius: 4px;
    max-height: 250px;
    overflow-y: auto;
    background: var(--chat-textarea-bg);
    outline: 1px solid var(--lighter-gray);
    line-height: 1.3rem;
}

.typing-textarea textarea::placeholder {
    color: var(--wp-dark-silver-gray);
}

/* clear all button styles in .typing-textarea */
.typing-textarea button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.typing-content button,
.typing-content span {
    width: 43px;
    height: 43px;
    display: flex;
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    color: var(--wp-silver-gray);
    cursor: pointer;
}

.typing-textarea button,
.typing-textarea span {
    position: absolute;
    bottom: 0px;
    color: var(--wp-light-silver-gray);
}

.typing-textarea button#submit {
    right: 0;

}

.typing-textarea button#upload {
    left: 0;
}

.typing-textarea button#upload_remove {
    display: none;
}

.typing-textarea textarea:valid~button#submit,
.typing-textarea textarea:valid~span {
    color: var(--wp-dark-silver-gray);
}

/* on hover and when disabled  */
.typing-textarea button:hover,
.typing-textarea span:hover {
    color: var(--wp-blue);
}

/* if span has disabled="" */
.typing-textarea button[disabled],
.typing-textarea span[disabled] {
    color: var(--lighter-gray);
    cursor: not-allowed;
}

#ab-hello {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.alpaca-bot-options .accordion-btn {
    background-color: var(--wp-dark-gray);
    color: var(--lighter-gray);
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 15px;
    transition: 0.4s;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--wp-ultra-dark-gray);
}

.alpaca-bot-options .accordion-btn code {
    margin-right: .5em;
}

.alpaca-bot-options .panel code {
    padding: 0;
}

.ab-accordian .active,
.alpaca-bot-options .accordion-btn:hover {
    background-color: var(--wp-blue);
    color: var(--chat-container-bg);
    border-bottom: 1px solid var(--wp-medium-blue);
}

.alpaca-bot-options .accordion-btn:after {
    content: '\002B';
    color: var(--wp-light-silver-gray);
    font-weight: bold;
    margin-left: auto;
}

.ab-accordian .active:after {
    content: "\2212";
}

.alpaca-bot-options .panel {
    padding: 0 18px;
    background-color: var(--chat-textarea-bg);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

.alpaca-bot-options .panel ul a {
    text-decoration: none;
}

.alpaca-bot-shortcode-processed {
    font-size: .8em;
    background-color: var(--wp-ultra-dark-gray);
    margin: .8em 0;
    padding: .4em .6em;
    border-radius: 5px;
    font-family: monospace;
    font-weight: bold;
    color: var(--console);
    text-shadow: 0px 0px .7em var(--console);
    cursor: pointer;
}

/* The container <div> - needed to position the dropdown content */
.ab-dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.ab-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--chat-textarea-bg);
    min-width: 260px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.15);
    z-index: 1;
    border-radius: 4px;
}

/* Links inside the dropdown */
.ab-dropdown-content a {
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.ab-dropdown-content a strong {
    color: var(--wp-dark-gray);
}

.ab-dropdown-content a p {
    color: var(--wp-dark-silver-gray);
    font-size: .9em;
    margin: .2em 0;
}

/* Change color of dropdown links on hover */
.ab-dropdown-content a:hover {
    color: var(--wp-dark-gray);
    background-color: var(--chat-container-bg);
    border-radius: 4px;
}

/* Show the dropdown menu on hover */
.ab-dropdown:hover .ab-dropdown-content {
    display: block;
}

/* reduce the size of google icons in span tags inside of dropdown-content  */
.ab-dropdown-content span {
    float: left;
    font-size: 1.33em;
    margin-right: .5em;
}

/* reduce p padding */
.ab-dropdown-content p {
    margin: .5em 0;
}

.page-title-action span {
    font-size: 1.2em;
    margin-left: .2em;
    width: .9em;
    vertical-align: middle;
}

/* reduce text size for hint.css tooltop */
[class*=hint--]:after {
    font-size: .8rem !important;
}

/* Responsive Media Query */
@media screen and (max-width: 781px) {
    .typing-container {
        position: fixed;
        bottom: 10px;
        width: calc(100% - 20px);
    }

    .ab-toolbar {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 100%;
        margin-bottom: 1em;
    }

    .ab-toolbar div {
        margin: 0.5em 0;
    }

    .ab-toolbar code,
    .ab-toolbar select {
        float: right;
    }

    #set_default_model {
        display: none;
    }

    .ab-chat-message-username {
        font-size: 1.15em;
        line-height: 1.4em;
    }

    .ab-chat-message-username,
    .ab-chat-message-username .model {
        margin-bottom: 0;
    }

    .ab-chat-message-parts,
    .ab-chat-message-tools {
        margin-left: 0;
    }

    .ab-chat-message-response {
        font-size: 1.25em;
        line-height: 1.4em;
        margin-top: 0;
    }
}

@media screen and (max-width: 360px) {
    .ab-toolbar select {
        margin-top: 0em;
        width: 100%;
    }
}

@media screen and (max-width: 255px) {
    .ab-toolbar {
        margin-top: 0em;
    }

    #ab-chat-container .page-title-action {
        width: 100%;
    }
}