:root {
    --darker-gray: #1C1C1D;
    --dark-gray: #212125;
    --light-gray: #2C2E34;
    --light-theme-gray: #f9fbff;
    --border-color-dark: #525252;
    --header-width: 112px;
    --selected-item-color-dark: #282930;
}

@font-face {
    font-family: Inter;
    src: url('file/css/Inter/Inter-VariableFont_opsz,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

@font-face {
    font-family: Inter;
    src: url('file/css/Inter/Inter-Italic-VariableFont_opsz,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
}

.padded.svelte-12cmxck {
    padding: 3px 0;
}

div.svelte-sfqy0y,
div.svelte-iyf88w {
    background: transparent;
    border: 0;
}

/* "info" messages without a title above */
.block > .svelte-e8n7p6:not(:only-of-type, #chat-mode *) {
    margin-bottom: 0;
}

.py-6 {
    padding-top: 2.5rem
}

.small-button {
    min-width: 0 !important;
    max-width: 171px;
    height: 39.594px;
    align-self: end;
}

.refresh-button {
    max-width: none;
    min-width: 2.2em !important;
    height: 39.594px;
    align-self: end;
    line-height: 1em;
    border-radius: 0.375rem;
    flex: none;
}

.refresh-button-medium {
    max-width: 4.4em;
}

.refresh-button-small {
    max-width: 2.2em;
}

.button_nowrap {
    white-space: nowrap;
}

#slim-column {
    flex: none !important;
    min-width: 0 !important;
}

.slim-dropdown {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
}

#download-label, #upload-label {
    min-height: 0
}

.dark a {
    color: white !important;
}

ol li p, ul li p {
    display: inline-block;
}

#notebook-parent-tab, #chat-tab, #parameters, #chat-settings, #lora, #training-tab, #model-tab, #session-tab, #character-tab, #image-ai-tab {
    border: 0;
}

#notebook-parent-tab, #parameters, #chat-settings, #lora, #training-tab, #model-tab, #session-tab, #character-tab, #image-ai-tab {
    padding: 1rem;
}

.gradio-container {
    max-width: 100% !important;
    padding-top: 0 !important;
}

#extensions {
    margin: 5px auto 35px;
    max-width: 880px;
    padding: 1em;
    padding-left: calc(var(--header-width) + 1em);
}

.extension-tab {
    border: 0 !important;
}

span.math.inline {
    font-size: 27px;
    vertical-align: baseline !important;
}

gradio-app > :first-child {
    padding: 0 !important;
}

.header_bar {
    border-right: var(--input-border-width) solid var(--input-border-color);
    margin-bottom: 0;
    overflow-x: scroll;
    text-wrap: nowrap;
    z-index: 90;
    position: fixed;
    display: flex !important;
    flex-direction: column;
    height: 100dvh;
    width: var(--header-width);
}

.header_bar button {
    margin: 0;
    padding: 0.75rem;
}

.header_bar button.selected {
    border: 0;
}

.dark .header_bar {
    border: none !important;
    box-shadow: 0 3px 4px rgba(20 20 20 / 60%);
    background-color: #8080802b;
}

.header_bar button.selected {
    border-radius: 0;
}

.textbox_default textarea {
    height: calc(100dvh - 202px);
}

.textbox_default_output textarea {
    height: calc(100dvh - 118px);
}

.textbox textarea {
    height: calc(100dvh - 145px)
}

.textbox_logits textarea {
    height: calc(100dvh - 205px);
}

.textbox_logits_notebook textarea {
    height: calc(100dvh - 221px);
}

.monospace textarea {
    font-family: monospace;
}

.textbox_default textarea,
.textbox_default_output textarea,
.textbox_logits textarea,
.textbox_logits_notebook textarea,
.textbox textarea {
    font-size: 16px !important;
    color: #46464A !important;
}

.dark textarea {
    color: #efefef !important;
}

/* Hide the gradio footer */
footer {
    display: none !important;
}

button {
    font-size: 14px !important;
}

.file-saver {
    position: fixed !important;
    height: 100%;
    z-index: 1000;
    background-color: rgb(0 0 0 / 50%) !important;
    margin-left: -20px;
    margin-right: -20px;
}

.file-saver > :first-child {
    position: fixed !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* center horizontally */
    width: 100%;
    max-width: 500px;
    background-color: var(--input-background-fill);
    border: var(--input-border-width) solid var(--input-border-color) !important;
    padding: 10px;
}

.file-saver > :first-child > :last-child {
    background: var(--block-background-fill);
    justify-content: flex-end;
}

.checkboxgroup-table label {
    background: none !important;
    padding: 0 !important;
    border: 0 !important;
}

.checkboxgroup-table div {
    display: grid !important;
}

.markdown ul ol {
    font-size: 100% !important;
}

.pretty_scrollbar::-webkit-scrollbar,
#image-history-gallery > :nth-child(2)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.pretty_scrollbar::-webkit-scrollbar-track,
#image-history-gallery > :nth-child(2)::-webkit-scrollbar-track {
    background: transparent;
}

.pretty_scrollbar::-webkit-scrollbar-thumb,
.pretty_scrollbar::-webkit-scrollbar-thumb:hover,
#image-history-gallery > :nth-child(2)::-webkit-scrollbar-thumb,
#image-history-gallery > :nth-child(2)::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-300);
    border-radius: 30px;
}

.dark .pretty_scrollbar::-webkit-scrollbar-thumb,
.dark .pretty_scrollbar::-webkit-scrollbar-thumb:hover,
.dark #image-history-gallery > :nth-child(2)::-webkit-scrollbar-thumb,
.dark #image-history-gallery > :nth-child(2)::-webkit-scrollbar-thumb:hover {
    background: rgb(255 255 255 / 6.25%);
    border-radius: 10px;
}

.pretty_scrollbar::-webkit-resizer,
#image-history-gallery > :nth-child(2)::-webkit-resizer {
    background: #c5c5d2;
}

.dark .pretty_scrollbar::-webkit-resizer,
.dark #image-history-gallery > :nth-child(2)::-webkit-resizer {
    background: #ccc;
    border-radius: 10px;
}

.pretty_scrollbar::-webkit-scrollbar-corner,
#image-history-gallery > :nth-child(2)::-webkit-scrollbar-corner {
    background: transparent;
}

audio {
    max-width: 100%;
}

/* Copied from https://github.com/AUTOMATIC1111/stable-diffusion-webui */
#default-token-counter, #notebook-token-counter {
    position: absolute !important;
    z-index: 100;
    background: var(--input-background-fill) !important;
    min-height: 0 !important;
    width: 0;
    text-align: left;
    direction: rtl;
    right: 13px;
}

#default-token-counter {
    top: calc(100dvh - 200px) !important;
}

#notebook-token-counter {
    top: calc(100dvh - 172px) !important;
}

#default-token-counter span, #notebook-token-counter span {
    padding: 1px;
    box-shadow: 0 0 0 0.3em rgb(192 192 192 / 15%), inset 0 0 0.6em rgb(192 192 192 / 7.5%);
    border: 2px solid rgb(192 192 192 / 40%) !important;
    border-radius: 0.4em;
}

.no-background {
    background: transparent;
    padding: 0 !important;
}

/* ----------------------------------------------
  Chat tab
---------------------------------------------- */
.h-\[40dvh\] {
    height: 66.67dvh
}

.gradio-container {
    margin-left: auto !important;
    margin-right: auto !important;
}

.w-screen {
    width: unset
}

.pending.svelte-1ed2p3z {
    opacity: 1;
}

#chat-tab {
    padding: 0;
}

#chat-tab > :nth-child(1) {
    display: flex;
    flex-direction: row;
    gap: 0;
}

#chat-tab button, #notebook-tab button, #default-tab button {
    min-width: 0 !important;
}

#chat-tab > :first-child, #extensions {
    margin-left: auto;
    margin-right: auto;
}

@media screen and (width <= 688px) {
    #chat-tab {
        padding-left: 0;
        padding-right: 0;
    }

    .chat {
        padding-left: 0;
        padding-right: 0;
    }
}

.chat {
    margin-left: auto;
    margin-right: auto;
    flex: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    word-break: break-word;
    overflow-wrap: anywhere;
    border-top: none;
    border-radius: 0;
    visibility: visible;
}

.chat-parent {
    flex: 1;
    overflow: auto !important;
    border-radius: 0 !important;
    margin-bottom: 75px;
}

.chat-parent .prose {
    visibility: visible;
}

.chat .message {
    width: min(100%, 48rem);
    margin-left: auto;
    margin-right: auto;
    text-align: start;
    padding-left: 1rem;
    padding-right: 1rem;
    contain: layout;
}

.chat .message .timestamp {
    font-size: 0.7em;
    display: inline-block;
    font-weight: normal;
    opacity: 0.7;
    margin-left: 5px;
}

.chat > .messages {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 102px);
}

.chat > .messages > :first-child {
    padding-top: 20px;
}

.message-body {
    font-size: 16px;
}

.dark .message-body :is(h1, h2, h3, h4, h5, h6) {
    color: white !important;
}

.message-body h1 {
    font-weight: 800;
    font-size: 2.25em;
    margin-top: 0;
    margin-bottom: 0.8888889em;
    line-height: 1.1111111;
}

.message-body h2 {
    font-weight: 700;
    font-size: 1.5em;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.3333333;
}

.message-body h3 {
    font-weight: 600;
    font-size: 1.25em;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
    line-height: 1.6;
}

.message-body h4 {
    font-weight: 600;
    font-size: 1em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.5;
}

.message-body h5 {
    font-weight: normal;
    font-size: 1em;
    margin: 0;
}

.message-body h6 {
    font-weight: normal;
    font-size: 1em;
    margin: 0;
}

.dark .message q {
    color: #f5b031;
}

.message-body q::before, .message-body q::after {
    content: "";
}

.message-body li {
    list-style-position: outside;
    margin-top: 0.5em !important;
    margin-bottom: 0.5em !important;
}

.message-body ul.long-list > li,
.message-body ol.long-list > li {
    margin-top: 1.25em !important;
    margin-bottom: 1.25em !important;
}

.message-body a {
    font-weight: 500;
}

.chat .message-body ul, .chat .message-body ol {
    padding-inline-start: 2em;
}

.message-body li > p {
    display: inline !important;
}

.message-body ul {
    list-style-type: disc !important;
}

.message-body pre:not(:last-child) {
    margin-bottom: 35.625px !important;
}

.message-body pre:last-child {
    margin-bottom: 0 !important;
}

#default-tab .prose pre, #notebook-tab .prose pre {
    overflow: scroll;
}

.prose ul ul {
    margin: 0;
}

.message-body pre > code {
    white-space: pre !important;
    overflow-x: auto !important;
    max-width: calc(100dvw - 39px);
    border: 1px solid #666;
    border-radius: 5px;
    font-size: 82%;
    padding: 1px 3px;
    background: #f3f4f6 !important;
    color: #1f2328;
}

.dark .message-body pre > code {
    background: #0d1117 !important;
    color: rgb(201 209 217);
}

.message-body pre > code {
    display: block;
    padding: 15px;
}

.message-body :not(pre) > code {
    white-space: normal !important;
    font-weight: bold;
    font-size: 0.95em;
    font-family: Menlo,"Roboto Mono","Courier New",Courier,monospace,Inter,sans-serif;
    padding: .15rem .3rem;
    background-color: #ececec;
}

.dark .message-body :not(pre) > code {
    background-color: rgb(255 255 255 / 10%);
}

#chat-input {
    padding: 0;
    background: transparent;
    border: none;
}

#chat-input textarea {
    background: #f3f4f6;
    padding: 0.65rem 2.5rem;
    border: 0;
    box-shadow: 0;
    border-radius: 8px;
}

#chat-input textarea::placeholder {
    white-space: nowrap;
    overflow: hidden;
}

#chat-input textarea:focus {
    box-shadow: none !important;
}

#chat-input > :first-child {
    background-color: transparent;
}

#chat-input .progress-text {
    display: none;
}

#chat-input .submit-button {
    display: none;
}

#chat-input .upload-button {
    margin-right: 16px;
    margin-bottom: 7px;
    background: transparent;
}

.chat-input-positioned {
    max-width: 54rem;
    left: 50%;
    transform: translateX(-50%);
    position: absolute;
    bottom: 0;
    background: var(--body-background-fill);
}

@media print {
    body {
        visibility: hidden;
    }

    .chat {
        visibility: visible;
        position: absolute;
        left: 0;
        top: 0;
        max-width: unset;
        max-height: unset;
        width: 100%;
        overflow-y: visible;
    }

    .message {
        break-inside: avoid;
    }

    .gradio-container {
        overflow: visible;
    }

    .tab-nav {
        display: none !important;
    }

    #chat-tab > :first-child {
        max-width: unset;
    }
}

#typing-container {
    display: none;
    position: absolute;
    background-color: transparent;
    left: 23px;
    top: -25px;
    padding: var(--block-padding);
}

.typing {
    position: relative;
}

.visible-dots #typing-container {
    display: block;
}

.typing span {
    content: '';
    animation: blink 1.5s infinite;
    animation-fill-mode: both;
    height: 10px;
    width: 10px;
    background: #3b5998;;
    position: absolute;
    left:0;
    top:0;
    border-radius: 50%;
}

.typing .dot1 {
    animation-delay: .2s;
    margin-left: calc(10px * 1.5);
}

.typing .dot2 {
    animation-delay: .4s;
    margin-left: calc(10px * 3);
}

@keyframes blink {
    0% {
        opacity: .1;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: .1;
    }
}

#chat-tab .generating {
    display: none !important;
}

.hover-element {
    position: relative;
    font-size: 24px;
}

.hover-menu {
    display: none;
    position: absolute;
    bottom: 80%;
    left: 0;
    box-shadow: 0 0 5px rgb(0 0 0 / 25%);
    z-index: 10000;
    min-width: 330px;
    flex-direction: column;
}

.hover-menu button {
    width: 100%;
    background: white !important;
    border-radius: 0 !important;
    justify-content: space-between;
    margin: 0 !important;
    height: 36px;
    border-color: transparent !important;
}

.hover-menu button:not(#clear-history-confirm) {
    border-bottom: 0 !important;
}

.hover-menu button:hover {
    background: #dbeafe !important;
}

.dark .hover-menu button:hover {
    background: var(--selected-item-color-dark) !important;
}

#show-controls {
    background-color: white;
    border-color: transparent !important;
    height: 36px;
    border-radius: 0;
    border-bottom: 0 !important;
    padding-top: 3px;
    padding-left: 4px;
    display: flex;
    font-weight: normal;
}

.dark #show-controls {
    background-color: var(--darker-gray);
}

#show-controls label {
    display: flex;
    flex-direction: row-reverse;
    justify-content: start;
    width: 100%;
    padding-right: 12px;
    gap: 10px;
    font-weight: 600;
    color: var(--button-secondary-text-color);
}

#show-controls label input {
    margin-top: 4px;
}

.transparent-substring {
    opacity: 0.333;
}

#chat-tab #chat-buttons {
    display: none !important;
}

#gr-hover-container {
    min-width: 0 !important;
    display: flex;
    flex-direction: column-reverse;
    padding-right: 20px;
    padding-bottom: 3px;
    flex-grow: 0 !important;
}

#generate-stop-container {
    min-width: 0 !important;
    display: flex;
    flex-direction: column-reverse;
    padding-bottom: 3px;
    flex: 0 auto !important;
}

#chat-input-container {
    display: flex;
    flex-direction: column;
    min-width: 0 !important;
}

#chat-input-container > .form {
    background: transparent;
    border: none;
}

#chat-input-row {
    padding: 1rem;
}

#chat-col {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    gap: 0;
}

@media screen and (width <= 924px) {
    #chat-col {
        margin-top: 32px;
        height: calc(100dvh - 32px);
    }
}

.message-body ol, .message-body ul {
    margin-top: 0 !important;
    margin-bottom: 1.25em !important;
}

/* ----------------------------------------------
  Past chats menus
---------------------------------------------- */
#rename-row label {
    margin-top: 0;
}

#rename-row > :nth-child(2) {
    justify-content: center;
}

/* ----------------------------------------------
  Create the sidebars
---------------------------------------------- */
#chat-controls,
#past-chats-row {
    width: 260px;
    max-width: 80vw;
    padding: 0.5rem;
    height: 100dvh;
    flex-shrink: 0;
    box-sizing: content-box;
    z-index: 10;
}

#past-chats-row:not(.negative-header) {
    max-width: calc(85vw - var(--header-width));
}

#chat-controls {
    padding: 1rem;
    padding-bottom: 0;
    overflow-y: scroll;
}

#chat-controls > :nth-child(1) {
    padding: 0.5rem;
}

#past-chats-row + * {
    width: unset;
    flex-grow: 1;
    flex-shrink: 1;
}

#search_chat {
    padding-right: 0.5rem;
}

#search_chat > :nth-child(2) > :first-child {
    display: none;
}

/* ----------------------------------------------
  Keep dropdown menus above errored components
---------------------------------------------- */
.options {
    z-index: 100 !important;
    border: 1px solid var(--input-border-color);
    border-radius: 0;
}

/* ----------------------------------------------
  Big profile picture for characters
---------------------------------------------- */
.bigProfilePicture {
    position: fixed;
    bottom: 0;
    left: 0;
    width: calc(0.5 * (100vw - min(100vw, 48rem) - (120px - var(--header-width))));
    z-index: 10000;
}

.pfp_character {
    position: relative;
}

.pfp_character:hover {
    cursor: pointer;
}

@media screen and (width <= 1300px) {
    .bigProfilePicture {
        display: none;
    }
}

#past-chats {
    max-height: calc(100dvh - 135px);
    overflow-y: scroll !important;
    border-radius: 0;
    scrollbar-width: auto;
}

#past-chats::-webkit-scrollbar {
    display: block;
}

#past-chats label {
    width: 100%;
    background-color: transparent !important;
    background: none;
    border: 0;
    border-radius: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    position: relative;
    min-height: 42px !important;
}

#past-chats label::before {
    content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 9h8"></path><path d="M8 13h6"></path><path d="M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z"></path></svg>');
    position: absolute;
    top: 12px;
    left: 12px;
    margin-right: 8px;
}

.dark #past-chats label::before {
    content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 9h8"></path><path d="M8 13h6"></path><path d="M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z"></path></svg>');
}

#past-chats label span {
    margin-left: 29px;
}

#past-chats > :nth-child(2) {
    display: none;
}

#past-chats > :nth-child(3) {
    gap: 0.25rem;
}

#past-chats input {
    display: none;
}

#past-chats label {
    padding: 0.75rem;
    font-size: 12.5px;
    font-weight: 400;
}

#past-chats .selected,
#past-chats label:hover {
    border-radius: 0.5rem;
}

#past-chats label:hover {
    cursor: pointer;
}

#past-chats .selected,
#past-chats label:hover {
    background-color: #dbeafe !important;
}

#past-chats-buttons,
#delete-chat-row,
#rename-row {
    width: 100%;
    justify-content: center;
    gap: 9px;
    padding-right: 0.5rem;
}

#past-chats-row,
#chat-controls {
    width: 260px;
    padding: 0.5rem;
    padding-right: 0;
    height: calc(100dvh - 16px);
    flex-shrink: 0;
    box-sizing: content-box;
}

.sidebar-hidden {
    width: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

#past-chats-toggle,
#chat-controls-toggle,
#navigation-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    border-radius: 3px;
    z-index: 1000;
    position: fixed;
    width: 2rem;
    height: 2rem;
    top: 0;
}

#past-chats-toggle svg,
#chat-controls-toggle svg,
#navigation-toggle svg {
    pointer-events: none;
}

@media screen and (width <= 408px) {
    #past-chats-toggle.past-chats-open {
        top: 28px;
    }

    #chat-controls-toggle.chat-controls-open {
        top: 28px;
        right: calc(16px + min(260px, 80vw)) !important;
    }
}

#past-chats-toggle.past-chats-open.negative-header {
    left: calc(min(260px, 85vw) + 16px);
}

#past-chats-toggle.past-chats-open:not(.negative-header) {
    left: calc(112px + min(260px, calc(85vw - var(--header-width))) + 16px);
}

#past-chats-toggle.past-chats-closed:not(.negative-header) {
    left: 112px;
}

#past-chats-toggle.past-chats-closed.negative-header {
    left: 0;
    top: 28px;
}

@media screen and (width <= 924px) {
    #past-chats-toggle.past-chats-closed.negative-header {
        left: 28px;
        top: 0;
    }
}

.header_bar ~ * {
    margin-left: var(--header-width);
}

/* Positions for chat-controls-toggle */
#chat-controls-toggle.chat-controls-open {
    right: calc(min(260px, 80vw) + 23px);
}

#chat-controls-toggle.chat-controls-closed {
    right: 7px;
}

@media screen and (width <= 924px) {
    #chat-controls.sidebar-shown {
        position: fixed;
        right: 0;
    }

    #past-chats-row.sidebar-shown {
        position: fixed;
    }
}

/* ----------------------------------------------
  Dark theme
---------------------------------------------- */
.dark .header_bar {
    background-color: var(--darker-gray) !important;
}

.dark .header_bar button.selected {
    background: var(--selected-item-color-dark);
}

.dark #chat-input textarea {
    background: var(--light-gray);
    color: white !important;
    border-color: #292c3b;
}

.dark #chat-input textarea::placeholder {
    color: #9ca3af;
}

.dark .hover-menu button {
    border-color: var(--border-color-primary);
    background-color: var(--darker-gray) !important;
}

.dark #chat-controls,
.dark #past-chats-row {
    background-color: var(--darker-gray);
    border: 0 !important;
}

.dark gradio-app .gradio-container.gradio-container-4-37-2 .contain #past-chats .selected,
.dark gradio-app .gradio-container.gradio-container-4-37-2 .contain #past-chats label:hover {
    background-color: var(--selected-item-color-dark) !important;
}

.dark #past-chats-row,
.dark #chat-controls {
    background-color: var(--darker-gray);
}

.dark #past-chats-toggle,
.dark #chat-controls-toggle,
.dark #navigation-toggle {
    color: white;
}

.dark svg {
    color: white;
}

@media screen and (width <= 408px) {
    .dark #past-chats-toggle.past-chats-open {
        background: var(--darker-gray);
    }

    .dark #chat-controls-toggle.chat-controls-open {
        background: var(--darker-gray);
    }
}

/* ----------------------------------------------
  Light theme
---------------------------------------------- */
.header_bar {
    background-color: var(--light-theme-gray) !important;
}

.header_bar button.selected {
    background: #dbeafe;
}

#chat-controls,
#past-chats-row {
    background-color: var(--light-theme-gray);
}

.dark #chat-controls {
    border-left: 1px solid #d9d9d0;
}

.dark #past-chats-row {
    border-right: 1px solid #d9d9d0;
}

#past-chats-toggle,
#chat-controls-toggle,
#navigation-toggle {
    color: gray !important;
}

.mobile-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 32px;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

@media screen and (width <= 924px) {
    .mobile-top-bar {
        opacity: 1;
        pointer-events: auto;
    }

    .dark .mobile-top-bar {
        background-color: var(--darker-gray);
    }

    .mobile-top-bar {
        background-color: var(--light-theme-gray);
    }
}

@media screen and (width <= 408px) {
    #past-chats-toggle.past-chats-open {
        background: var(--light-theme-gray);
    }

    #chat-controls-toggle.chat-controls-open {
        background: var(--light-theme-gray);
    }
}

/* ----------------------------------------------
  Copy button for chat messages
---------------------------------------------- */
.message .text,
.message .text-you,
.message .text-bot,
.user-message .text,
.assistant-message .text {
    position: relative;
}

.message, .user-message, .assistant-message {
    position: relative;
}

/* New container for the buttons */
.message-actions {
    position: absolute;
    bottom: -23px;
    left: 0;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.footer-button {
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message:hover .message-actions,
.user-message:hover .message-actions,
.assistant-message:hover .message-actions {
    opacity: 1;
}

/* Disable message actions and version navigation hover effects during generation */
._generating :is(.message, .user-message, .assistant-message):hover :is(.message-actions, .version-navigation) {
    opacity: 0 !important;
    pointer-events: none;
}

/* Disable message actions and version navigation hover effects during scrolling */
.scrolling :is(.message, .user-message, .assistant-message):hover :is(.message-actions, .version-navigation) {
    opacity: 0 !important;
    pointer-events: none;
}

.footer-button svg {
    stroke: rgb(156 163 175);
    transition: stroke 0.2s;
}

.footer-button:hover svg {
    stroke: rgb(107 114 128);
}

.dark .footer-button svg {
    stroke: rgb(156 163 175);
}

.dark .footer-button:hover svg {
    stroke: rgb(209 213 219);
}

.tgw-accordion {
    padding: 10px 12px !important;
}

.dark .tgw-accordion {
    border: 1px solid var(--border-color-dark);
}

.welcome-greeting {
    text-align: center;
    margin-top: 40vh;
    font-size: 24px;
    opacity: 0.7;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Thinking blocks styling */
.thinking-block {
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid rgb(0 0 0 / 10%);
    background-color: var(--light-theme-gray);
    overflow: hidden;
}

.thinking-content:focus, .thinking-header:focus {
    outline: 0 !important;
}

.dark .thinking-block {
    background-color: transparent;
    border: 1px solid var(--input-border-color);
}

.thinking-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    line-height: var(--line-sm);
    color: rgb(0 0 0 / 70%);
    transition: background-color 0.2s;
}

.thinking-header:hover {
    background-color: rgb(0 0 0 / 3%);
}

.thinking-header::-webkit-details-marker {
    display: none;
}

.thinking-icon {
    margin-right: 8px;
    color: rgb(0 0 0 / 50%);
}

.thinking-title {
    font-weight: 500;
}

.thinking-content {
    padding: 12px 16px;
    border-top: 1px solid rgb(0 0 0 / 7%);
    color: rgb(0 0 0 / 70%);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: break-word;
    max-height: 250px;
    overflow-y: scroll;
    contain: layout;
}

.chat .message-body .thinking-content p,
.chat .message-body .thinking-content li {
    font-size: 15px !important;
}

/* Animation for opening thinking blocks */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.thinking-block[open] .thinking-content {
    animation: fadeIn 0.3s ease-out;
}

/* Additional style for in-progress thinking */
.thinking-block[data-streaming="true"] .thinking-title {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

strong {
    font-weight: bold;
}

.min.svelte-1ybaih5 {
    min-height: 0;
}

#vram-info .value {
    color: #008d00;
}

.dark #vram-info .value {
    color: #07ff07;
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding-bottom: 6px;
}

.attachment-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: rgb(0 0 0 / 5%);
    border-radius: 6px;
    border: 1px solid rgb(0 0 0 / 10%);
    min-width: 80px;
    max-width: 120px;
}

.attachment-icon {
    margin-bottom: 4px;
    color: #555;
}

.attachment-name {
    font-size: 0.8em;
    text-align: center;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dark .attachment-box {
    background: rgb(255 255 255 / 5%);
    border: 1px solid rgb(255 255 255 / 10%);
}

.dark .attachment-icon {
    color: #ccc;
}

/* Message Editing Styles */
.editing-textarea {
    width: 100%;
    min-height: 200px;
    max-height: 65vh;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: var(--light-theme-gray);
    font-family: inherit;
    font-size: inherit;
    resize: vertical;
}

.dark .editing-textarea {
    border: 1px solid var(--border-color-dark);
    background-color: var(--darker-gray);
}

.editing-textarea:focus {
    outline: none;
    border-color: var(--selected-item-color-dark);
}

.edit-controls-container {
    margin-top: 0;
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
}

.edit-control-button {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f8f9fa;
    color: #212529;
    font-size: 12px;
    margin: 0;
}

.dark .edit-control-button {
    border: 1px solid var(--border-color-dark);
    background-color: var(--light-gray);
    color: #efefef;
}

/* --- Simple Version Navigation --- */
.version-navigation {
    position: absolute;
    bottom: -23px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .version-navigation,
.user-message:hover .version-navigation,
.assistant-message:hover .version-navigation {
    opacity: 1;
}

.version-nav-button {
    padding: 2px 6px;
    font-size: 12px;
    min-width: auto;
}

.version-nav-button[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

.version-position {
    font-size: 11px;
    color: currentcolor;
    font-family: monospace;
    min-width: 35px;
    text-align: center;
    opacity: 0.8;
    user-select: none;
}

.token-display {
    font-family: monospace;
    font-size: 13px;
    color: var(--body-text-color-subdued);
    margin-top: 4px;
}

.image-attachment {
    flex-direction: column;
    max-width: 314px;
}

.image-preview {
    border-radius: 16px;
    margin-bottom: 5px;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--border-color-primary);
    aspect-ratio: 1 / 1;
}

button:focus {
    outline: none;
}

/* Fix extra gaps for hidden elements on the right sidebar */
.svelte-sa48pu.stretch:has(> .hidden:only-child) {
    display: none;
}

.delete-container {
    position: absolute;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: 0;
}

.chat-label-with-delete {
    position: relative;
    padding-right: 60px;
}

.trash-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 2px;
    opacity: 0.7;
}

.cancel-btn {
    border: none;
    background: #ef4444;
    color: white;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 2px;
    font-family: monospace;
    font-size: 12px;
    align-items: center;
    justify-content: center;
    display: none;
}

.confirm-btn {
    border: none;
    background: #22c55e;
    color: white;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 2px;
    font-family: monospace;
    font-size: 12px;
    align-items: center;
    justify-content: center;
    display: none;
}

#character-context textarea {
    height: calc((100vh - 350px) * 2/3) !important;
    min-height: 90px !important;
}

#character-greeting textarea {
    height: calc((100vh - 350px) * 1/3) !important;
    min-height: 90px !important;
}

#user-description textarea {
    height: calc(100vh - 231px) !important;
    min-height: 90px !important;
}

#instruction-template-str textarea,
#chat-template-str textarea {
    height: calc(100vh - 300px) !important;
    min-height: 90px !important;
}

#textbox-notebook span {
    display: none;
}

.chat-parent {
    /* Optimize for scrolling performance */
    will-change: scroll-position;
    contain: layout style paint;

    /* Ensure GPU acceleration */
    transform: translateZ(0);

    /* Prevent layout shifts */
    overflow-anchor: none;
}

#chat-input span {
    display: none;
}

.sidebar-vertical-separator {
    margin: 0;
    border-bottom: var(--input-border-width) solid var(--input-border-color);
}

.dark .sidebar-vertical-separator {
    border-bottom: 1px solid rgb(255 255 255 / 10%);
}

button#swap-height-width {
    position: absolute;
    top: -50px;
    right: 0;
    border: 0;
}

#image-output-gallery, #image-output-gallery > :nth-child(2) {
    height: calc(100vh - 83px);
    max-height: calc(100vh - 83px);
}

#image-history-gallery, #image-history-gallery > :nth-child(2) {
    height: calc(100vh - 174px);
    max-height: calc(100vh - 174px);
}

/* Additional CSS for the paginated image gallery */

/* Page info styling */
#image-page-info {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    font-size: 0.9em;
    color: var(--body-text-color-subdued);
}

/* Settings display panel */
#image-ai-tab .settings-display-panel {
    background: var(--background-fill-secondary);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9em;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

/* Gallery status message */
#image-ai-tab .gallery-status {
    color: var(--color-accent);
    font-size: 0.85em;
    margin-top: 4px;
}

/* Pagination button row alignment */
#image-ai-tab .pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Selected image preview container */
#image-ai-tab .selected-preview-container {
    border: 1px solid var(--border-color-primary);
    border-radius: 8px;
    padding: 8px;
    background: var(--background-fill-secondary);
}

/* Fix a gr.Markdown UI glitch when clicking Next in the
 * Image AI > Gallery tab */
.min.svelte-1yrv54 {
    min-height: 0;
}

/* Image Generation Progress Bar */
#image-progress .image-ai-separator {
    height: 24px;
    margin: 20px 0;
    border-top: 1px solid var(--input-border-color);
}

#image-progress .image-ai-progress-wrapper {
    height: 24px;
    margin: 20px 0;
}

#image-progress .image-ai-progress-track {
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    height: 8px;
}

.dark #image-progress .image-ai-progress-track {
    background: #333;
}

#image-progress .image-ai-progress-fill {
    background: #4a9eff;
    height: 100%;
}

#image-progress .image-ai-progress-text {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.dark #image-progress .image-ai-progress-text {
    color: #888;
}

#llm-prompt-variations {
    position: absolute;
    top: 0;
    left: calc(100% - 174px);
}

table {
    border-collapse: collapse;
}

table, tr, td, th, thead {
    border: 0;
}

td + td,
th + th { border-left: 1px solid; }

tr + tr td,
tr + tr th { border-top: 1px solid; }

thead + tbody tr:first-child td,
thead + tbody tr:first-child th { border-top: 1px solid; }
