/* Shared chat styles: message bubbles + Markdown in AI replies.
   Used by the /chat page and the site-wide chat bubble (chat/widget.js). */

.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 1rem;
}

.message.user {
    align-self: flex-end;
    background: #00eaff;
    color: #000;
    border-bottom-right-radius: 2px;
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-bottom-left-radius: 2px;
}

/* Markdown inside AI replies */
.message.markdown > :first-child { margin-top: 0; }
.message.markdown > :last-child { margin-bottom: 0; }
.message.markdown p,
.message.markdown ul,
.message.markdown ol,
.message.markdown pre,
.message.markdown blockquote,
.message.markdown table { margin: 0.6rem 0; }
/* Don't inherit the site-wide larger, grey <p> style */
.message.markdown p { font-size: inherit; line-height: inherit; color: inherit; }
.message.markdown ul,
.message.markdown ol { padding-left: 1.4rem; }
.message.markdown li + li { margin-top: 0.2rem; }
.message.markdown h1,
.message.markdown h2,
.message.markdown h3,
.message.markdown h4 { font-size: 1.05rem; margin: 0.9rem 0 0.4rem; }
.message.markdown a { color: #00eaff; text-decoration: underline; }
.message.markdown code {
    font-family: monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.message.markdown pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    overflow-x: auto;
}
.message.markdown pre code { background: none; padding: 0; }
.message.markdown blockquote {
    border-left: 3px solid rgba(0, 234, 255, 0.5);
    padding-left: 0.8rem;
    color: #ccc;
}
.message.markdown table { border-collapse: collapse; display: block; overflow-x: auto; }
.message.markdown th,
.message.markdown td { border: 1px solid rgba(255, 255, 255, 0.15); padding: 0.3rem 0.6rem; }

.loading-dots::after {
    content: ' .';
    animation: dots 1s steps(5, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: ' .';
    }

    40% {
        content: ' ..';
    }

    60% {
        content: ' ...';
    }

    90%,
    100% {
        content: '';
    }
}
