/* localMonkeys additions to the Aizox theme (assets/aizox/css/styles.css). */

/* ---------- Theme controls used as <button> elements ---------- */

button.button-show-hide,
button.header-item,
button.sidebar-btn-close,
.list-icon-function button.item-icon {
    padding: 0;
    color: var(--OnSurface);
    font: inherit;
}

.list-icon-function button.item-icon {
    border: 0;
    background: none;
    color: var(--Secondary);
}

.list-icon-function button.item-icon:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

button.tf-btn-3 {
    background: transparent;
    color: var(--OnSurface);
    font: inherit;
}

.tf-btn-3.is-active {
    border-color: var(--Primary);
}

.tf-btn-3.is-active .icon {
    color: var(--Primary);
}

:focus-visible {
    outline: 2px solid var(--Primary);
    outline-offset: 2px;
}

/* ---------- Left menu ---------- */

/* Image logo (chat.ini "logo"): fixed height, never stretched or cropped. */
#logo_header {
    width: auto;
    height: 32px;
    max-width: 200px;
    object-fit: contain;
}

.logo-text {
    color: var(--OnSurface);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-menu-left .menu-item a .text {
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: none;
}

/* ---------- Chat heading ---------- */

.chat-bot-wrap .heading {
    flex-wrap: nowrap;
}

.chat-title {
    min-width: 0;
}

.chat-title h4,
.chat-title div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Messages ---------- */

.chat-bot-wrap .bubble-me .content {
    max-width: min(640px, 80%);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-bot-wrap .bubble-you .bubble-rep {
    min-width: 0;
}

.reply {
    display: grid;
    gap: 16px;
    overflow-wrap: anywhere;
}

.reply:empty {
    display: none;
}

.reply-text {
    white-space: pre-wrap;
}

.reply-text code {
    padding: 1px 6px;
    border-radius: 6px;
    background-color: var(--Line);
    font-size: 0.9em;
}

.reply-text strong {
    font-weight: 700;
}

/* Blinking cursor while a reply streams in */
.bubble-you.is-pending .reply > :last-child::after,
.bubble-you.is-pending .reply:empty + .reply-actions::before {
    content: "▍";
    color: var(--Primary);
    animation: lm-blink 1s steps(1) infinite;
}

.bubble-you.is-pending .reply-actions .tf-btn-3 {
    display: none;
}

.reply-actions {
    margin-top: 12px;
}

.code-wrapper pre {
    padding: 16px 20px;
    overflow-x: auto;
    /* The theme's code background matches the dark reply bubble; the border keeps it visible. */
    border: 1px solid var(--Line);
}

.code-wrapper code {
    white-space: pre;
}

@keyframes lm-blink {
    50% { opacity: 0; }
}

/* ---------- Empty chat ---------- */

.chat-intro {
    display: grid;
    justify-items: center;
    gap: 8px;
    max-width: 520px;
    margin: auto;
    text-align: center;
}

.chat-intro .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border-radius: 50%;
    background-color: var(--DarkSurface);
    color: var(--Primary);
    font-size: 32px;
}

/* ---------- Message box ---------- */

.form-chat .chat-input-wrap {
    position: relative;
}

.form-chat .chat-input-wrap .btn-message {
    right: 12px;
    padding: 0;
}

.form-chat .stop-icon,
.form-chat.is-busy .send-icon {
    display: none;
}

.form-chat.is-busy .stop-icon {
    display: inline;
}

.chat-status {
    min-height: 24px;
    margin: 8px 24px 0;
    font-size: 14px;
    line-height: 24px;
}

.chat-status.is-error {
    color: var(--Error) !important;
}

/* ---------- History ---------- */

#history-empty[hidden] {
    display: none;
}

.chat-history-item .title {
    flex-grow: 1;
    min-width: 0;
}

.chat-history-item:focus-within .list-icon-function .item-icon {
    display: flex;
}

/* ---------- Error page ---------- */

.error-page {
    display: grid;
    justify-items: start;
    gap: 16px;
    max-width: 560px;
    margin: 20vh auto 0;
    padding: 0 16px;
}

@media (max-width: 767px) {
    .chat-status {
        margin: 6px 12px 0;
    }

    .chat-bot-wrap .heading h4 {
        font-size: 22px;
        line-height: 30px;
    }
}
