/* The assistant window of multi-user mode (static/js/assistant.js). */

#lute-assistant-open {
    position: fixed;
    right: calc(1rem + var(--la-right, 0px));
    bottom: calc(1rem + var(--la-bottom, 0px) + var(--la-lift, 0px));
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#lute-assistant-open img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* The window covers the button. */
#lute-assistant-open.la-shown,
#lute-assistant-open.la-covered {
    visibility: hidden;
}

/* Reading: the corner belongs to the dictionaries.  Below Lute's menu. */
#lute-assistant-open.la-reading {
    z-index: 1003;
    width: 2.4rem;
    height: 2.4rem;
    opacity: 0.65;
}

#lute-assistant-open.la-reading:hover,
#lute-assistant-open.la-reading:focus-visible,
#lute-assistant-open.la-reading[data-mood="listening"] {
    opacity: 1;
}

#lute-assistant {
    position: fixed;
    right: calc(1rem + var(--la-right, 0px));
    bottom: calc(1rem + var(--la-bottom, 0px));
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-sizing: border-box;
    width: 26rem;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    padding: 0.75rem;
    overflow: hidden;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.4;
    background: var(--background-color, #fff);
    color: var(--font-color, #000);
    border: 1px solid #8a9bb0;
    border-radius: 0.6rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

#lute-assistant [hidden] {
    display: none;
}

#lute-assistant[hidden] {
    display: none;
}

/* Buttons of the window, whatever the page's own buttons look like. */
#lute-assistant button {
    width: auto;
    margin: 0;
    padding: 0.3rem 0.7rem;
    font: inherit;
    cursor: pointer;
    color: inherit;
    background: transparent;
    border: 1px solid #8a9bb0;
    border-radius: 0.35rem;
}

#lute-assistant button:disabled {
    cursor: default;
    opacity: 0.6;
}

/* The window is moved by dragging its top. */
#lute-assistant .la-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: move;
    user-select: none;
    touch-action: none;
}

#lute-assistant.la-narrow .la-top {
    cursor: default;
    touch-action: auto;
}

/* The picture of the button, which the window covers. */
#lute-assistant .la-top .la-avatar img {
    display: block;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    /* The picture is white around, also on the dark themes. */
    background: #fff;
}

#lute-assistant .la-top strong {
    flex: 1;
}

#lute-assistant .la-top .la-close {
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 0.3rem;
}

#lute-assistant .la-log {
    flex: 1 1 auto;
    min-height: 6rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#lute-assistant .la-message {
    margin: 0 0 0.6rem;
    overflow-wrap: anywhere;
}

#lute-assistant .la-user {
    margin-left: 2.5rem;
    padding: 0.4rem 0.6rem;
    white-space: pre-wrap;
    border-radius: 0.5rem;
    background: rgba(61, 127, 192, 0.18);
}

#lute-assistant .la-assistant p,
#lute-assistant .la-assistant ul,
#lute-assistant .la-assistant ol {
    margin: 0.35rem 0;
}

#lute-assistant .la-assistant ul,
#lute-assistant .la-assistant ol {
    padding-left: 1.4rem;
}

#lute-assistant .la-assistant h1,
#lute-assistant .la-assistant h2,
#lute-assistant .la-assistant h3 {
    margin: 0.6rem 0 0.3rem;
    font-size: 1rem;
    text-align: left;
}

#lute-assistant .la-assistant pre {
    overflow-x: auto;
}

#lute-assistant .la-assistant table {
    border-collapse: collapse;
}

#lute-assistant .la-assistant th,
#lute-assistant .la-assistant td {
    padding: 0.15rem 0.5rem 0.15rem 0;
    text-align: left;
    vertical-align: top;
}

#lute-assistant .la-note {
    font-style: italic;
    opacity: 0.75;
}

#lute-assistant .la-error {
    color: #c0392b;
    opacity: 1;
}

#lute-assistant form {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    margin: 0;
}

#lute-assistant textarea {
    flex: 1;
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0.4rem;
    resize: vertical;
    font: inherit;
    color: inherit;
    background: transparent;
    /* Stronger than the borders Lute gives to its fields. */
    border: 1px solid #8a9bb0 !important;
    border-radius: 0.35rem;
}

#lute-assistant textarea::placeholder {
    color: inherit;
    opacity: 0.55;
}

#lute-assistant .la-typical {
    flex: 0 1 auto;
    min-height: 1.8rem;
    overflow-y: auto;
}

#lute-assistant .la-typical .la-toggle {
    border: none;
    padding: 0.2rem 0;
    font-weight: bold;
    opacity: 1;
}

#lute-assistant .la-typical ul {
    margin: 0.3rem 0;
    padding: 0;
    list-style: none;
}

#lute-assistant .la-typical li {
    margin: 0.3rem 0;
}

#lute-assistant .la-typical li button {
    width: 100%;
    text-align: left;
}

#lute-assistant .la-typical li button:hover:enabled {
    background: rgba(61, 127, 192, 0.18);
}

/* On a phone: all of what is seen. */
#lute-assistant.la-narrow {
    left: var(--la-left, 0px);
    top: var(--la-top, 0px);
    right: auto;
    bottom: auto;
    width: var(--la-width, 100vw);
    height: var(--la-height, 100vh);
    max-height: none;
    border: none;
    border-radius: 0;
}

@media print {
    #lute-assistant,
    #lute-assistant-open {
        display: none;
    }
}
