/* Radio mini-chat -- replies, two-column messages, stable author colors. */

/* Room for roughly five ordinary messages without making the chat cramped. */
#radio-chat-messages {
    height: 490px;
    min-height: 490px;
    max-height: none;
    overflow-y: auto;
}

/* The message and its author occupy two independent columns. */
#radio-chat-messages .radio-chat-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(130px, 165px);
    align-items: start;
    column-gap: 18px;
    min-height: 84px;
    padding: 12px 14px;
}

#radio-chat-messages .radio-chat-item-content {
    min-width: 0;
}

#radio-chat-messages .radio-chat-item-header {
    display: block;
    margin: 0 0 8px;
}

#radio-chat-messages .radio-chat-meta {
    display: flex;
    align-items: baseline;
    min-width: 0;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
}

#radio-chat-messages .radio-chat-date {
    white-space: nowrap;
}

#radio-chat-messages .radio-chat-context-wrapper {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#radio-chat-messages .radio-chat-context {
    display: inline;
}

#radio-chat-messages .radio-chat-message {
    margin: 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#radio-chat-messages .radio-chat-item-author {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, .13);
}

#radio-chat-messages .radio-chat-username {
    display: block;
    max-width: 100%;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#radio-chat .radio-chat-reply-button {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 2px 7px;
    border: 1px solid rgba(255, 136, 2, .65);
    border-radius: 4px;
    background: rgba(0, 0, 0, .22);
    color: #FF8802;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
    white-space: nowrap;
    cursor: pointer;
}

#radio-chat .radio-chat-reply-button:hover {
    background: rgba(255, 136, 2, .16);
}

#radio-chat .radio-chat-reply-button:focus-visible {
    outline: 2px solid #FF8802;
    outline-offset: 2px;
}

/* Keep the previously validated highlight for replies addressed to me. */
#radio-chat-messages .radio-chat-item.is-reply-to-me {
    background: rgba(255, 136, 2, .18);
    box-shadow: inset 4px 0 0 #FF8802;
}

@media (max-width: 700px) {
    #radio-chat-messages .radio-chat-item {
        grid-template-columns: minmax(0, 1fr) minmax(90px, 26%);
        column-gap: 9px;
        padding: 10px 8px;
    }

    #radio-chat-messages .radio-chat-item-author {
        padding-left: 8px;
    }
}

/* Quote of original chat message: one line, ellipsis, native title tooltip. */
#radio-chat-messages .radio-chat-meta {
    display: flex;
    align-items: baseline;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
#radio-chat-messages .radio-chat-date {
    flex: 0 0 auto;
}
#radio-chat-messages .radio-chat-quoted-context {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}
#radio-chat-messages .radio-chat-quote {
    display: inline;
    white-space: nowrap;
}

/* Chat heading: sorting changes only the message list, never the composer. */
.radio-chat-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.radio-chat-heading .radio-chat-title {
    margin: 0;
}

#radio-chat-anchor {
    scroll-margin-top: 32px;
}

#radio-chat-order-toggle {
    border: 1px solid #FF8802;
    border-radius: 8px;
    padding: 7px 11px;
    background: transparent;
    color: #FF8802;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#radio-chat-order-toggle:hover,
#radio-chat-order-toggle:focus-visible {
    background: rgba(255, 136, 2, .12);
}

#radio-chat-order-toggle:focus-visible {
    outline: 2px solid #FF8802;
    outline-offset: 2px;
}
