/* =========================================
   LUMA CHAT UI
   ========================================= */

:root {
    --luma-chat-width: 960px;

    --luma-code-bg: #101116;

    --luma-code-toolbar: #181920;

    --luma-code-border:
        rgba(255, 255, 255, 0.08);

    --luma-code-text: #ececf3;

    --luma-code-muted: #9293a5;
}


/* =========================================
   CHAT WIDTH
   ========================================= */

.chat {
    padding-left:
        max(
            34px,
            calc(
                (
                    100%
                    - var(--luma-chat-width)
                )
                / 2
            )
        );

    padding-right:
        max(
            34px,
            calc(
                (
                    100%
                    - var(--luma-chat-width)
                )
                / 2
            )
        );
}


.composer,
.note {
    max-width:
        var(--luma-chat-width);
}


/* =========================================
   ASSISTANT MESSAGE
   ========================================= */

.message-row.assistant {
    flex-direction: column;

    align-items: flex-start;
}


.message-row.assistant
.message {
    width: 100%;

    max-width: 100%;

    font-size: 15.5px;

    line-height: 1.72;
}


.message-row.user
.message {
    font-size: 14.5px;

    line-height: 1.55;
}


.assistant-response-meta {
    margin-bottom: 8px;

    font-size: 10.5px;
}


.assistant-stream-text {
    width: 100%;
}


/* =========================================
   MARKDOWN BASE
   ========================================= */

.luma-markdown-host {
    white-space:
        normal
        !important;
}


.luma-markdown-host
> :first-child {
    margin-top:
        0
        !important;
}


.luma-markdown-host
> :last-child {
    margin-bottom:
        0
        !important;
}


.luma-md-paragraph {
    margin:
        0
        0
        13px;
}


.luma-markdown-host strong {
    font-weight: 750;
}


.luma-markdown-host em {
    font-style: italic;
}


.luma-markdown-host del {
    opacity: 0.7;
}


/* =========================================
   HEADINGS
   ========================================= */

.luma-md-heading {
    margin:
        25px
        0
        10px;

    color:
        var(--text);

    line-height: 1.25;

    letter-spacing:
        -0.025em;
}


.luma-md-h1 {
    font-size: 24px;
}


.luma-md-h2 {
    font-size: 20px;
}


.luma-md-h3 {
    font-size: 17px;
}


.luma-md-h4 {
    font-size: 15px;
}


/* =========================================
   LISTS
   ========================================= */

.luma-md-list {
    margin:
        8px
        0
        15px;

    padding-left: 24px;
}


.luma-md-list li {
    margin:
        5px
        0;

    padding-left: 3px;
}


.luma-md-list li::marker {
    color:
        var(--muted);
}


/* =========================================
   INLINE CODE
   ========================================= */

.luma-inline-code {
    padding:
        2px
        5px;

    border:
        1px solid
        rgba(
            117,
            101,
            255,
            0.13
        );

    border-radius: 6px;

    background:
        var(--accent-soft);

    color:
        var(--accent);

    font-family:
        "SFMono-Regular",
        "SF Mono",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;

    font-size: 0.88em;
}


/* =========================================
   CODE BLOCK
   ========================================= */

.luma-code-block {
    width: 100%;

    margin:
        14px
        0
        18px;

    overflow: hidden;

    border:
        1px solid
        var(--luma-code-border);

    border-radius: 14px;

    background:
        var(--luma-code-bg);

    box-shadow:
        0 10px 30px
        rgba(
            0,
            0,
            0,
            0.12
        );
}


/* =========================================
   CODE TOOLBAR
   ========================================= */

.luma-code-toolbar {
    min-height: 41px;

    display: flex;

    align-items: center;

    justify-content:
        space-between;

    gap: 14px;

    padding:
        0
        11px
        0
        15px;

    border-bottom:
        1px solid
        var(--luma-code-border);

    background:
        var(--luma-code-toolbar);
}


.luma-code-language {
    color:
        var(--luma-code-muted);

    font-size: 10px;

    font-weight: 700;

    letter-spacing:
        0.3px;

    text-transform:
        lowercase;
}


/* =========================================
   COPY CODE
   ========================================= */

.luma-code-copy {
    appearance: none;

    -webkit-appearance: none;

    min-height: 29px;

    display: flex;

    align-items: center;

    gap: 6px;

    padding:
        0 8px;

    border: none;

    border-radius: 7px;

    background:
        transparent;

    color:
        var(--luma-code-muted);

    font-size: 10px;

    font-weight: 650;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}


.luma-code-copy:hover {
    background:
        rgba(
            255,
            255,
            255,
            0.07
        );

    color: #ffffff;
}


.luma-code-copy.success {
    color:
        #b9f4ce;
}


/* =========================================
   CODE
   ========================================= */

.luma-code-block pre {
    margin: 0;

    overflow-x: auto;

    padding:
        18px
        19px
        20px;

    background:
        var(--luma-code-bg);
}


.luma-code-block pre code {
    display: block;

    min-width:
        max-content;

    color:
        var(--luma-code-text);

    font-family:
        "SFMono-Regular",
        "SF Mono",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;

    font-size: 13px;

    font-weight: 450;

    line-height: 1.68;

    tab-size: 4;

    white-space: pre;
}


.luma-code-block
pre::-webkit-scrollbar {
    height: 7px;
}


.luma-code-block
pre::-webkit-scrollbar-thumb {
    border-radius: 20px;

    background:
        rgba(
            255,
            255,
            255,
            0.14
        );
}


/* =========================================
   QUOTE
   ========================================= */

.luma-md-quote {
    margin:
        12px
        0
        15px;

    padding:
        10px
        14px;

    border-left:
        3px solid
        var(--accent);

    border-radius:
        0
        9px
        9px
        0;

    background:
        var(--accent-soft);

    color:
        var(--muted);
}


/* =========================================
   RULE
   ========================================= */

.luma-md-rule {
    height: 1px;

    margin:
        20px
        0;

    border: none;

    background:
        var(--border);
}


/* =========================================
   MESSAGE ACTION BAR
   ========================================= */

.luma-message-actions {
    min-height: 31px;

    display: flex;

    align-items: center;

    gap: 2px;

    margin-top: 4px;

    margin-left: -5px;

    opacity: 0.68;

    transition:
        opacity 0.15s ease;
}


.message-row.assistant:hover
.luma-message-actions {
    opacity: 1;
}


/* =========================================
   MESSAGE ACTION BUTTON
   ========================================= */

.luma-message-action {
    appearance: none;

    -webkit-appearance: none;

    width: 31px;

    height: 31px;

    min-width: 31px;

    min-height: 31px;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 0;

    margin: 0;

    border: none;

    outline: none;

    border-radius: 8px;

    background:
        transparent;

    color:
        var(--muted);

    font-family: inherit;

    cursor: pointer;

    box-shadow: none;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}


.luma-message-action:hover {
    background:
        var(--surface-hover);

    color:
        var(--text);
}


.luma-message-action:active {
    transform:
        scale(0.91);
}


.luma-message-action.success {
    color:
        var(--success);
}


/* =========================================
   ACTION SVG
   ========================================= */

.luma-message-action svg {
    width: 18px;

    height: 18px;

    display: block;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 1.75;

    stroke-linecap: round;

    stroke-linejoin: round;
}


/* =========================================
   TRAINING BUTTONS
   ========================================= */

.luma-training-action {
    background:
        transparent
        !important;

    border:
        none
        !important;

    box-shadow:
        none
        !important;
}


.luma-training-action.selected {
    background:
        var(--accent-soft)
        !important;

    color:
        var(--accent)
        !important;
}


.luma-training-action.saving {
    opacity: 0.45;

    pointer-events: none;
}


.luma-training-action.saved {
    transform:
        scale(1.12);
}


/* =========================================
   TOOLTIP
   ========================================= */

.luma-message-action {
    position: relative;
}


.luma-message-action::after {
    content:
        attr(title);

    position: absolute;

    left: 50%;

    bottom:
        calc(100% + 7px);

    z-index: 50;

    padding:
        5px
        7px;

    border:
        1px solid
        var(--border);

    border-radius: 7px;

    background:
        var(--surface);

    color:
        var(--text);

    box-shadow:
        var(--shadow-small);

    font-size: 9px;

    font-weight: 600;

    white-space: nowrap;

    pointer-events: none;

    opacity: 0;

    transform:
        translate(
            -50%,
            4px
        );

    transition:
        opacity 0.12s ease,
        transform 0.12s ease;
}


.luma-message-action:hover::after {
    opacity: 1;

    transform:
        translate(
            -50%,
            0
        );
}


/* =========================================
   SMALL ICON INSIDE CODE COPY
   ========================================= */

.luma-action-icon {
    font-size: 13px;

    line-height: 1;
}


/* =========================================
   STREAMING CURSOR
   ========================================= */

.assistant-stream-text.streaming::after {
    margin-left: 4px;
}


/* =========================================
   MOBILE
   ========================================= */

@media (
    max-width: 650px
) {

    :root {
        --luma-chat-width:
            100%;
    }


    .chat {
        padding-left: 17px;

        padding-right: 17px;
    }


    .message-row.assistant
    .message {
        font-size: 15px;
    }


    .luma-code-block {
        border-radius: 12px;
    }


    .luma-code-block pre {
        padding:
            14px
            14px
            16px;
    }


    .luma-code-block
    pre code {
        font-size: 12px;
    }


    .luma-message-actions {
        opacity: 1;
    }
}


/* =========================================
   REDUCED MOTION
   ========================================= */

@media (
    prefers-reduced-motion: reduce
) {

    .luma-code-copy,
    .luma-message-action,
    .luma-message-actions {

        transition: none;
    }
}