/* ==========================================================================
   Messaging: conversation list and thread, shared by "Mon espace" (app.css)
   and the back-office (admin.css, light and dark). Colours mix with the
   current text colour so they work on both.
   ========================================================================== */

.msg-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.msg-list__item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s;
}

.msg-list__item:hover,
.msg-list__item:focus-visible {
    border-color: #e4572e;
    color: inherit;
}

.msg-list__item--unread {
    border-left: 4px solid #e4572e;
}

.msg-list__item--unread .msg-list__title {
    font-weight: 800;
}

.msg-list__main {
    display: grid;
    flex: 1;
    gap: 0.2rem;
    min-width: 0;
}

.msg-list__title {
    font-weight: 600;
}

.msg-list__excerpt {
    overflow: hidden;
    opacity: 0.75;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-list__side {
    display: grid;
    flex: 0 0 auto;
    justify-items: end;
    gap: 0.3rem;
    opacity: 0.85;
    font-size: 0.8rem;
}

.msg-badge {
    display: inline-block;
    min-width: 1.4em;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: #e4572e;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.msg-thread {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.msg-bubble {
    justify-self: start;
    max-width: min(80%, 640px);
    padding: 0.7rem 0.95rem;
    border-radius: 14px 14px 14px 4px;
    background: color-mix(in srgb, currentColor 7%, transparent);
}

.msg-bubble--mine {
    justify-self: end;
    border-radius: 14px 14px 4px 14px;
    background: color-mix(in srgb, #e4572e 16%, transparent);
}

.msg-bubble__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
    font-size: 0.8rem;
}

.msg-bubble__body {
    overflow-wrap: anywhere;
    white-space: normal;
}

.msg-notice {
    margin: 0 0 1rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    background: color-mix(in srgb, #e6ae48 18%, transparent);
    font-size: 0.9rem;
}

.msg-reply textarea {
    width: 100%;
    min-height: 7rem;
    resize: vertical;
}

@media (max-width: 575.98px) {
    .msg-bubble {
        max-width: 92%;
    }
}

.msg-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.msg-files__image img {
    display: block;
    width: 140px;
    height: 105px;
    border-radius: 8px;
    object-fit: cover;
}

.msg-files__video {
    width: min(320px, 100%);
    border-radius: 8px;
    background: #000;
}

.msg-files__file {
    display: inline-block;
    max-width: 100%;
    padding: 0.35rem 0.7rem;
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    border-radius: 8px;
    color: inherit;
    overflow-wrap: anywhere;
}

.msg-files__file span {
    opacity: 0.7;
    font-size: 0.85em;
}
