/*
 * Support chat widget.
 *
 * Scoped to the widget so it cannot leak into page styles. The old version kept
 * a <style> block inside the markup and had no display:none on the container,
 * so the panel rendered inline on load until JavaScript ran.
 */

#chat-panel {
    /* Belt and braces: the `hidden` utility class also applies display:none. */
    animation: chat-panel-in 140ms ease-out;
}

#chat-panel.hidden {
    display: none !important;
}

@keyframes chat-panel-in {
    from { opacity: 0; transform: translateY(6px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Slim scrollbar inside the transcript and composer */
#chat-messages.chat-scroll,
#chat-input.chat-scroll {
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

#chat-messages::-webkit-scrollbar,
#chat-input::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track,
#chat-input::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb,
#chat-input::-webkit-scrollbar-thumb {
    background-color: #334155;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover,
#chat-input::-webkit-scrollbar-thumb:hover {
    background-color: #475569;
}

/*
 * Composer.
 *
 * The textarea is a flex sibling inside `flex items-end`. Previously the JS
 * set height to `scrollHeight`, but with `rows="1"` plus a min-height the
 * measurement was taken while the element was still collapsed, so the value
 * came back larger than one line and the box jumped on every keystroke.
 *
 * Fixed by measuring off an explicit line-height and box-sizing the borders,
 * and by never letting the JS write a height smaller than one line.
 */
#chat-input {
    box-sizing: border-box;
    min-height: 2.5rem;
    max-height: 7.5rem;   /* ~5 lines, then it scrolls */
    height: 2.5rem;
    line-height: 1.375rem;
    padding-top: 0.5625rem;
    padding-bottom: 0.5625rem;
    overflow-y: auto;
    /* Prevent the browser from adding its own resize grip. */
    resize: none;
}

/* Respect reduced-motion: no panel animation, no pulsing dot */
@media (prefers-reduced-motion: reduce) {
    #chat-panel {
        animation: none;
    }
}
